Jump to content

Out of stock email


Recommended Posts

the place to debug the problem for those who are interested to have a look
is in modules/mailalerts/mailalerts.php

function public function hookUpdateQuantity($params)

hope to understand what the problem is about.

it seems the quantity value is set to zero while it is not
everything is in this line

$qty = intval(isset($params['product']['quantity_attribute']) AND $params['product']['quantity_attribute'] ? $params['product']['quantity_attribute'] : $params['product']['stock_quantity']);


my guess to solve this problem is maybe to replace in these part of the code:


$params['product']['stock_quantity'] 

with


$params['product']['quantity']



another way is to try to update to latest SVN code.

Link to comment
Share on other sites

Hi maestrobo,
THanks for the answer. For now I think I'll wait until a patch or newer version. The way prestashop updates I don´t to be changing code if it can be avoided. Then I'll never remember which files I've modified.
This has to happen to others and I suppose a patch will be released.

Thanks

Link to comment
Share on other sites

have checked the SVN 1.3. version and didn't fix my problem.

however, i found my own patch => please try it and see if it works for you:

replace in modules/mailalerts/mailalerts.php

        $qty = intval(isset($params['product']['quantity_attribute']) AND $params['product']['quantity_attribute'] ? $params['product']['quantity_attribute'] : $params['product']['stock_quantity']);

by
       $qty = intval((isset($params['product']['quantity_attribute']) AND is_int($params['product']['quantity_attribute'])) ? $params['product']['quantity_attribute'] : $params['product']['stock_quantity']);

Link to comment
Share on other sites

Hi,

before i've seen your post, i've done the same update and send my fix on french forum. This module works great now.
It looks like a priority behaviour in PHP and our patch fix it well.

well done maestrobo

@+
Emeric


Thanks, both. Works just fine.

Now there seems to be 1 thing left. When I re-stock the customer get the requested email but not with his name, only the html codes are shown {firstnam} {lastname}. Can I just remove these vars from the mail template?
Link to comment
Share on other sites

  • 2 weeks later...

Hi Pippo3000.

Correct me if i'm wrong but since 1.3.* {firstname} and {lastname} aren't in the template mail customer_qty.html so if you added it yourself u must alter mailalerts.php to assign these var to the tpl file or of course just remove them.

@+

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

I use Mail alerts v2.2.
where should I change the alert to receive notifications about out of stock products?

I would like to receive the alert when I have 3 products in stock, not when there's nothing in stock. :(
Your help would be very appreciated. :D

Link to comment
Share on other sites

  • 4 months later...

Im having same issue at the moment
running presta 1.4.2.5 and my mailalert module is 2.2

i try to apply maestrobo's patch on modules/mailalerts/mailalerts.php but i couldn't find the code to replace anymore.

anyone have a fix to this problem?

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
  • 2 weeks later...
  • 10 months later...

have checked the SVN 1.3. version and didn't fix my problem.

 

however, i found my own patch => please try it and see if it works for you:

 

replace in modules/mailalerts/mailalerts.php

 

		$qty = intval(isset($params['product']['quantity_attribute']) AND $params['product']['quantity_attribute'] ? $params['product']['quantity_attribute'] : $params['product']['stock_quantity']);

by
	$qty = intval((isset($params['product']['quantity_attribute']) AND is_int($params['product']['quantity_attribute'])) ? $params['product']['quantity_attribute'] : $params['product']['stock_quantity']);

 

It worked. Thanks a lot.

 

I use PS 1.4.8.2

Link to comment
Share on other sites

  • 2 weeks later...
  • 10 months later...

Solucionado!!

 

hay que cambiar

$qty = (intval(isset($params['product']['quantity_attribute'])
			    AND $params['product']['quantity_attribute'])
		   ? $params['product']['quantity_attribute']
		   : $params['product']['stock_quantity']);

 

por

 

   $qty = intval((isset($params['product']['quantity_attribute']) AND is_int($params['product']['quantity_attribute'])) ? $params['product']['quantity_attribute'] : $params['product']['quantity']);

 

 

Fijarse sobre todo en que hay que cambiar $params['product']['stock_quantity'] por $params['product']['quantity']

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...