Как показать настройки продукта, только если атрибут проверен? - PullRequest
0 голосов
/ 01 июля 2019

как я могу показать product-customization.tpl, только если атрибут проверен в PrestaShop?Я имею в виду, у меня есть 2 атрибута для продукта:

  • Настройте свой продукт
  • Не настраивайте его

Если проверен первый, тоshow product-customization.tpl Я пробовал это с jquery, но не работает:

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

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

, и это product-варианты.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}
...