Jump to content

[Solved] Product.tpl attribute conditions


Recommended Posts

Hi PS people

 

I could do with some help with setting up a condition on the product.tpl and not having a knowledge of smarty i wonder if someone could help

 

I would like an extra button to be visable if a certain attribute exists on a product and be invisable if the attribute doesnt.

What i'm looking at doing is adding a "size Guide" button for products that have the Size attribute and clicking it open a size guide window, I can code that but i need some help with setting up the condtion.

 

Looking at the product.tpl it's around here somewhere

 

<div id="attributes">
  {foreach from=$groups key=id_attribute_group item=group}
  {if $group.attributes|@count}
  <p>
<label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'}:</label>
{assign var="groupName" value="group_$id_attribute_group"}
<select name="{$groupName}" id="group_{$id_attribute_group|intval}" onchange="javascript:findCombination();{if $colors|@count > 0}$('#wrapResetImages').show('slow');{/if};">
 {foreach from=$group.attributes key=id_attribute item=group_attribute}
  <option value="{$id_attribute|intval}"{if (isset($smarty.get.$groupName) && $smarty.get.$groupName|intval == $id_attribute) || $group.default == $id_attribute} selected="selected"{/if} title="{$group_attribute|escape:'htmlall':'UTF-8'}">{$group_attribute|escape:'htmlall':'UTF-8'}

				   </option>
 {/foreach}
</select>
  </p>
  {/if}
  {/foreach}
  </div>

 

any help or poniter would be very welcome.

 

all the best

 

 

Groove

Link to comment
Share on other sites

Right ok if anyone is interested i work this out and it works pretty damn find, if a product has an attribute of "size" a Size Guide Button will appear, if it hasn't it wont... group_4 is the attribute group name that was allocated to "Size"

 

 

{if $groupName eq 'group_4'}<a class="button" a href="javascript:load()">Size Guide</a>
   {/if}

 

hope that helps someone out that is looking to do the same thing.

 

Groove

  • Like 1
Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...