Out of stock notification Plugin

  • Posts: 153
  • Thank you received: 7
  • Hikashop Business
11 years 1 month ago #123072

I was wondering if there was a way to change the Out of Stock Notification Plugin, so that it only triggers on published products. At the moment it is triggering on both published and unpublished products.

I assume it would be done by changing this line:

$query='SELECT * FROM '.hikashop_table('product').' WHERE product_quantity<'.(int)$this->stock_limit.' AND product_quantity!=-1';

Any ideas would be appreciated.

Thanks,
Eric

-- url of the page with the problem -- : N/A
-- HikaShop version -- : 2.2.1
-- Joomla version -- : 1.5.26
-- PHP version -- : 5.3.17
-- Browser(s) name and version -- : N/A
-- Error-message(debug-mod must be tuned on) -- : N/A

Please Log in or Create an account to join the conversation.

  • Posts: 26150
  • Thank you received: 4026
  • MODERATOR
11 years 1 month ago #123097

Hi,

Right, you can edit the plugin directly and use this query

		$query = 'SELECT * FROM '.hikashop_table('product').' WHERE '.
			' product_quantity < '.(int)$this->stock_limit.' AND product_published = 1 AND product_quantity != -1 '.
			' AND (product_sale_start = 0 OR product_sale_start < '.time().') AND (product_sale_end = 0 OR product_sale_end > '.time().')';
So only the published products and the products which are currently sold will be checked.
I will submit this patch and see with Nicolas if it's good for him. But I think that we will include it in the official plugin.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 153
  • Thank you received: 7
  • Hikashop Business
11 years 1 month ago #123240

Thank you for that. I thought of the "product_published = 1" but not the check to see if the item is scheduled to be for sale. That was a great addition, and covers all bases. I am glad to hear that that change will be included in the official plugin going forward.

Thanks for everything.

Please Log in or Create an account to join the conversation.

Time to create page: 0.054 seconds
Powered by Kunena Forum