Archived topic
Add Generateblocks in plugin output
1 reply · Started by Lucia on July 24, 2022
Hello everyone (and please excuse my machine translator English...)
I need to insert a grid to display products retrieved from Magento and it seems to me that the only solution is to use GenerateBlocks.
This is the code I inserted in the output of the plugin:
$out = <<<MCHTML
<div itemscope itemtype="http://schema.org/Product">
<!-- wp:generateblocks/container {"uniqueId":"singleproduct","paddingTop":"20","marginBottom":"20","borderSizeTop":"1","borderSizeRight":"1","borderSizeBottom":"1","borderSizeLeft":"1","borderColor":"#e5e5e5","isDynamic":true,"blockVersion":2} -->
<!-- wp:generateblocks/grid {"uniqueId":"productonly","columns":3,"horizontalGap":20,"verticalGap":20,"verticalAlignment":"center","isDynamic":true,"blockVersion":2} -->
<!-- wp:generateblocks/container {"uniqueId":"{$sku}","isGrid":true,"gridId":"productonly","width":50,"widthMobile":100,"paddingTop":"20","paddingRight":"20","paddingBottom":"20","paddingLeft":"20","paddingSyncUnits":true,"verticalAlignment":"center","isDynamic":true,"blockVersion":2} -->
<!-- wp:html -->
<meta itemprop="sku" content="{$sku}">
<meta itemprop="mpn" content="{$sku}">
<div itemprop="brand" itemtype="https://schema.org/Brand" itemscope="">
<meta itemprop="name" content="{$brand}">
</div>
<span itemprop="description">{$testo}</span>
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<h4 style="margin-top: 10px;"><span itemprop="priceCurrency" content="EUR">€ </span> <span itemprop="price" content="{$offers}"><a href="{$url}" itemprop="url">{$price}</a></span></h4>
<link itemprop="availability" href="http://schema.org/InStock" />
<meta itemprop="priceValidUntil" content="{$year}-12-31" />
</div>
<!-- /wp:html -->
<!-- /wp:generateblocks/container -->
<!-- wp:generateblocks/container {"uniqueId":"image{$sku}","isGrid":true,"gridId":"productonly","width":50,"widthMobile":100,"verticalAlignment":"center","isDynamic":true,"blockVersion":2} -->
<!-- wp:html -->
<link itemprop="image" href="{$image}" />
<a href="{$url}"><img itemprop="image" class="m-0 aligncenter size-full" src="{$image}" alt="{$title}" /></a>
<!-- /wp:html -->
<!-- /wp:generateblocks/container -->
<!-- wp:generateblocks/container {"uniqueId":"pul{$sku}","isGrid":true,"gridId":"productonly","width":100,"widthMobile":100,"verticalAlignment":"center","isDynamic":true,"blockVersion":2} -->
<!-- wp:html -->
<div class="lista sec">
<p><a itemprop="mainEntityOfPage" class="button" href="{$url}"><strong itemprop="name">{$link}</strong></a></p>
<form itemprop="potentialAction" itemscope="" itemtype="http://schema.org/TradeAction"></form>
</div>
<div class="ratings" itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
<meta itemprop="ratingValue" content="100" />
<meta itemprop="ratingCount" content="1" />
<meta itemprop="worstRating" content="100" />
<meta itemprop="bestRating" content="100" />
</div>
<div itemprop="review" itemscope itemtype="http://schema.org/Review" style = "display:none">
<div itemprop="author" itemtype="https://schema.org/Person" itemscope>
<meta itemprop="name" content="$autore" />
</div>
<meta itemprop="datePublished" content="{$data}">
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
<meta itemprop="worstRating" content = "{$worstRating}">
<span itemprop="ratingValue">5</span>/
<span itemprop="bestRating">{$bestRating}</span>stars
</div>
<span itemprop="description">{$valutazione}</span>
</div>
<!-- /wp:html -->
<!-- /wp:generateblocks/container -->
<!-- /wp:generateblocks/grid -->
<!-- /wp:generateblocks/container -->
</div>
MCHTML;
}
In the post, I insert a shortcode like this:
[smdmc_products ids="462" linkname = ""]
But I don't have any html or even css output of GenerateBlock
How can I do that?
Thank you very much!
Hi there,
I'm not sure I understand what you are trying to achieve.
Can you show me the instruction for Magento so I can have a better understanding?