Possible to display available sizes in the product tile in Shoper - smarty

Is possible to show for example all available size in product tile? I use variant product with magazine support. Product without magazine support show on main page, category page in suitable product tile information about available size but product with magazine support show all size, also not available. I can't get any info about stock variant product, which allow me remove unnecessary info. product tile
First product is variant with magazine support, size 46 is not available (stock 0)
Second - product without magazine support
I have to be able to manage for example stock product variant because using magazine support
{assign var=options value=$product->getOptionsConfigurationStruct()}
{if $product->product->group_id && count($options)}
<div class="size-values-product">
{foreach from=$options item=option}
{if ($option.name|escape == 'Rozmiar')}
{foreach from=$option.values item=value}
<span value="{$value.id|escape}">{$value.name|escape}</span>
{/foreach}
{/if}
{/foreach}
</div>
{/if}
How do I do that?

Related

Display product available sizes on product miniature Prestashop 1.7

I would like to know how to show available product sizes on product miniature in Prestashop 1.7.
Variable $product.size gives an array so I tried somehow to use
<ul>
{foreach from=$product key=?? item=??}
<li>{$product.size}</li>
{/foreach}
</ul>
but doesn't work. Exactly it returns maybe 20 empty
file is located in your_theme/templates/catalog/_partials/miniatures/product.tpl
Could somebody help me?
Thanks is advance
Unfortunately in 1.7 you can't just display all attributes related to product, without additional modifications. By default, you have only access to "default" attribute.
There are number of additional modules to do that, you can search them by looking for "PrestaShop Attributes on product list" on both official and third party marketplaces.
If you want to consider doing modification by your own, I suggest to look at the Product::getProductsProperties method where you have a code which is used to get all informations about the product displayed on the list.
Display defaut attributes on product miniature Prestashop 1.7
file located : your_theme/templates/catalog/_partials/miniatures/product.tpl
{*------Display default attributes in product list-----*}
{if isset($product.attributes) && !empty($product.attributes)}
<span class="default-attributes">
{foreach from=$product.attributes item=attribute}
{$attribute.group} : {$attribute.name}
{/if}
{/foreach}
</span>
{/if}
For me works the solution by Idriss el basrii thanks to him
but you just delete the {/if} closure tag inside foreach :
{*------Display default attributes in product list-----*}
{if isset($product.attributes) && !empty($product.attributes)}
<span class="default-attributes">
{foreach from=$product.attributes item=attribute}
{$attribute.group} : {$attribute.name}
{/foreach}
</span>

Shopware rich-snippets add to products problem

I using Shopware 5.5.10 on my shop. I try to set "priceValidUntil" for each product for google search console because warning on it.
shopware told in version 5.5.8 update
Added rich-snippets for priceValidUntil , url, image and
gtin13
I have folloowing part in details/index.tpl
{block name='frontend_detail_index_buy_container_inner'}
<div itemprop="offers" itemscope itemtype="{if $sArticle.sBlockPrices}http://schema.org/AggregateOffer{else}http://schema.org/Offer{/if}" class="buybox--inner">
{* Product name *}
{block name='frontend_detail_index_name'}
<h1 class="product--title" itemprop="name" style="margin: 0px 0px 20px 0px; margin: 0rem 0rem 1.25rem 0rem;">
{$sArticle.articleName}
</h1>
{/block}
How I can add the 'priceValidUntil' rich-snippets to my products?
Shopware does not have a function that allows you to configure time-controlled prices. Accordingly there is only one template block where plugins that offer this functionality can add their rich snippets. Since the snippet is only recommended in cases where the price will be discontinued after a certain time.
This is the block: https://github.com/shopware/shopware/blob/8b4a754307c24cb26630ee72559b15b337e7ceff/themes/Frontend/Bare/frontend/detail/content/buy_container.tpl#L84
You can add your own data like this:
{extends file="parent:frontend/detail/content/buy_container.tpl"}
{block name="frontend_detail_index_data_price_valid_until"}
{$smarty.block.parent}
<meta itemprop="priceValidUntil" content="your-time" />
{/block}
Those are simple template adjustments that are described in the template tutorial of shopware. It is not recommended on normal prices, since they won't end at a certain time.
//EDIT:
https://github.com/shopware/shopware/blob/fe95215f7bb9da24f4b78a86300579b340f4a1c2/themes/Frontend/Bare/frontend/detail/content/header.tpl#L14
On the product detail page shopware will use the first image of the product automatically. There are not adjustments needed - if you want to change this behavior you can use the syntax like before and change the block you want to overwrite.
https://github.com/shopware/shopware/blob/fe95215f7bb9da24f4b78a86300579b340f4a1c2/themes/Frontend/Bare/frontend/detail/content/header.tpl#L20
The same thing with ean. Shopware will use the Ean field as gtin and check the length of the input. You can use simple template adjustments to overwrite this logic.
https://github.com/shopware/shopware/blob/96161effd05153d4b95f4a9324998c047988724c/themes/Frontend/Bare/frontend/_includes/rating.tpl#L77
And the same with rating too.

