Jump to content

Edit History

Fabrizio Carloni

Fabrizio Carloni

I'm using AngarTheme but it's not a theme problem but a code problem ... in practice the additions in bold I made to the product-add-to-cart.tpl file remove the word "Not available" when a user has the latest product in cart but unfortunately adds the double word "Available Available" when a product is available:

{$in_cart = 0}
{foreach from=$cart['products'] item='cart_product'}
  {if $cart_product['id_product'] == $product.id}
    {$in_cart = 1}
  {/if}
{/foreach}

{block name='product_availability'}
  <span id="product-availability">
  {if $product.show_availability && $product.availability_message}
    {if $product.availability == 'available'}
      <i class="material-icons rtl-no-flip product-available">&#xE5CA;</i>
      {$product.availability_message}
    {elseif $product.availability == 'last_remaining_items'}
      <i class="material-icons product-last-items">&#xE002;</i>
      {$product.availability_message}
    {else}
      {if !$in_cart}
        <i class="material-icons product-unavailable">&#xE14B;</i>
      {/if}
    {/if}
    {if !$in_cart}
      {$product.availability_message}
    {/if}
  {/if}
  </span>
{/block}

Best regards,
Fabrizio.

Fabrizio Carloni

Fabrizio Carloni

I'm using AngarTheme but it's not a theme problem but a code problem ... in practice the additions in bold I made to the product-add-to-cart.tpl file remove the word "Not available" when a user has the latest product in cart but unfortunately adds the double word "Available Available" when a product is actually available:

{$in_cart = 0}
{foreach from=$cart['products'] item='cart_product'}
  {if $cart_product['id_product'] == $product.id}
    {$in_cart = 1}
  {/if}
{/foreach}

{block name='product_availability'}
  <span id="product-availability">
  {if $product.show_availability && $product.availability_message}
    {if $product.availability == 'available'}
      <i class="material-icons rtl-no-flip product-available">&#xE5CA;</i>
      {$product.availability_message}
    {elseif $product.availability == 'last_remaining_items'}
      <i class="material-icons product-last-items">&#xE002;</i>
      {$product.availability_message}
    {else}
      {if !$in_cart}
        <i class="material-icons product-unavailable">&#xE14B;</i>
      {/if}
    {/if}
    {if !$in_cart}
      {$product.availability_message}
    {/if}
  {/if}
  </span>
{/block}

Best regards,
Fabrizio.

×
×
  • Create New...