Jump to content

Link from email confirmation to product


Recommended Posts

Change line 81 of classes/PaymentModule.php from:

global $cart;



and line 241 from

'.$product['reference'].'



to:

<a href="'.$link->getProductLink($product['id_product'], $product['link_rewrite'], $product['id_category_default']).'">.$product['reference'].'



I haven't tested this code, but it should point you in the right direction.

Link to comment
Share on other sites

  • 1 month later...

Thanks rocky - useful, but can't find exactly what I want in there! Basically the admin email I recieve to notify me of an order - I want to change the column of 'Ref' to be the 'Product Code'. Where abouts is this coded?

I've looked in /mailalerts/mails/en/new_order.html but the bit I want to edit comes up as {items}

Any ideas?

Cheers,

Lee

Link to comment
Share on other sites

That code is on lines 106-119 of modules/mailalerts/mailalerts.php (in PrestaShop v1.3.2):

$itemsTable = '';
foreach ($params['cart']->getProducts() AS $key => $product)
{
   $unit_price = Product::getPriceStatic($product['id_product'], (bool)(Product::getTaxCalculationMethod() == PS_TAX_INC), $product['id_product_attribute'], 2, NULL, false, true, $product['cart_quantity']);
   $price = Product::getPriceStatic($product['id_product'], (bool)(Product::getTaxCalculationMethod() == PS_TAX_INC), $product['id_product_attribute'], 6, NULL, false, true, $product['cart_quantity']);
   $itemsTable .=
       '
'.$product['reference'].'
'.$product['name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').'
'.Tools::displayPrice($unit_price, $currency, false, false).'
'.intval($product['cart_quantity']).'
'.Tools::displayPrice(($price * $product['cart_quantity']), $currency, false, false).'
';
}

Link to comment
Share on other sites

OK thanks rocky, that did the trick. The only other bit I need to alter this in is on the PDF - where once again I want to swap 'reference' for 'id_product'
but the only line within classes/PDF.php is the below (which doesn't solve it:

$this->Cell($w[1], $lineSize, ($product['product_reference'] != '' ? $product['product_reference'] : '---'), 'B');



Any ideas?

Link to comment
Share on other sites

There are actually a few different lines with the product reference that you will need to change. If you want to replace all references with product IDs, just change all $product['product_reference'] to $product['product_id']

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...