News:

Support the VirtueMart project and become a member

Main Menu

[BUG] Negative stock shows add to cart button

Started by Rune Rasmussen, July 06, 2009, 18:11:03 PM

Previous topic - Next topic

Rune Rasmussen

If you configure VirtueMart to check stock, and have/get products with negative stock value, the "Add To Cart" button will still show up instead of the "Notify" button.

To fix this we need to edit the file:
./components/com_virtuemart/themes/default/templates/browse/includes/addtocart_form.tpl.php

Change line 6 (VirtueMart 1.1.3 stable):
if( CHECK_STOCK == '1' && !$product_in_stock ) {

into:
if( CHECK_STOCK == '1' && $product_in_stock < 1 ) {


Edit! This function should be centralized as a class or something, since it seems to be spread around more files. A search for the string:
if( CHECK_STOCK == '1' && !$product_in_stock ) {
... will give some hits.


PS! Also it would be nice to have an configuration option to show a simple "Sold Out" image, instead of the "Notify" button (I don't think it works with most accounting integrations anyway).
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team