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...
  • 1 year later...

 

 

mails/_partials

replace file code order_conf_product_list.tpl 

to and clear cache and check

 

replace your text you 

Beställningsvara 3-7 dagar

and 

  Sista produkten i lager

 

need any help contact skype id : keshva.thakur

 

{**
 * Copyright since 2007 PrestaShop SA and Contributors
 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.md.
 * It is also available through the world-wide-web at this URL:
 * https://opensource.org/licenses/OSL-3.0
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
 * versions in the future. If you wish to customize PrestaShop for your
 * needs please refer to https://devdocs.prestashop.com/ for more information.
 *
 * @author    PrestaShop SA and Contributors <[email protected]>
 * @copyright Since 2007 PrestaShop SA and Contributors
 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
 *}
{foreach $list as $product}
<tr>
    <td style="border:1px solid #D6D4D4;">
        <table class="table">
            <tr>
                <td width="5">&nbsp;</td>
                <td>
                    <font size="2" face="Open-sans, sans-serif" color="#555454">
                        {$product['reference']}
                    </font>
                </td>
                <td width="5">&nbsp;</td>
            </tr>
        </table>
    </td>
    <td style="border:1px solid #D6D4D4;">
        <table class="table">
            <tr>
                <td width="5">&nbsp;</td>
                <td>
                    <font size="2" face="Open-sans, sans-serif" color="#555454">
                        <strong>{$product['name']}</strong>
                        {if count($product['customization']) == 1}
                            <br>
                            {foreach $product['customization'] as $customization}
                                {$customization['customization_text']}
                            {/foreach}
                        {/if}

                        {hook h='displayProductPriceBlock' product=$product type="unit_price"}
                        <br/>
                        
                        {if $product['quantity'] > 0}
                            {if $product['available_now']}
                                {$product['available_now']}
                             {else}
                               Beställningsvara 3-7 dagar
                            {/if}
                        {else}
                            {if $product['available_later']}
                              {$product['available_later']}
                            {else}
                             Sista produkten i lager
                            {/if}
                        {/if}
                        
                    </font>
                </td>
                <td width="5">&nbsp;</td>
            </tr>
        </table>
    </td>
    <td style="border:1px solid #D6D4D4;">
        <table class="table">
            <tr>
                <td width="5">&nbsp;</td>
                <td align="right">
                    <font size="2" face="Open-sans, sans-serif" color="#555454">
                        {$product['unit_price']}
                    </font>
                </td>
                <td width="5">&nbsp;</td>
            </tr>
        </table>
    </td>
    <td style="border:1px solid #D6D4D4;">
        <table class="table">
            <tr>
                <td width="5">&nbsp;</td>
                <td align="right">
                    <font size="2" face="Open-sans, sans-serif" color="#555454">
                        {$product['quantity']}
                    </font>
                </td>
                <td width="5">&nbsp;</td>
            </tr>
        </table>
    </td>
    <td style="border:1px solid #D6D4D4;">
        <table class="table">
            <tr>
                <td width="5">&nbsp;</td>
                <td align="right">
                    <font size="2" face="Open-sans, sans-serif" color="#555454">
                        {$product['price']}
                    </font>
                </td>
                <td width="5">&nbsp;</td>
            </tr>
        </table>
    </td>
</tr>
  {if count($product['customization']) > 1}
      {foreach $product['customization'] as $customization}
          <tr>
          <td colspan="3" style="border:1px solid #D6D4D4;">
              <table class="table">
                  <tr>
                      <td width="5">&nbsp;</td>
                      <td>
                          <font size="2" face="Open-sans, sans-serif" color="#555454">
                              {$customization['customization_text']}
                          </font>
                      </td>
                      <td width="5">&nbsp;</td>
                  </tr>
              </table>
          </td>
          <td style="border:1px solid #D6D4D4;">
              <table class="table">
                  <tr>
                      <td width="5">&nbsp;</td>
                      <td align="right">
                          <font size="2" face="Open-sans, sans-serif" color="#555454">
                              {if count($product['customization']) > 1}
                                  {$customization['customization_quantity']}
                              {/if}
                          </font>
                      </td>
                      <td width="5">&nbsp;</td>
                  </tr>
              </table>
          </td>
          <td style="border:1px solid #D6D4D4;"></td>
      </tr>
      {/foreach}
  {/if}
{/foreach}
 

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

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