• Priority: 0
  • Status: Closed
  • Theme: Alysum
  • Assigned To: Alex
  • Private: No
  • Open Date: 24.02.16, 12:36
  • Opened by: imad
  • Closed by: Alex
  • Closed on: 16.09.16, 10:39
  • Reason: No answer from a customer
  • Comment: Glad to help!

Ticket #9238 - Problem with add to cart button for products out of stock

Hi,

I have a bug on the add to cart button for product that are out of stock.
It works fine for the first out of stock product on the list, but for the others even if the product is out of stock the add to cart appears.
example : http://digifact.craieboutique.com/fr/113-les-sacs-en-cuir

Regards

Comments

Kate Support 24 Feb 2016, 12:55

Hi,
please try to check the issue in default-bootstrap theme first. You can safely switch to it in BO > Preferences > Themes. Press “Advanced Settings” and there choose directory “default-bootstrap”. After the check you can switch back to Alysum theme. None of your modifications or configurations will be lost.
After that write us back if the same issue appears in default theme as well

imad 24 Feb 2016, 12:58

Hi, the same issue doesnt apper in default theme. Regards

Kate Support 24 Feb 2016, 13:53

Hi, but when I switch your store to default theme I see that “add to cart” button appears for out-of-stock products as well http://c2n.me/3uK2Bz3
This button is not active and has slightly different color than active button.
In Alysum theme it’s the same. This is not a bug, this is default Prestashop behavior.
The “add to cart” button for out-of-stock products is not active. And you can set different color for not active button with this css code

.product_list > li .ajax_add_to_cart_button.disabled {background-color: #abbdaf}

Add this code to TS > Custom CSS

Dan G. 14 May 2016, 14:09

It’s a Prestashop bug, and because you’ve kept the product-list.tpl format from default-boostrap you got it also in the alysum theme.

To be able to fix it, you need to edit the file themes/alysum/product-list.tpl - line 152

the code looks like this:

{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
								{if ($product.allow_oosp || $product.quantity > 0)}
									{if isset($static_token)}
										<a class="button ajax_add_to_cart_button dib btn btn-default" href="{$link->getPageLink('cart',false, NULL, "add=1&amp;id_product={$product.id_product|intval}&amp;token={$static_token}", false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
											<i></i>{l s='Add to cart'}
										</a><br class="lst" />
									{else}
										<a class="button ajax_add_to_cart_button dib btn btn-default" href="{$link->getPageLink('cart',false, NULL, 'add=1&amp;id_product={$product.id_product|intval}', false)|escape:'html':'UTF-8'}" rel="nofollow" title="{l s='Add to cart'}" data-id-product="{$product.id_product|intval}">
											<i></i>{l s='Add to cart'}
										</a><br class="lst" />
									{/if}						
								{else}
									<span class="button ajax_add_to_cart_button dib btn btn-default disabled">
										<i></i>{l s='**Add to cart**'}
									</span><br class="lst" />
								{/if}
							{/if}

and you need to replace the last * * Add to cart * * with your own text - something like “Not Available” - or “Out of stock” … or even directly translated in your language. Be careful, I have added those stars just to show you where you need to replace the text - they should be there.

Once you’ve done that, you need to clear the cache, so that the changed file will be processed again.

You can also add the CSS quick fix stated by Kate, and set that button to a color that can actually state that the product is not in stock…

PS: For the devs > please fix this in the next release, and you need to do a release soon, because it’s been half of year of no updates, and I’m really wondering if I’ve taken the right decision to buy this theme - there are many bugs that need fixing and apparently you’re not even taking the small steps in fixing them.

Alex 16 May 2016, 09:56

Hi Dan. Thank you for finding fix. We will implement it in next release.

there are many bugs that need fixing and apparently you’re not even taking the small steps in fixing them What the bugs you mean? Please create a ticket and describe the bugs and we will fix it for you. We don’t make Alysum updates because it works good in most our clients shops. All the bugs are small and not really critical. But I think soon we will make update ;-)