Zen Cart Logo
Forums / Basic Configuration / Warning: Low Stock emails

Warning: Low Stock emails

Locked

Views: 1,703

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
5 Feb 2010, 6:13 PM
#1
mcarbone avatar

mcarbone

Zen Follower

Join Date:
Feb 2009
Location:
Simi Valley, CA
Posts:
99
Plugin Contributions:
0

Warning: Low Stock emails

I have my site configured to send a low stock warning email (which is very important) when the product dips below 5,000. The problem is that it sends that warning every time an order is placed.

What can I do to configure it so that the email is just sent once when the product is below 5,000?

Zen V: 1.3.8

Thanks so much!

MC

5 Feb 2010, 9:11 PM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Warning: Low Stock emails

You'd have to write custom code to set some sort of flag in the database saying that notification has already been sent, and then check for that flag before emailing ... and then when you restock the items you'll have to be sure that you reset that flag or else you'll not be notified again.

5 Feb 2010, 9:38 PM
#3
mcarbone avatar

mcarbone

Zen Follower

Join Date:
Feb 2009
Location:
Simi Valley, CA
Posts:
99
Plugin Contributions:
0

Re: Warning: Low Stock emails

Challenging! I will try to do this. :smartalec:

I will start by looking at script in this file:
/includes/classes/order.php

I got here because I looked up in the developer's tool kit: EMAIL_TEXT_SUBJECT_LOWSTOCK.

Thanks for guidance Dr. Byte - am I on the right path?

MC

5 Feb 2010, 11:00 PM
#4
mcarbone avatar

mcarbone

Zen Follower

Join Date:
Feb 2009
Location:
Simi Valley, CA
Posts:
99
Plugin Contributions:
0

Re: Warning: Low Stock emails

I think it is somewhere around here in order.php

if ($this->email_low_stock != '' and SEND_LOWSTOCK_EMAIL=='1') {
// send an email
$email_low_stock = SEND_EXTRA_LOW_STOCK_EMAIL_TITLE . "\n\n" . $this->email_low_stock;
zen_mail('', SEND_EXTRA_LOW_STOCK_EMAILS_TO, EMAIL_TEXT_SUBJECT_LOWSTOCK, $email_low_stock, STORE_OWNER, EMAIL_FROM, array('EMAIL_MESSAGE_HTML' => nl2br($email_low_stock)),'low_stock');
}

(line 939)
I need help on how to create a DB flag. I don't know how. But, I think I need to add another conditional stmt after :SEND_LOWSTOCK_EMAIL=='1'.

something like: "and db_flag== 1".

Would this work?

Thanks for all your help.

MC