Jump to content

[Mail Alerts] "Notify me when available" email is not sending


Recommended Posts

I'm running Presta 1.7.5.0 and Mail Alerts module v2.1.1. I have SMTP configured and my store is sending e-mails just fine.

I am trying to set up "Notify me when available" option, but it doesn't seem to work. I put my e-mail address into the form, and the success message saying I will be notified displays. Then, when I update the stock for this product - so it is available again, I get no e-mail whatsoever.

Interesting thing is, when I put my e-mail into the form again (even though I've changed stock Qtys in the meantime - so the product was available, and unavailable again), it says "You already have an alert for this product". So, the email logging is just fine. What doesn't work is sending the e-mail and removing the logged addresses from the database. Or, perhaps - is setting the stock qty from 0 to positive number not considered available? Do I have to change other product parameters so it becomes available? (I can add it to cart and purchase it, it seems available to me)

I tried to look into email logs inside Advanced parameters > Email, and it is not there as well, even though email logging is turned on.

What could be the problem?

IMPORTANT EDIT: Mea culpa. It works when I edit the stock quantity (change it from 0 to positive number) in the back office. It does not work when I change it programatically using my stock sync functions.This is the function that updates qty every minute. What could be the problem?

// sync once per 60sec
        if ($lastsync+60 < time()) {
            $qty = \kncSync::getProductStock((int)$id_product);

            $context = Context::getContext();
            $shop = $context->shop;

            Db::getInstance()->insert('stock_available', array(
                'id_shop' => (int)$shop->id,
                'quantity' => (int)$qty,
                'lastsync' => time(),
                'id_product' => (int)$id_product,
                'id_product_attribute' => (int)$id_product_attribute
                ),
                false, true, Db::ON_DUPLICATE_KEY);

            Cache::store($key, $qty);
            Cache::store($key2, time());

            return $qty;
        }

 

Edited by TinoArts
additional info (see edit history)
Link to comment
Share on other sites

  • 10 months later...
15 hours ago, vanvanmadriz said:

Hi,did you solved that ?

Hi, No I haven't. Unfortunately it wasn't a priority for me yet.

I believe a necessary action is not being fired if I just update the quantity directly in the database (stock_quantity table), so the e-mail alert won't get triggered.

Maybe calling $product->save() or $product->update() after updating database values might work but I am not sure.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...