prestashop-new Posted February 12, 2014 Share Posted February 12, 2014 Hi, How to get the purchased product URL in the Order confirmation email. I am able to find the Order Confirmation email template which is under mails/en order_conf.html. Please suggest ! Link to comment Share on other sites More sharing options...
gladiator Posted February 12, 2014 Share Posted February 12, 2014 bonjour, in Classes/PaymentModule.php ligne 378 : <td style="padding: 0.6em 0.4em;width: 30%;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.Tools::displayError('Customized').(!empty($customization_text) ? ' - '.$customization_text : '').'</strong></td> Link to comment Share on other sites More sharing options...
prestashop-new Posted February 12, 2014 Author Share Posted February 12, 2014 Thanks for replying.. What this code will do? If you can please explain me.. i just need to add this message in order confirmation email " dont forget to review this product {Product URL} Link to comment Share on other sites More sharing options...
gladiator Posted February 12, 2014 Share Posted February 12, 2014 add in ligne 351 juste after $virtual_product = true; $link = new Link(); and change ligne 378 by : <td style="padding: 0.6em 0.4em;width: 30%;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.Tools::displayError('Customized').(!empty($customization_text) ? ' - '.$customization_text : '').'<a href="'.$link->getProductLink($product['id_product']).'">review</a></strong></td> 1 Link to comment Share on other sites More sharing options...
prestashop-new Posted February 12, 2014 Author Share Posted February 12, 2014 Its not working...unable to see the Product link (Review) when order confirmation email received.. Please Guide.. This is my code : $products_list = ''; $virtual_product = true; $link = new Link(); foreach ($products as $key => $product) { $price = Product::getPriceStatic((int)$product['id_product'], false, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 6, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); $price_wt = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? (int)$product['id_product_attribute'] : null), 2, null, false, true, $product['cart_quantity'], false, (int)$order->id_customer, (int)$order->id_cart, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}); $customization_quantity = 0; $customized_datas = Product::getAllCustomizedDatas((int)$order->id_cart); if (isset($customized_datas[$product['id_product']][$product['id_product_attribute']])) { $customization_text = ''; foreach ($customized_datas[$product['id_product']][$product['id_product_attribute']][$order->id_address_delivery] as $customization) { if (isset($customization['datas'][Product::CUSTOMIZE_TEXTFIELD])) foreach ($customization['datas'][Product::CUSTOMIZE_TEXTFIELD] as $text) $customization_text .= $text['name'].': '.$text['value'].'<br />'; if (isset($customization['datas'][Product::CUSTOMIZE_FILE])) $customization_text .= sprintf(Tools::displayError('%d image(s)'), count($customization['datas'][Product::CUSTOMIZE_FILE])).'<br />'; $customization_text .= '---<br />'; } $customization_text = rtrim($customization_text, '---<br />'); $customization_quantity = (int)$product['customization_quantity']; $products_list .= '<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';"> <td style="padding: 0.6em 0.4em;width: 15%;">'.$product['reference'].'</td> <td style="padding: 0.6em 0.4em;width: 30%;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.Tools::displayError('Customized').(!empty($customization_text) ? ' - '.$customization_text : '').'</strong></td> <td style="padding: 0.6em 0.4em; width: 20%;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt, $this->context->currency, false).'</td> <td style="padding: 0.6em 0.4em; width: 15%;">'.$customization_quantity.'</td> <td style="padding: 0.6em 0.4em; width: 20%;">'.Tools::displayPrice($customization_quantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, 2) : $price_wt), $this->context->currency, false).'</td> <td style="padding: 0.6em 0.4em;width: 30%;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').' - '.Tools::displayError('Customized').(!empty($customization_text) ? ' - '.$customization_text : '').'<a href="'.$link->getProductLink($product['id_product']).'">review</a></strong></td> </tr>'; } Link to comment Share on other sites More sharing options...
gladiator Posted February 12, 2014 Share Posted February 12, 2014 add <a href="'.$link->getProductLink($product['id_product']).'">review</a> in ligne 389 <td style="padding: 0.6em 0.4em;width: 30%;"><strong>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'<a href="'.$link->getProductLink($product['id_product']).'">review</a></strong></td> this is a link to the product Link to comment Share on other sites More sharing options...
prestashop-new Posted February 12, 2014 Author Share Posted February 12, 2014 You are the Hero..Many many Thanks :-) 1 Link to comment Share on other sites More sharing options...
gladiator Posted February 12, 2014 Share Posted February 12, 2014 add [RESOLU] in title please Link to comment Share on other sites More sharing options...
sazz12x Posted October 18, 2014 Share Posted October 18, 2014 In Prestashop 1.6 the code in Classes/PaymentModule.php is $product_var_tpl = array( 'reference' => $product['reference'], 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), 'unit_price' => Tools::displayPrice($product_price, $this->context->currency, false), 'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => array() WHere to add <a href="'.$link->getProductLink($product['id_product']).'">review</a> Link to comment Share on other sites More sharing options...
MIVIO Posted January 22, 2015 Share Posted January 22, 2015 Hello, i want to add something to this topic: gladiator's solution is good but it only send product link in email for customer not for admin. I searched how to add link to admin new order messege. This is my solution (presta 1.5.4 - difrence in newest version is only row number) 1. Open modules/mailalerts/mailalerts.php 2. After 279 row ($items_table = '';) add $link = new Link(); 3. Replace 311-313 lines .$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').(!empty($customization_text) ? '<br />'.$customization_text : ''). to this: <strong><a href="'.$link->getProductLink($product['id_product']).'">'.$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').(!empty($customization_text) ? '<br />'.$customization_text : '').'</a></strong> It should work fine Link to comment Share on other sites More sharing options...
sazz12x Posted February 1, 2015 Share Posted February 1, 2015 (edited) Thanks MIVIO it`s working fine! Just in PrstaShop 1.6.0.9 you have to replace <strong>' .$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').(!empty($customization_text) ? '<br />'.$customization_text : '').'</strong> Edited February 1, 2015 by sazz12x (see edit history) Link to comment Share on other sites More sharing options...
fransjaeger Posted February 10, 2015 Share Posted February 10, 2015 (edited) Thanks for shaing.I am pulling out my hair - why the developers didnt put product url, reviev url etc available in the core file, thats really wierd in my mind, but.. allright, okay.. My question is though: Is there any known "clean" way to do this? I mean, is there a way to override using a few lines in a file that is put in the override folder? Thanks By the way this is how i did - this makes id and product url available in the template $product_var_tpl = array( 'reference' => $product['reference'], 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), // begin 'product_url' => $this->context->link->getProductLink($product['id_product']), 'id_product' => $link->getProductLink($product['id_product']), // END 'unit_price' => Tools::displayPrice($product_price, $this->context->currency, false), 'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => array() ); Edited February 10, 2015 by michaelhjulskov (see edit history) 1 1 Link to comment Share on other sites More sharing options...
pette Posted June 28, 2015 Share Posted June 28, 2015 Thanks for shaing. I am pulling out my hair - why the developers didnt put product url, reviev url etc available in the core file, thats really wierd in my mind, but.. allright, okay.. My question is though: Is there any known "clean" way to do this? I mean, is there a way to override using a few lines in a file that is put in the override folder? Thanks By the way this is how i did - this makes id and product url available in the template $product_var_tpl = array( 'reference' => $product['reference'], 'name' => $product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : ''), // begin 'product_url' => $this->context->link->getProductLink($product['id_product']), 'id_product' => $link->getProductLink($product['id_product']), // END 'unit_price' => Tools::displayPrice($product_price, $this->context->currency, false), 'price' => Tools::displayPrice($product_price * $product['quantity'], $this->context->currency, false), 'quantity' => $product['quantity'], 'customization' => array() ); Hi, I try to add this code in Classes/PaymentModule.php. Then I modify the file mails/it/order_conf_product_list.tpl with the link <strong><a href"{$product['product_url']}">{$product['name']}</a></strong> but it give me an error. how can I resolve? thanks Link to comment Share on other sites More sharing options...
levout Posted March 17, 2016 Share Posted March 17, 2016 In 1.6.0.8 in Classes/PaymentModule.php: $link = $this->context->link->getProductLink($product['id_product']); 'name' =>'<a href="'.$link.'">'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</a>', After this, in confirmation mail to customer by bankwire the name of product is a link to the product. For me works... Link to comment Share on other sites More sharing options...
Kaper Posted November 21, 2016 Share Posted November 21, 2016 Levout: Thanks it works, but only in order_conf template. How we can add URL link into others templates? THANKS ! 1 Link to comment Share on other sites More sharing options...
zahiras Posted May 4, 2017 Share Posted May 4, 2017 Levout: Thanks it works, but only in order_conf template. How we can add URL link into others templates? THANKS ! Hey Kaper, I'am looking for a way to add product URL into other templates for a few weeks too. Maybe You already found a solution? Link to comment Share on other sites More sharing options...
Recommended Posts