VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Virtuemart 1.1 Development (Archiv) => Quality & Testing VirtueMart 1.1.x => Topic started by: Rune Rasmussen on July 06, 2009, 18:11:03 PM

Title: [BUG] Negative stock shows add to cart button
Post by: Rune Rasmussen on July 06, 2009, 18:11:03 PM
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).