Checking stock on basket page
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Checking stock on basket page
Hello,
I changed the catalog/stock/body-standard.php so that max attribute of the input field is set depending on the real stock.
This works fine. If the stock is only 3, then the HTML input field makes sure that no higher value can be entered.
Now, I noticed that the same check is not done on the basket page. So, even if the detail page limits the input to e.g. 3, then the user is able to enter a higher number on the cart page.
I checked in the CatalogController.php and think that the stockAction() is the part which initiates the inclusion of catalog/stock/body-standard.php .
The BasketController.php does not include any stockAction().
And in order to provide the necessary stockItemsByProduct, the Client/Html/Catalog/Stock/Standard.php will be needed.
What's the recommended way to handle this? Providing a custom BasketController.php which contains a stockAction()?
Claudia
I changed the catalog/stock/body-standard.php so that max attribute of the input field is set depending on the real stock.
This works fine. If the stock is only 3, then the HTML input field makes sure that no higher value can be entered.
Now, I noticed that the same check is not done on the basket page. So, even if the detail page limits the input to e.g. 3, then the user is able to enter a higher number on the cart page.
I checked in the CatalogController.php and think that the stockAction() is the part which initiates the inclusion of catalog/stock/body-standard.php .
The BasketController.php does not include any stockAction().
And in order to provide the necessary stockItemsByProduct, the Client/Html/Catalog/Stock/Standard.php will be needed.
What's the recommended way to handle this? Providing a custom BasketController.php which contains a stockAction()?
Claudia
Re: Checking stock on basket page
You should implement a decorator for the basket component that fetches the stock levels of the products in the basket and add it as limit to the quantity input fields of the basket summary template:
https://aimeos.org/docs/Developers/Html ... components
https://aimeos.org/docs/Developers/Html ... components
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Checking stock on basket page
Thank you, I got this working.