Jump to content

Back in Stock emails


Recommended Posts

I am using V1.2.5 and have virtually got the site running apart from a couple of niggling problems, one that will annoy the hell out of customers if I can't fix it.

The first one is the back in stock email sent to customers. Where can it be edited? I have the mail template editor installed but it doesn't seem to be included with the others.

The other problem is one that I can't work out at all. I have been running test orders and emails etc. through the site and it works fine apart from one absolutely crazy problem. I tried the email notification to see if it worked when I put the product out of stock and back in stock but it just keeps sending them.

I would have thought that it would send one then clear it from the list but I have had at least 6 emails whilst messing with the site saying the product is back in stock. Surely this cannot be right can it?

Link to comment
Share on other sites

I can't believe that nobody else has either tried this or not had this problem or doesn't know why it happens.

Surely someone knows why because this will annoy visitors like crazy if they keep getting emails about a product they enquired about once and it will happen as everyone has to keep updating stock levels.

Link to comment
Share on other sites

Customers are supposed to go to the "My alerts" section of their account to unsubscribe from out-of-stock notifications. There is no way to see which customers are subscribed in the Back Office and unsubscribe them yourself. The only way is to go to the ps_mailalert_customer_oos table in phpMyAdmin and delete them from there.

You could try modifying the updateQuantity function in classes/Product.php and add code like the following:

Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'mailalert_customer_oos` WHERE `id_product` = '.intval($product['id_product']));

Link to comment
Share on other sites

Hi Rocky

I will ask someone to try that code for me to see if it works.

Surely if you have an express checkout module on then customers can't unsubscribe anyway and this does seem to be something that will drive customers away instead of attracting them.

Email notification is great but anyone writing software should realise that they only want notifying once not every time you update for years unless they cancel their account which none of us want them to do.

I say cancel their account because I would expect them to do this rather than try to locate to cancel in their account. Ease of use is everything for customers as experience tells us.

Link to comment
Share on other sites

  • 2 weeks later...

I checked that file but all I had around that line was this.

$customer_email = $cust['customer_email'];
$customer_id = 0;
}
Mail::Send(intval(Configuration::get('PS_LANG_DEFAULT')), 'customer_qty', $this->l('Product available'), $templateVars, strval($customer_email), NULL, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
self::deleteAlert(intval($customer_id), strval($customer_email), intval($id_product), intval($id_product_attribute));
}
}

public function hookCustomerAccount($params)
{
global $smarty;
return $this->display(__FILE__, 'my-account.tpl');

Is that right because that means nothing to me.

Link to comment
Share on other sites

this is my sendCustomerAlert function in mailalerts.php (notice the last line - deleting alerts), yours is probably corrupted

   public function sendCustomerAlert($id_product, $id_product_attribute)
   {
       $customers = Db::getInstance()->ExecuteS('
       SELECT id_customer, customer_email
       FROM `'._DB_PREFIX_.'mailalert_customer_oos`
       WHERE `id_product` = '.intval($id_product).
       ($id_product_attribute ? ' AND `id_product_attribute` = '.intval($id_product_attribute) : ''));

       $product =  new Product(intval($id_product));
       $templateVars = array(
           '{product}' => strval($product->name[intval(Configuration::get('PS_LANG_DEFAULT'))])
       );
       foreach ($customers as $cust)
       {
           if ($cust['id_customer'])
           {
               $customer = new Customer(intval($cust['id_customer']));
               $customer_email = $customer->email;
               $customer_id = $customer->id;
           }
           else
           {
               $customer_email = $cust['customer_email'];
               $customer_id = 0;
           }
           Mail::Send(intval(Configuration::get('PS_LANG_DEFAULT')), 'customer_qty', $this->l('Product available'), $templateVars, strval($customer_email), NULL, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/');
           self::deleteAlert(intval($customer_id), strval($customer_email), intval($id_product), intval($id_product_attribute));
       }
   }

Link to comment
Share on other sites

  • 1 month later...

I have this working perfect,
Is there anyway of adding to the email which product they received the alert for?



Dear Customer, The item you were watching is now once again in-stock.

You can order it right now from our on-line shop.


to change to


Dear Customer, The product ******** is now once again in-stock. [LINK]

You can order it right now from our on-line shop.
Link to comment
Share on other sites

  • 2 months later...

Hi Site, just wondering, as on the change you wanted you were hoping to put a link to the product - just wondering how you achieved this? I tried




but apparently the variable id_product didn't exist.. therefore the link didn't insert a number, just the variable. How did you get around this?

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