We offer professional Design/Code Customisation and Website Optimisation Service Request Customisation
  • Status: Closed
  • Closed by: Marek (marek)
  • Closed on: 16.01.18, 13:21
  • Reason: Closed
  • Comment: Glad to help!

Ticket #11370 - in stock indication and available quantity not showing

Hi, I have 3 problems regarding this issue;

1: Availability:(the one above product reference on product page) is empty unless “in stock” label is defined for the particular product definition. it should be possible to use the default label in the translation for all poducts. is it a problem with the tpl?

2: “show available quantity” option on product setting page has no effect. whether it’s on of off nothing changes. only low stock and out of stock labels shown near add the cart button if those conditions met but not “in stock” label or quantity is shown

3: this one is mostly a logical issue; while trying to add more quantities then what’s available in stock results a faulty action. “Product successfully added to your shopping cart” popup appears, no actual adding to cart happens. Instead there should be a warning like the default theme has “There are not enough products in stock”. this message is shown in some rare conditions but the cart add popup is also shown too.

Can you help on these issues?

This ticket does not depend on any other tickets.

Marek (marek) 06 Jan 2018, 11:51

try now, it should be ok

mehmet (mehmet) 06 Jan 2018, 12:45

I see the "available" indication added above reference. Did you make hard coded changes to tpl? I don't see a translatable label here. the site is multi-lang. So it's not the solution I'm looking for. for this purpose logical operation should be like this; show default "in stock/out of stock" labels from translations unless that particular product has its own "in stock/out of stock" definitions on catalog page. it should override default label. don't you think so?

2. "Display available quantities on the product page" still not functioning.
3. still works incorrectly.

Marek (marek) 06 Jan 2018, 13:03

Yes, there is no hardcoding, just missed translation option. Try now
Phrases to translate are following:

{l s='Available' d='Shop.Theme.Catalog'}
{l s='Last Item Available' d='Shop.Theme.Catalog'}
{l s='Unavailable' d='Shop.Theme.Catalog'}
Marek (marek) 06 Jan 2018, 13:09


mehmet (mehmet) 06 Jan 2018, 13:11

for #3, I see there is an ajax check of stock availability when quantity input changed. The delay until the result, add to cart button remains active and causes the trouble. ajax check start should disable add to cart button until result to prevent "added to cart popup" show up. if this is the default prestashop behaviour and it's not about you, it's up to you to take my opinion into account if you think it could be logical.

mehmet (mehmet) 06 Jan 2018, 13:14

Yes 1st question is solved with small issue remaining; "Display available quantities on the product page" still not functioning, available items are always shown and when changing combination (color) it doesn't updates the quantity.

Marek (marek) 06 Jan 2018, 13:17

There is no possibility to update quantity with Ajax. It's require much to to do. That is the reason why it was removed in Alysum theme. It was a mistake to show quantity

mehmet (mehmet) 06 Jan 2018, 13:23

Ok, if this is the case, at least turning on or off "Display available quantities on the product page" on shop parameters>product settings page should enable or disable the quantity shown status. do you disable or enable it directly from the template? if so, not having a non-working feature is better than having it.

btw, thanks for the prompt support.

Marek (marek) 06 Jan 2018, 13:32

Yes, there was missed condition. Now you can manage it from back office

mehmet (mehmet) 06 Jan 2018, 13:55

So, here we reached at
- availability: works as expected unless while particular product "in stock" label overrides theme label, "Label when out of stock" in product definition can't override. instead "Product available with different options" or "out of stock" is shown from theme default. Also before "limited items in stock" and "out of items" labels there is a <svg class="svgic"> element causing the label to shift.

- show available quantity: works as expected
- Product successfully added to your shopping cart” popup appears although the product is not in stock because ajax stock check query doesn't disable "add to cart" button temporarily. this also has no solution?

Marek (marek) 07 Jan 2018, 13:52

I added code from default prestashop theme so it work like prestashop developer did that.
as for "add to cart" issue, I don't see it, all works fine for me https://www.dropbox.com/s/0jqpvtgm3ndnob1/baluna.mov?dl=0

mehmet (mehmet) 07 Jan 2018, 14:05

Hi, you fixed the "in stock" override if product particularly has a definition and it works. But not for the "out of stock" label. that's why I asked.

