VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: mb000000 on October 17, 2012, 14:21:22 PM

Title: Feature request - out of stock handling
Post by: mb000000 on October 17, 2012, 14:21:22 PM
VM: 2.0.x

I'd quite like (and in the meantime am adding in my installation) an additional stock handling option that is very similar to the existing "disableadd" one (products out of stock are displayed with a "Notify Me" option).  The new option I'm interested in is the same but simply without the "Notify Me" behaviour.

Thanks

Mark
Title: Re: Feature request - out of stock handling
Post by: PRO on October 17, 2012, 17:56:50 PM
mb000000

what do you mean?

the add to cart is disabled? but NO notify me button?

Title: Re: Feature request - out of stock handling
Post by: mb000000 on October 17, 2012, 18:24:00 PM
I mean that I'd like a "stockhandle" state which behaves similarly to the existing "disableadd" state, such that:
- stock levels are displayed for all products (using the red/amber/green lozenge in the category display)
- product details are display if the user clicks that button
- when the details are displayed, the price, tax etc are displayed as per the config
- if the stock is 0, then rather than "Notify Me" being displayed, nothing is displayed (the prices still display, though)
- if the stock is more than 0, then Add to Cart etc is displayed

Basically, I don't want to have stock level tracking / notifications for customers.

My own "patch" to make this work for me has been:
- create the idea of a new "stockhandle" state called "nostockshowonly"
- create a new entry in the admin en-GB.com_virtuemart.ini as in:
COM_VIRTUEMART_ADMIN_CFG_POOS_DISABLE_ADD_NOTNOTIFY="If out of stock, displays product details but no Add To Cart button"
- edit default_shopfront.php to support the new state display in the back end:
'nostockshowonly' => JText::_('COM_VIRTUEMART_ADMIN_CFG_POOS_DISABLE_ADD_NOTNOTIFY'),
- edit default_addtocart.php to change from:
if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($this->product->product_in_stock - $this->product->product_ordered) < 1) {
to
if ( ($this->product->product_in_stock - $this->product->product_ordered) < 1) {
if ($stockhandle == 'disableit' or $stockhandle == 'disableadd') {
?>
<a href="<?php echo JRoute::('index.php?option=com_virtuemart&view=productdetails&layout=notify&virtuemart_product_id=' $this->product->virtuemart_product_id); ?>" class="notify"><?php echo JText::('COM_VIRTUEMART_CART_NOTIFY'?></a>
<?php // MRCB - additional feature requires a closing {
}
} else { ?>



Not terribly elegant, but it works for me.

Mark