Jump to content

Problem When you change quantity, the add to cart in the home page disappear


Recommended Posts

in home page you have a list of products and there is add to cart button below each product. Now when you go to the product backoffice and change the minimum quantity required to any value above 1. you will have two changes

 

first the follwog message will appear in the product page. careful in the product page 'This product is not sold individually. You must select at least'

 

but then the add to cart button in the home page will disappear!   how to make it stay regardless of the minimum quantity?

 

Sincerely,

Link to comment
Share on other sites

Of course, it disappears because by default you can only add 1 item to the cart from the homepage (I assume you mean the featured products block). If you want it anyway, you have to amend homefeatured.tpl (/modules/homefeatured), look for and remove 

 

 

AND $product.minimal_quantity == 1

Link to comment
Share on other sites

thanks now it appears back but now it gave a message "you must add ** quantity of this product" which mean that customer will have to go to the product page and press the add to cart button from there any suggestions to bypass this and push to the cart right away??  

Edited by david the developer (see edit history)
Link to comment
Share on other sites

So I sell things by the Kilo (weight). but the items may be 15 or 16 Kilos each for example Banana $0.49/kilo but the case is 7 Kilos

 

so i had this problem

 

in home page and in the category pages you have a list of products and there is add to cart button below each product. Now when you go to the product backoffice and change the minimum quantity required to any value above 1. in the case of banana it is 7 kilos you will have two changes

 

first the following message will appear in the product page. careful in the product page 'This product is not sold individually. You must select at least 7 items'

 

but then the add to cart button in the home page and in the category page will disappear!  

 

I followed Nemo1 advice in the homefeatured.tpl (/modules/homefeatured), I removed  

 

 

AND $product.minimal_quantity == 1

 


the add to cart buttom appeared but is not functioning if you push it it will give a messege "you must add 7 items of this product" then customer will have to go to product page where the minimum quanitity is already set to 7

 

any idea to make the add to cart button works from the home page and the category page

 

 

 

Link to comment
Share on other sites

Hi David,

 

You can use above link tutorial, using this Qty textbox will apprar on home page. Now you can set value = {$product.minimal_quantity} in textbox & make it's imput type = hidden. This will resolve your problem.

 

 

If you are still facing any issue let me know.

 

 

Thanks

Alok

Link to comment
Share on other sites

Yes, what I mean is that, by default, 1 product (quantity = 1) is added from the product list. As you cannot do it, because you need at least 7, you need to specify 7 as quantity to purchase in the product list too :)

Link to comment
Share on other sites

Hi David,

 

Did your problem get resolved. Please suggest so that other people can use this trick.

 

 

Thanks

Alok

 Thanks Alok

 

No the code that I have is the following

 

AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE}

        {if ($product.quantity > 0 OR $product.allow_oosp)} <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart.php')}?qty=1&id_product={$product.id_product}&token={$static_token}&add"><i class="icon-shopping-cart"></i></a> {else} <span class="exclusive"><i class="icon-shopping-cart"></i>{l s='Add to cart' mod='addhomefeatured'}</span> {/if}

                     </div>

 

any change distort the whole thing. I am not sure how to proceed  

Link to comment
Share on other sites

try this

 

<a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart.php')}?qty=7&id_product={$product.id_product}&token={$static_token}&add">

 

Qty says 7, as you can see, but I can't recall if this works with ajax cart as well

Link to comment
Share on other sites

did not work either. i think the best way is to add a quantity box but then make it invisible. howver, using the link of the tutorial did not work  

 

i wonder how to mix this code

 

 

{if ($product.quantity > 0 OR $product.allow_oosp)}
    <div style="display:block; clear:both; margin-top:10px; position:relative; padding:5px; background:#eee; overflow:hidden;">
        <input style="position:absolute;  top:7px; left:7px; padding: 0 3px; text-align:center; height: 20px; border: 1px solid #ccc; display:inline-block; float:left; width:22px;" type="text" name="quantity_to_cart_{$product.id_product|intval}" id="quantity_to_cart_{$product.id_product|intval}" value="1"/>
        <a style="width:60px; display:inline-block; float:right" class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart')}?qty=1&id_product={$product.id_product}&token={$static_token}&add" title="{l s='Add to cart' mod='homefeatured'}">{l s='Add to cart' mod='homefeatured'}</a>
    </div>
{else}

 

with my code

 

AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE}
        {if ($product.quantity > 0 OR $product.allow_oosp)} <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$link->getPageLink('cart.php')}?qty=1&id_product={$product.id_product}&token={$static_token}&add"><i class="icon-shopping-cart"></i></a> {else} <span class="exclusive"><i class="icon-shopping-cart"></i>{l s='Add to cart' mod='addhomefeatured'}</span> {/if}
                     </div>

 

and make the quanitity box invisible

Edited by david the developer (see edit history)
Link to comment
Share on other sites

Hi David,

 

Did your problem get resolved. Please suggest so that other people can use this trick.

 

 

Thanks

Alok

 

i put this code and followed all other modifications in the link still no help

 

<input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" size="2" maxlength="3" {if $product->minimal_quantity > 1}onkeyup="checkMinimalQuantity({$product->minimal_quantity});"{/if} />

 

any suggestions friends

Link to comment
Share on other sites

What i meant is the following. If you go to back office and specified a quantity of lets say 12 or 6 or whatever value for a product. when you go to the product page you will find this quantity in the box all what you need is to push the add to cart button. That’s all

 

Now why I can not have this feature in the home page and in the category page. I can then leave the qty box or have it hidden.

 

The links provided did not work. Any  suggestions?

Link to comment
Share on other sites

Hi David,

 

Did your problem get resolved. Please suggest so that other people can use this trick.

 

 

Thanks

Alok

 I looked over 800 prestashop templates not a single one of them had a quantity box in the home page or the product page. They all have that box in the product page. Any help with a code to work that out. I tried every single thing including copying the codes from the product tpl and css and php files nothing worked! any help please my business is all selling by weight!

Edited by david the developer (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...