about the video, as I said, it might be the default prestashop behaviour but it's not logical. "quantity input change" should start ajax event and disable add to cart button until it resolves. Instead "release" of input triggers ajax stock check so you have to click outside of the quantity input as you do in the video. that's not a usual and logical move. people enter the quantity and click on add to cart directly. This results a faulty action like "product added to cart" popup show up without no actual addition to cart. it might be nothing to do with you and I'm not asking you to fix it for me, consider this as a feedback, and if you agree, you might consider fixing it in future releases.

thanks, one more question; do you have plans to implement infinite scroll?

mehmet (mehmet) 10 Jan 2018, 20:05

Hi, did you have chance to look at what I mentioned in the first sentence of the previous message? thanks

Marek (marek) 10 Jan 2018, 21:05

don't worry, I'll help you as soon as possible

Marek (marek) 11 Jan 2018, 12:32

Give me a link to page with "Out of stock" product

Marek (marek) 12 Jan 2018, 11:37

Please check is it correct?

mehmet (mehmet) 12 Jan 2018, 15:51

No, it doesn't. there is not a standard solution to show labels. I will explain with screenshots of 2 examples.

1. https://www.balunashop.com/en/wall-accessories/145-145-copy-of-pink-angel-cloud-duvar-cercevesi.html#/78-color-yellow_grey 2. pls look next message

145-1.png (518.7 KiB)
145-2.png (142.3 KiB)
145-3.png (147.4 KiB)
145-4.png (157.7 KiB)
Marek (marek) 13 Jan 2018, 09:58

If you want, I can put original product page from Classic theme, just to compare how it works. Because I don't know how to make all what you ask

mehmet (mehmet) 13 Jan 2018, 14:55

What I'm trying to say with these images is; there is a logical mistake in this "availability" tag which you put in your theme and I'm trying to fit it into a logic. Here; http://demo.prestashop.com/en/?view=front in the original demo, the logic is completely correct. There is no "availability" tag; but, "in stock", "low stock", "out of stock" and "other options has stock" situations works correctly for both particular and general definitions and it's updated upon combination change with ajax.

if you're not willing to do any changes to make it work, here is my offer:
1- completely hide "availability" label, the one above the reference number, since it doesn't work and doesn't update in combination products.
2- stock availability labels shown near "add to cart" button works same as classic theme.

how does it sound to you?

Marek (marek) 14 Jan 2018, 11:25

1. As I wrote you before I already removed it in the demo and in the next theme version.
2. yes I know, but for some reason it doesn't updates in another place then it is.

mehmet (mehmet) 14 Jan 2018, 12:03

I checked the changes and it's almost ok. Although "particular in stock" indication overrides "theme in stock label", "particular out of stock" label has no effect. it's not shown no matter what. Since I can't check it in official presta demo because all of the items there have combinations; so, "Product available with different options" is the only thing to be able to see. Can you check it in this product example?;

frontend: https://www.balunashop.com/en/blankets/68-newborn-chalkboard-battaniye.html backend:https://www.balunashop.com/adminbaluna/index.php/product/form/68?_token=7B2Yk_PWJsT1BCM-_P-EYH8Pm5h1aLquO6vf_QVS-1o#tab-step3

Marek (marek) 15 Jan 2018, 12:01

Maybe I missed something, but I see a message "out of stock" there, and there is no "Product available with different options"

mehmet (mehmet) 15 Jan 2018, 15:18

alright it can be confusing. here on back office, you'd see a "particular out of stock" definition like in the screenshot attached. that should be the label you'd see. it should override theme label "out of stock" when it's defined. it works this way for "in stock" case. you can test it using back and front office links I gave before. feel free to change stock amounts to see what I mean.

Screen Shot 2018-01-15 at 17.... (64.8 KiB)
Marek (marek) 16 Jan 2018, 00:24

Try now, it must work

mehmet (mehmet) 16 Jan 2018, 11:20

No, it's messed up now.
1. there is no "low stock" label when the quantity is low (1 left) AND there is "particular out of stock" definition.
2. although item has stock (more then 2) AND it has "particular in stock" definition, it shows "particular out of stock"

there are conditional mistakes causes above 2 errors.

Marek (marek) 16 Jan 2018, 12:17

Now the code is the same like in the default prestashop theme, please check it out

mehmet (mehmet) 16 Jan 2018, 13:21

now everything seems ok. thanks.