Author Topic: Feature request - out of stock handling  (Read 1321 times)

mb000000

  • Beginner
  • *
  • Posts: 32
Feature request - out of stock handling
« 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

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10400
  • VirtueMart Version: 3+
Re: Feature request - out of stock handling
« Reply #1 on: October 17, 2012, 17:56:50 pm »
mb000000

what do you mean?

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

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

mb000000

  • Beginner
  • *
  • Posts: 32
Re: Feature request - out of stock handling
« Reply #2 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:
Code: [Select]
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:
Code: [Select]
'nostockshowonly' => JText::_('COM_VIRTUEMART_ADMIN_CFG_POOS_DISABLE_ADD_NOTNOTIFY'),- edit default_addtocart.php to change from:
Code: [Select]
if (($stockhandle == 'disableit' or $stockhandle == 'disableadd') and ($this->product->product_in_stock - $this->product->product_ordered) < 1) {to
Code: [Select]
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