Jump to content

[help] Group & Attribute product agar tampil berbeda untuk sebuah category tertentu


vespaman

Recommended Posts

cara memodifikasi Group & Attribute product agar tampil berbeda untuk sebuah category tertentu, atau untuk suatu product dalam category tertentu. saya pakai script berikut ini. namun tidak tampil atau blank page.

{if $id_category = 10}{foreach from=$groups key=id_attribute_group item=group}

<p>

<label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>

{assign var='groupName' value='group_'|cat:$id_attribute_group}

<select name="{$groupName}" id="group_{$id_attribute_group|intval}" onChange="javascript:findCombination();{if $colors|@count > 0}$('#resetImages').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>

{/foreach} {else} {foreach from=$groups key=id_attribute_group item=group}

<p>

<label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>

{assign var='groupName' value='group_'|cat:$id_attribute_group}

 

{foreach from=$group.attributes key=id_attribute item=group_attribute}

{$group_attribute|escape:'htmlall':'UTF-8'}

{/foreach}

 

</p>

{/foreach}

Link to comment
Share on other sites

smarty if statement anda pada script tsb, tidak tertutup sehingga smarty error dan menyebabkan blank page

 

{if variabel} <!-- awal if statement -->

<!-- eksekusi disini -->

{/if} <!-- akhir if statement -->

 

 

Note:

jika posting script atau code, sebaiknya anda format dengan CODE (klik icon <>) agar tampil enak dilihat

Link to comment
Share on other sites

udah tak tutup tapi masih aja mas.. berikut scriptnya

 

 

{if isset($groups)}
  <!-- attributes -->
  <div id="attributes">
  {if ($id_category = 10)}{foreach from=$groups key=id_attribute_group item=group}
 <p>
   <label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>
   {assign var='groupName' value='group_'|cat:$id_attribute_group}
   <select name="{$groupName}" id="group_{$id_attribute_group|intval}" onChange="javascript:findCombination();{if $colors|@count > 0}$('#resetImages').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>
  {/foreach}
  {else}{foreach from=$groups key=id_attribute_group item=group}
  <p>
   <label for="group_{$id_attribute_group|intval}">{$group.name|escape:'htmlall':'UTF-8'} :</label>
   {assign var='groupName' value='group_'|cat:$id_attribute_group}

 {foreach from=$group.attributes key=id_attribute item=group_attribute}
 {$group_attribute|escape:'htmlall':'UTF-8'}
 {/foreach}

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

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...