mytheory. Posted July 4, 2011 Share Posted July 4, 2011 Hi,As the title suggests, how do I add the manufacturer name to the new order emails sent by the mailalerts module??The new order email to the admin shows a list of the products' name but no manufacturer's names.Here is the format I would like:Manufacturer_Name - Product_nameAny advice is much appreciated!Thanks! Link to comment Share on other sites More sharing options...
bellini13 Posted July 4, 2011 Share Posted July 4, 2011 you would have to edit the mail template and the module code. the module name is mailalerts Link to comment Share on other sites More sharing options...
mytheory. Posted July 5, 2011 Author Share Posted July 5, 2011 Hi,Thanks for your response, but I am already aware of this. The code I used for older versions of PS does not work on v1.4.x.And actually you do not need to edit the mail template... there is an array that is already passed to the mail alerts. This array is composed of all the product names and attributes for a particular order. I believe the array is called {items}Anyways, how to do I add the manufacturer(s) to this array?Thanks! Link to comment Share on other sites More sharing options...
bellini13 Posted July 5, 2011 Share Posted July 5, 2011 as i explained in my first reply, edit the mailalerts module. The module has its own mail templates, so it would have to be edited as well to display the data. Link to comment Share on other sites More sharing options...
mytheory. Posted July 5, 2011 Author Share Posted July 5, 2011 Hi,As I already mentioned... I already know this. I've already modified this to work on older versions of PS. Plus, the mail templates DO NOT need editing for this task. There is 1 array named {items} that essentially collects all the products from the order. Then on the mail template it outputs them according to the array.You can see this by opening the new_order.html file and searching for {items}... then go to mailalerts.php and search for the same thing, here you will see the code for the array generating a list of the products from a particular order.So, as I said before, I need help modifying the {items} array from mailalerts.php to include a manufacturer. I know I have to create another variable based on the Manufacturers class, but I think I am getting some of the parameters wrong (something must have changed in 1.4.x).I will take another look at it... and then I will post what I already have once I find some more time today.Thanks again for the input anyways! Link to comment Share on other sites More sharing options...
bellini13 Posted July 5, 2011 Share Posted July 5, 2011 My assumptions are as followed based on what has been said so far.1) you are using prestashop v1.4+2) you are referring to the base module called 'mailalerts'3) you are trying to add the product's manufacturer name to the new order template that is emailed to the admin, so the name appears before the product name.If the above assumptions are correct you need to do the following...edit the file called mailalerts.php located in the modules\mailalerts folder. in the function called hookNewOrder, you will see that a variable called itemsTable, and that contains the html that is used in the new order template {items}you will see this line of code which creates the column for the product name. '.$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').' you simply need to take the product_id, locate the manufacturer of that product, grabs its name and insert it before the product name as desired. Since you have already coded this is a prior version of prestashop, i'll assume you can code this. Link to comment Share on other sites More sharing options...
randysantino Posted July 6, 2011 Share Posted July 6, 2011 @bellini13Hi Bellini13,I was following this topic because I want to do the same.Since I don't have the knowledge to script it myself I like to ask youif you can explain what code I need to add.Thanks!! Link to comment Share on other sites More sharing options...
Julio UCME Posted December 20, 2012 Share Posted December 20, 2012 Hi, I'm also trying the same thing, but I want to add the reference number to the "out of stock" mail alert . Any help or guidance would be appreciated. Att. Julio Link to comment Share on other sites More sharing options...
Spad Posted October 15, 2013 Share Posted October 15, 2013 up 1.5 i have tried to modify method getProducts in MailAlert.php line n° 240 but not work. Please help me. * Get products according to alerts */ public static function getProducts($customer, $id_lang) { $sql = ' SELECT ma.`id_product`, p.`quantity` AS product_quantity, pl.`name`, ma.`id_product_attribute`, mf.`name` AS manufacturer_name FROM `'._DB_PREFIX_.self::$definition['table'].'` ma JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = ma.`id_product`) '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.id_shop IN ('.implode(', ', Shop::getContextListShopID(false)).')) LEFT JOIN `'._DB_PREFIX_.'manufacturer` mf ON (mf.`id_manufacturer` = p.`id_manufacturer`) WHERE product_shop.`active` = 1 AND (ma.`id_customer` = '.(int)$customer->id.' OR ma.`customer_email` = \''.pSQL($customer->email).'\') AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestriction(false, 'ma'); print_r($sql); return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); } Link to comment Share on other sites More sharing options...
design4VIP Posted October 21, 2013 Share Posted October 21, 2013 (edited) The order details doesn't include the manufacturer name, so you will have to get it using the following code:$manufacturer = new Manufacturer($product['id_manufacturer'], $id_lang);Then you can use $manufacturer->name to write the manufacturer name in front of the product name. Edited October 21, 2013 by deejay3 (see edit history) Link to comment Share on other sites More sharing options...
Joram Posted February 1, 2017 Share Posted February 1, 2017 The order details doesn't include the manufacturer name, so you will have to get it using the following code: $manufacturer = new Manufacturer($product['id_manufacturer'], $id_lang); Then you can use $manufacturer->name to write the manufacturer name in front of the product name. Hello,where i have to add this code? File? Position? Does it work in Prestashop 1.6.1.9?? 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