Jump to content

Show price /unittype OK in product-list but doesn't work in product.tpl?


kineas

Recommended Posts

Hello, 

 

I would like to display the "unit" (which is set by a feature) in the product.tpl. 

 

I can't find where to add this code in the product.tpl, however it works on product-list.tpl. Can anyone help please? :-)

 

In order to show the unit-type the price was referring to (/kg, /unit, /piece, ...) I did two things: 

1/ Create a "feature" named "unittype" in the backoffice

2/ modified the product-list.tpl by adding, just after the line "{hook h="displayProductPriceBlock" product=$product type="unit_price"}"

<!-- Display Unit -->
{if isset($product.features) && $product.features}        
{foreach from=$product.features item=feature}
<tr class="{cycle values="odd,even"}">
{if $feature.name eq 'unittype'}
{$feature.value|escape:'html':'UTF-8'}
{/if}
</tr>
{/foreach}
{/if}
<!-- End Display Unit -->

It works just fine. 

And I seem to put it in the wrong place on product.tpl because it never worked...

 

Thank you in advance! 

Edited by kineas (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...