nspinheiro Posted November 25, 2013 Share Posted November 25, 2013 Hi I need to make a change in the field "on.advert" depending on the costumer id. in product.tpl i found {if $product->on_sale} <span class="advert">{l s='On sale!'}</span> {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice} <span class="advert">{l s='Reduced price!'}</span> {/if} I tried to make something like this, but i think i have an error on the code (i never coded before...): {if $product->on_sale} <span class="advert">{if $id_group-->1 OR if $id_group-->2 OR if $id_group-->3 >{l s='On sale!'}</span> {elseif {if $id_group-->4 OR if $id_group-->5 OR if $id_group-->6 OR if $id_group-->7 OR if $id_group-->8 OR if $id_group-->9 OR if $id_group-->10>{l s='Outlet!'}</span> {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice} <span class="advert">{l s='Reduced price!'}</span> {/if} Basically i need to appear "On sale!" on clients from the groupid 1, 2 and 3, and all the others to be "Outlet" Link to comment Share on other sites More sharing options...
vekia Posted November 26, 2013 Share Posted November 26, 2013 isntead of --> use == BAD: $id_group-->2 OK: $id_group==2 what you've got in $id_group variable? it exists? Link to comment Share on other sites More sharing options...
nspinheiro Posted November 26, 2013 Author Share Posted November 26, 2013 Yes it exists, in ps_group_lang for example, where is defined the name of the groups, or in ps_group where is the data regarding the price conditions for each group. I've made those changes and the product page does not load. "Current" Code {if $product->on_sale} <span class="advert">{if $id_group==1 OR if $id_group==2 OR if $id_group==3 >{l s='On sale!'} {elseif {if $id_group==4 OR if $id_group==5 OR if $id_group==6 OR if $id_group==7 OR if $id_group==8 OR if $id_group==9 OR if $id_group==10>{l s='Outlet!'} {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice}</span> <span class="advert">{l s='Reduced price!'}</span> {/if} Link to comment Share on other sites More sharing options...
nspinheiro Posted December 2, 2013 Author Share Posted December 2, 2013 (edited) Hello After many changes and experiences i was able to get some progress here with the following code: {if $product->on_sale} {if $id_group < 4} <span class="advert">{l s='On sale!'} {else} <span class="advert">{l s='OUTLET!'} {/if} {elseif $product->specificPrice AND $product->specificPrice.reduction AND $productPriceWithoutRedution > $productPrice}</span> <span class="advert">{l s='Reduced price!'}</span> {/if} It now opens the page of the product, but with following messages: Notice: Undefined index: id_group in /home/s002830/public_html/LOJA/cache/smarty/compile/f9/0c/19/f90c193fc8fabce72bf3313a40a9b4ca39adc7f6.file.product.tpl.php on line 551 - See more at: LOJA/cabos/939-philips-cabo-es-bl-110-outlet-8426481300767.html#sthash.anm8IxYC.dpuf Notice: Trying to get property of non-object in /home/s002830/public_html/LOJA/cache/smarty/compile/f9/0c/19/f90c193fc8fabce72bf3313a40a9b4ca39adc7f6.file.product.tpl.php on line 551 - See more at: LOJA/cabos/939-philips-cabo-es-bl-110-outlet-8426481300767.html#sthash.anm8IxYC.dpuf I don't understand much about this, but it looks like that i have to add somewhere the id_group to be indexed for it to know what it is and read data, something like that. in product.tpl on line 551 i have: (LINE 546) {if isset($features) && $features} (LINE 547) <!-- product's features --> (LINE 548) <ul id="idTab2" class="bullet"> (LINE 549) {foreach from=$features item=feature} (LINE 550) {if isset($feature.value)} (LINE 551) <li><span>{$feature.name|escape:'htmlall':'UTF-8'}</span> {$feature.value|escape:'htmlall':'UTF-8'}</li> (LINE 552) {/if} (LINE 553) {/foreach} (LINE 554) </ul> (LINE 555) {/if} Any ideas to help me? Edited December 2, 2013 by nspinheiro (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now