Jump to content

homefeatured.tpl need to add product quantity in home featured page


Recommended Posts

Already working :)
Found topic here how-to-add-quantity-to-your-home-featured-module, but for version 1.3.6 FIRST STEP doesn't work.
I made these changes:
1. In “homefeatured.tpl” under “/modules/homefeatured/” (line 19-24)

{if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2}
{l s='Add to cart' mod='homefeatured'}
{else}
{l s='Add to cart' mod='homefeatured'}
{/if}



2. Changed with below code:

{if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}

{l s='Quantity :'}
<input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]"id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" />

{l s='Add to cart'}
{else}

{l s='Quantity :'}
<input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" />
{l s='Add to cart' mod='homefeatured'}                        

{l s='Out of Stock' mod='homefeatured'}
{/if}
{l s='View' mod='homefeatured'}



NEXT STEPS WERE GOOD from the previous link.
3. After that save file and close. Then edit “ajax-cart.js” under “/modules/blockcart/” and go to line 10, find code:

ajaxCart.add(idProduct, null, false, this);


Change it with

ajaxCart.add(idProduct, null, false, this, $('#quantity_wanted_'+idProduct).val());



Good luck :)

Link to comment
Share on other sites

  • 2 weeks later...

I also tried their solution, but always happens the same. When i write the quantity and push the Add to cart button, the aplication brings me to a page where sais:

There is 1 error :

01. product not found

Did it happen any time to you when you were developing your code??

I almost understand your code, but i don't know what doing this:

&token;={$static_token}

I suppose it's the essence of the code, because it is the result of pushing the Add to cart button.

Any comment will be welcome.

Thanks,

Link to comment
Share on other sites

Hi :)
Sorry, but I do not understand codes :) With the original homefeatured.tpl, products were showed like in firs picture.
The original hemefeatured.tpl was:

<!-- MODULE Home Featured Products -->

{l s='Featured products!' mod='homefeatured'}
   {if isset($products) AND $products}

           {assign var='liHeight' value=242}
           {assign var='nbItemsPerLine' value=4}
           {assign var='nbLi' value=$products|@count}
           {assign var='nbLines' value=$nbLi/$nbItemsPerLine|ceil}
           {assign var='ulHeight' value=$nbLines*$liHeight}

           {foreach from=$products item=product name=homeFeaturedProducts}

{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}
getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />


{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
{l s='View' mod='homefeatured'}
                       {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2}
{l s='Add to cart' mod='homefeatured'}
                       {else}
{l s='Add to cart' mod='homefeatured'}
                       {/if}


           {/foreach}


   {else}

{l s='No featured products' mod='homefeatured'}
   {/if}

<!-- /MODULE Home Featured Products -->

Link to comment
Share on other sites

It was different from the other, described in other posts. My new homefeatured.tpl is:

<!-- MODULE Home Featured Products -->

{l s='Featured products!' mod='homefeatured'}
   {if isset($products) AND $products}

           {assign var='liHeight' value=242}
           {assign var='nbItemsPerLine' value=4}
           {assign var='nbLi' value=$products|@count}
           {assign var='nbLines' value=$nbLi/$nbItemsPerLine|ceil}
           {assign var='ulHeight' value=$nbLines*$liHeight}

           {foreach from=$products item=product name=homeFeaturedProducts}

{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}
getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />


{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
                       {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2}

{l s='Quantity :'}
                       <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" />

{l s='Add to cart'}
                       {else}

{l s='Quantity :'}
                        <input type="text" name="ajax_qty_to_add_to_cart[{$product.id_product|intval}]" id="quantity_wanted_{$product.id_product|intval}" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" />
{l s='Add to cart' mod='homefeatured'}                        

{l s='Out of Stock' mod='homefeatured'}
                        {/if}                        
{l s='View' mod='homefeatured'}


           {/foreach}


   {else}

{l s='No featured products' mod='homefeatured'}
   {/if}

<!-- /MODULE Home Featured Products -->



And now products are like in attached picture.
Maybe you understand more than me and will find what you need to change :)

40106_Se0zFKi2vjiLRplkrcIG_t

Link to comment
Share on other sites

  • 2 months later...

I did as written and will not work, if anyone can help me? I use PS 1,3,6 and theme ''rumahbatik'' and this is my homefeatured.tpl

<!-- MODULE Home Featured Products -->

   {if isset($products) AND $products}

           {assign var='liHeight' value=470}
           {assign var='nbItemsPerLine' value=4}
           {assign var='nbLi' value=$products|@count}
           {assign var='nbLines' value=$nbLi/$nbItemsPerLine|ceil}
           {assign var='ulHeight' value=$nbLines*$liHeight}

           {foreach from=$products item=product name=homeFeaturedProducts}

{$product.name|truncate:20:'...'|escape:'htmlall':'UTF-8'}
getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />

{$product.description_short|strip_tags|truncate:130:'...'}

 

 



{l s='View' mod='homefeatured'}
                       {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2}
{l s='Add to cart' mod='homefeatured'}
                       {else}
{l s='Add to cart' mod='homefeatured'}
                       {/if}

 


           {/foreach}


   {else}

{l s='No featured products' mod='homefeatured'}
   {/if}

<!-- /MODULE Home Featured Products -->

Link to comment
Share on other sites

×
×
  • Create New...