Jump to content

Add product availability in order confirmation email


razvy
 Share

Recommended Posts

Hi,

I want to add in the order confirmation email a column with the product availability (in stock, on order) along with the information that is already shown (product code, name, quantity, price).

The text I want to add lies in the table "ps_product_lang", column "available_now". I have tried to modify the mailalerts.php, but I don't know how to make it get the info from this table.

 

Anyone could help me?

The shop is on PS 1.6.1.1.

 

Thank you!

Share this post


Link to post
Share on other sites

  • 1 year later...

I'd like this as well - I know it shows at checkout, but customers sometimes miss this, so it would be great to include this in the order confirmation email the customer gets when placing an order. Has anyone done this successfully?

Can't think that it's not an improvement that would benefit most sellers and reduce customer calls asking what was out of stock as they didn't notice the message at checkout!

 

Share this post


Link to post
Share on other sites

Do you need to display it in the email order_conf = email that the customer will receive after the order?

Do you need to display it in the email new_order = mailalert module, which will be received by the store administrator?

Only for Prestashop 1.6.1 ?

Edited by Guest (see edit history)

Share this post


Link to post
Share on other sites

Prestashop 1.6.1.1

1. open ./classes/PaymentModule.php

2. find

$product_var_tpl = array(

3. add before

$product_in_stock = '';
$qty_stock = Product::getQuantity($product['id_product'], $product['id_product_attribute']);
						
if ($qty_stock > 0){
	$product_in_stock = 'In stock';	
} else {
	$product_in_stock = 'Out of stock';	
}

4. add after

'quantity' => $product['quantity'],

5. availability

.'<br />'.$product_in_stock,

 

full sample in image:

obrazek.thumb.png.e9e8fd2f22b25b7d690f5a2a96de36fc.png

 

full sample PaymentModule.php

PaymentModule.php

 

 

Edited by Guest (see edit history)

Share this post


Link to post
Share on other sites

If you need multilingual text, change part of the code to:

if ($qty_stock > 0){
	$product_in_stock = $this->l('In stock');	
} else {
	$product_in_stock = $this->l('Out of stock');	
}

 

Share this post


Link to post
Share on other sites

Hi Daniel - Me again! ;)

Quick question... I have various 'out of stock' messages set in quantities tab for product, the se show in Shopping Cart product line at checkout. They use the variables {$product->available_now} & {$product->available_later} to determine correct message to display.

Is there a way to use these values rather than 'in stock' and 'out of stock'?

Baz

Share this post


Link to post
Share on other sites

change:

if ($qty_stock > 0){
	$product_in_stock = $this->l('In stock');	
} else {
	$product_in_stock = $this->l('Out of stock');	
}

to:

if ($qty_stock > 0){
	if ($product['available_now']){
		$product_in_stock = $product['available_now'];	
	} else {
		$product_in_stock = $this->l('In stock');	
	}
} else {
	if ($product['available_later']){
		$product_in_stock = $product['available_later'];	
	} else {
		$product_in_stock = $this->l('Out of stock');	
	}
}

 

Share this post


Link to post
Share on other sites

  • 5 months later...
  • 2 months later...

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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More