VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: beny.rfg on March 15, 2016, 21:29:54 PM

Title: Indication recomaded product on category page
Post by: beny.rfg on March 15, 2016, 21:29:54 PM
I use Virtuemart 3 with 3rd party template,

if any product labeled as recommended, I need to make this designation appeared on the category page and product page.

Any ideas how to do it?

Thanks, Petr
Title: Re: Indication recomaded product on category page
Post by: jenkinhill on March 15, 2016, 23:17:34 PM
Like this?  http://forum.virtuemart.net/index.php?topic=102353.msg339797#msg339797
Title: Re: Indication recomaded product on category page
Post by: beny.rfg on March 15, 2016, 23:24:14 PM
Yes, it looks like what I need!

But any easy solution how to do it? I feel that this function Virtuemart supports in the default template, but correct me if I'm wrong.
Title: Re: Indication recomaded product on category page
Post by: Ghost on March 16, 2016, 07:24:40 AM
You can do this with template override.
Title: Re: Indication recomaded product on category page
Post by: jenkinhill on March 16, 2016, 11:14:46 AM
You are already using a third party template, so ask them to set it up if you don't understand how overrides work. No, it is not in default VM.
Title: Re: Indication recomaded product on category page
Post by: beny.rfg on March 16, 2016, 21:34:46 PM
I figured out a way to display the recommended label on product detail page:

Add this code to the place where you need in file: templates/your-template-name/html/com-virtuemart/productdetails/default.php (or create override)

<?php if ($this->product->product_special == 1) { 
          echo 
'<span class="product-sale"> ' .  vmText::_('SALE!') . '</span>';
          }
?>


Edit:

And category page:  templates/your-template-name/html/com-virtuemart/category/default.php

<?php if ($product->product_special == 1) { 
          echo 
'<span class="product-sale"> ' .  vmText::_('SALE!') . '</span>';
          }
?>