Jump to content

Get Product URL in order confirmation email to costumer (order_conf)


elly63

Recommended Posts

hello everyone,


I'm trying to modify
PaymentModule.php
to have in the order confirmation email to the customer
the link to the product (a href ......) throung the product name in the table.

 

I modified PaymentModule.php (studying on the forum) from line 423 as follows  (//link evidence the mods) 

                    // Construct order detail table for the email
                    $products_list = '';
                    $virtual_product = true;
                    $product_var_tpl_list = [];
                    foreach ($order->product_list as $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')}, $specific_price, true, true, null, true, $product['id_customization']);
                        $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')}, $specific_price, true, true, null, true, $product['id_customization']);
												
                        $product_price = Product::getTaxCalculationMethod() == PS_TAX_EXC ? Tools::ps_round($price, Context::getContext()->getComputingPrecision()) : $price_wt;
						
						//link
						$link = $this->context->link->getProductLink($product['id_product']);
						// END LINK	
                        
						$product_var_tpl = [
                            'id_product' => $product['id_product'],
                            'id_product_attribute' => $product['id_product_attribute'],
                            'reference' => $product['reference'],
                            //name ORIGINAL 'name' => $product['name'] . (isset($product['attributes']) ? ' - ' . $product['attributes'] : ''),
                            							
							//link
							'name' => '<a href='.$link.'>'.$product['name'].(isset($product['attributes']) ? ' - '.$product['attributes'] : '').'</a>',
							//end link
							
							'price' => Tools::getContextLocale($this->context)->formatPrice($product_price * $product['quantity'], $this->context->currency->iso_code),
                            'quantity' => $product['quantity'],
                            'customization' => [],

                        ];

 

but the result is the following:
in the confirmation email the html code is shown as text and does not work as a href tag.

image.png.1a1470d916a19d77e184dc67cb890aaa.png

and the html is

					<font size="2" face="Open-sans, sans-serif" color="#555454">
						
						<strong>&lt;a href=https://www.sensiline-shop.it/online/calzini/8-calzini-leggeri-ed50011.html&gt;CALZINI LEGGERI - ED50011 - Colore: BIANCO - Taglia: S-35/38&lt;/a&gt;</strong>
						
						
						
					</font>

 

 

Can someone help me?

 

 

Thanks in advance

Link to comment
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
×
×
  • Create New...