razvy Posted February 4, 2020 Share Posted February 4, 2020 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! Link to comment Share on other sites More sharing options...
ukbaz Posted March 8, 2021 Share Posted March 8, 2021 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! Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2021 Share Posted March 8, 2021 (edited) 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 March 8, 2021 by Guest (see edit history) Link to comment Share on other sites More sharing options...
ukbaz Posted March 8, 2021 Share Posted March 8, 2021 (edited) Hi Daniel - thanks for the reply...It's the email order_conf that the customer gets after ordering. Yes only for Prestashop 1.6.1 Edited March 8, 2021 by ukbaz (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2021 Share Posted March 8, 2021 Ok. Do you want to add information under the product name or under quantity? Link to comment Share on other sites More sharing options...
ukbaz Posted March 8, 2021 Share Posted March 8, 2021 Hi Daniel, preferably under product name - but under quantity is OK too - as long as it's there Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2021 Share Posted March 8, 2021 And do you want to display the text there? E.g. in stock (46) or not in stock? Link to comment Share on other sites More sharing options...
ukbaz Posted March 8, 2021 Share Posted March 8, 2021 Hi Daniel - preferably just not in stock against items that are out of stock Link to comment Share on other sites More sharing options...
ukbaz Posted March 8, 2021 Share Posted March 8, 2021 Basically same message that appears in shopping cart product line template where it says in stock or out of stock Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2021 Share Posted March 8, 2021 (edited) 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: full sample PaymentModule.php PaymentModule.php Edited March 8, 2021 by Guest (see edit history) Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2021 Share Posted March 8, 2021 Don't forget to clear the cache! Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2021 Share Posted March 8, 2021 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'); } Link to comment Share on other sites More sharing options...
ukbaz Posted March 8, 2021 Share Posted March 8, 2021 Perfect - Thanks Daniel! Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2021 Share Posted March 8, 2021 There is another option, but what I wrote you is the fastest way 😉 Link to comment Share on other sites More sharing options...
Guest Posted March 8, 2021 Share Posted March 8, 2021 (edited) You can like my posts. Just click on the gray heart below my posts. I gladly helped 😉 Edited March 8, 2021 by Guest (see edit history) Link to comment Share on other sites More sharing options...
ukbaz Posted March 8, 2021 Share Posted March 8, 2021 Fastest works for me Thanks again!! Baz Link to comment Share on other sites More sharing options...
ukbaz Posted March 10, 2021 Share Posted March 10, 2021 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 Link to comment Share on other sites More sharing options...
Guest Posted March 10, 2021 Share Posted March 10, 2021 Hi, Quick Reply. Yes, it can be done. Link to comment Share on other sites More sharing options...
ukbaz Posted March 10, 2021 Share Posted March 10, 2021 Does it involve changing much Daniel? Any chance of a less quick reply to my quick question? Thanks Baz Link to comment Share on other sites More sharing options...
Guest Posted March 10, 2021 Share Posted March 10, 2021 ????? These texts ????? Link to comment Share on other sites More sharing options...
Guest Posted March 10, 2021 Share Posted March 10, 2021 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'); } } Link to comment Share on other sites More sharing options...
ukbaz Posted March 10, 2021 Share Posted March 10, 2021 Brilliant Daniel! Thanks!! Baz Link to comment Share on other sites More sharing options...
Guest Posted March 10, 2021 Share Posted March 10, 2021 I gladly helped 😉 Link to comment Share on other sites More sharing options...
KunnSistemas Posted September 9, 2021 Share Posted September 9, 2021 Is it possible to add this for prestashop 1.7? Thanks in advance, Link to comment Share on other sites More sharing options...
ukbaz Posted November 29, 2021 Share Posted November 29, 2021 Id like to add this for 1.7 as well - anyone? Thanks, Baz Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now