![]() |
If statement for specific option class?
Here's a tricky one - have a client who we are displaying the price on the category page with 'Starting at' in front of it for products with options using this:
{if $products[product].is_product_options} However, he would only like this to display for products that are variants with a specific option class - in this case 'size'. So products that have an option with the class of 'size' will show 'starting at' while products that have an option class of 'flavor' will not. Version 4.1.10. Any ideas? |
Re: If statement for specific option class?
It's quite simple
find in your skin1/customer/main/product.tpl Code:
<tr><td class="ProductPriceConverting" valign="top">{$lng.lbl_price}: Code:
<tr><td class="ProductPriceConverting" valign="top">{$lng.lbl_price} {foreach from=$product_options item=v}{if $v.class|lower eq 'size'}starting at{/if}{/foreach}: |
Re: If statement for specific option class?
Sorry I have missed that you need this in category.
add in your products.php before the line Code:
$smarty->assign("products",$products); this: Code:
foreach($products as &$pp){ and every product from your $products array will contain additional array with product options so you just need to edit skin1/customer/main/products.tpl and skin1/customer/main/products_t.tpl as it was figured in my previous post |
Re: If statement for specific option class?
No luck with that Victor. There's an extra & in your php (before $pp) but even removing that doesn't do anything. Any other ideas?
|
Re: If statement for specific option class?
This & is necessary to pass the element of array by reference so it should present because $products array won't be modified without it.
But I have found another bug (error message for the categories with no products in it) so try with Code:
if (count($products)) and Code:
{foreach from=$products[product].product_options item=v}{if $v.class|lower eq 'size'}starting at{/if}{/foreach} |
Re: If statement for specific option class?
Well that causes a smarty error :)
|
Re: If statement for specific option class?
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /public_html/new/products.php on line 106
|
Re: If statement for specific option class?
Try this php:
PHP Code:
|
Re: If statement for specific option class?
Thanks Ralph - no smarty error from that, but no 'starting at' showing either. Other ideas?
|
Re: If statement for specific option class?
http://www.phpbuilder.com/manual/en/language.references.pass.php
also I should mention that this is working for me ;) |
All times are GMT -8. The time now is 05:52 AM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.