Rich Snippet on homepage

We have embedded rich snippets for a rental objects rating website. Here an example:
http://www.google.de/webmasters/tools/richsnippets?q=http%3A%2F%2Fwww.sonnenquartiere.de%2Fferienwohnungen%2F4-wohnung-8-boardinghaus-norderney-2-zimmer-apartment.html
Works fine when listed in Google search results.
Now we want to aggregate all ratings and post them on the homepage so the homepage itself gets a rating in the Google search results. We did it some time ago:
http://www.google.de/webmasters/tools/richsnippets?q=www.sonnenquartiere.de
We did that some time ago, but the result in the Google Search is still not being displayed with the aggregated rating. Here an Example:
https://www.google.de/search?q=Boardinghaus+Norderney (2nd place here)
Is there something we can do to get this working?
One thing that I did notice about your markup is that you are using the schema.org/WebPage markup for your aggregate review rating. So search engines are seeing that schema as a rating for your home page. You should be using the aggregate rating schema with a schema that better describes your type of business, perhaps something in the schema.org/LodgingBusiness category.
I hope this is not too late and that I will be able to help.
Following the standard procedure is the best practice in such thing. Make sure you use the correct markup. So for review use the reviews-schema as the example below:
Use this tool to generate the code and then modify your website according to this working sample
http://www.microdatagenerator.com/reviews-schema/
For example:
<div itemscope itemtype="http://schema.org/Review">
<div itemprop="itemReviewed" itemscope temtype="http://schema.org/Thing"><span itemprop="name">home mortgage</span> </div>
<div itemprop="author" itemscope itemtype="http://schema.org/Person">
<span itemprop="name"> Nick M.</span>
</div><meta itemprop="datePublished" content = "01/01/2016">
<div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating"
<meta itemprop="worstRating" content = "1"/><span itemprop="ratingValue">5</span>/<span itemprop="bestRating">5</span> stars </div>
<span itemprop="description">My experience with ABC Company was very good and I recommend it to everyone. </span>
</div>
you take that code and take the parts you need to your webpage.
This video was great:
https://www.youtube.com/watch?v=N2PjWtybDOs

How should I markup price columns and setup fee according to schema.org

In the promotional products industry, an item will be offered at a certain price with a minimum quantity. Then, there will be another quantity level after which the price per piece goes down. There might be 5 or 6 of these levels.
In addition to the price per item, there is almost always a setup fee because they are being custom printed.
How do I mark this up using schema.org vocabulary?
Try using schema.org/Offer class and its property eligibleQuantity
Description of eligibleQuantity says
The interval and unit of measurement of ordering quantities for which the offer or price specification is valid. This allows e.g. specifying that a certain freight charge is valid only for a certain quantity.
Seems it's what you need.
Markup may look like this
<div itemscope itemtype="http://schema.org/Offer">
<span itemprop="price">$55.00</span>
<div itemprop="eligibleQuantity" itemscope itemtype="http://schema.org/QuantitativeValue">
<span itemprop="minValue">1</span>
<span itemprop="maxValue">5</span>
</div>
</div>

How do I exclude last node

I have following html tag structure.
<?xml version="1.0" encoding="UTF-8"?><div class="MainContentTextContainer">
<br/> To break the stalemate of heavy competition and low growth in the traditional orthopedic implant markets, the major orthopedic companies are turning to biologics. This white paper provides some information on this trend. Information from this White Paper was obtained from Kalorama's full market study on this market 'The World Market for Orthopedic Biomaterials SKU KLI6329663," as well as news media sources. <br/>
<br/>
<p> "We also feature department and global pricing for reports that we be utilized by more than one user at your company."
</p>
<p>
<b>Related Reports:</b>
</p>
<!-- [PID:6921310] -->
The Global Market for Medical Devices, 3rd. Edition
<br/>May 2, 2012 - KLI3873247 - $1,995.00<br/>
<br/>
</div>
Above is my html node structure.I want to return MainContentTextContainer node which does not contain nodes after last <p> tag which contains 'Related Reports:'.
means i want expected output as:
<div class="MainContentTextContainer">
<br/> To break the stalemate of heavy competition and low growth in the traditional orthopedic implant markets, the major orthopedic companies are turning to biologics. This white paper provides some information on this trend. Information from this White Paper was obtained from Kalorama's full market study on this market 'The World Market for Orthopedic Biomaterials SKU KLI6329663," as well as news media sources. <br/>
<br/>
<p> "We also feature department and global pricing for reports that we be utilized by more than one user at your company."
</p>
</div>
I have used following xpath:
//div[#class='MainContentTextContainer']/*[not(self::p[last()])]
but it is not working.
Please guide me with proper xpath.
Thanks.
This XPath expressions returns all the text and element nodes inside the div that are followed by a p, which means the last p and the nodes following it are not included:
(//div[#class='MainContentTextContainer']/* | //div[#class='MainContentTextContainer']/text())[following-sibling::p]

Resources