仅在选中属性时如何显示产品定制?

时间:2019-07-01 11:47:22

标签: customization prestashop-1.7

仅在PrestaShop中选中属性时,如何显示product-customization.tpl? 我的意思是,我有2个产品属性:

  • 自定义您的产品
  • 不要自定义

如果选中第一个,则显示product-customization.tpl 我用jquery尝试了一下,但是不起作用:

 $(document).ready(function () {
  $('.product-customization').each(function () {
      if ($(this).val() == ('34') && $(this).is(':checked')) {
              $('#show').show();

      } else {
          $('#show').hide();
      }
  });
});

这是product-variants.tpl

 {elseif $group.group_type == 'radio'}
    <ul id="group_{$id_attribute_group}">

      {foreach from=$group.attributes key=id_attribute item=group_attribute}
        <li>
          <label>
            <input class="input-radio" type="radio" data-product-attribute="{$id_attribute_group}" name="group[{$id_attribute_group}]" value="{$id_attribute}"{if $group_attribute.selected} checked="checked"{/if} >
            <span class="radio-label">{$group_attribute.name}</span>
          </label>
        </li>
      {/foreach}
    </ul>
  <div id="show" style="display: none;">

              {if $product.is_customizable && count($product.customizations.fields)}
                    {block name='product_customization'}
                        {include file="catalog/_partials/product-customization.tpl" customizations=$product.customizations}
                    {/block}
                {/if}

0 个答案:

没有答案