Jump to content

Mailalert mod


Recommended Posts

hi. I use ps 1.4 and now i have add a new field ($my_field) on product page in BO. i have add variable in class/product.php and create new filed in database PS_PRODUCT_MY_FIELD. All it's ok

Now i want use this variable (example $my_field) in mailalert module for neworder.

I have add $my_field in class/orderdetail.php

public $product_my_filed;
'product_my_filed' => 'isUnsignedInt',   
$fields['product_my_filed'] = pSQL($this->product_my_field);

I have add product_my_field in PS_ORDERDETAIL_MY_FIELD database.


In modules/mailalerts/mailalerts.php

$itemsTable .=
				'<tr style="background-color:'.($key % 2 ? '#DDE2E6' : '#EBECEE').';">
					<td style="padding:0.6em 0.4em;">'.$product['product_reference'].'</td>
					<td style="padding:0.6em 0.4em;">'.$product['product_my_field'].'</td>
					<td style="padding:0.6em 0.4em;"><strong>'.$product['product_name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').(!empty($customizationText) ? '<br />'.$customizationText : '').'</strong></td>
					<td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice($unit_price, $currency, false).'</td>
					<td style="padding:0.6em 0.4em; text-align:center;">'.(int)($product['product_quantity']).'</td>
					<td style="padding:0.6em 0.4em; text-align:right;">'.Tools::displayPrice(($unit_price * $product['product_quantity']), $currency, false).'</td>

but when receive order mail this field is empty.


Help please!!!

Link to comment
Share on other sites


How can i setting it's value when the new order is created?

is there a function that do this?

i have see "reference" in "product" db that when customer make an order pass his value to "orderdetail" prodcut_reference and later in mailalerts module.

Can you give me a suggestion?

Link to comment
Share on other sites


thanks for answer but nothing.


I have add in PaymenModule.php

$query = 'INSERT INTO `'._DB_PREFIX_.'order_detail`



and in

$query .= '.(empty($product['my_filed']) ? 'NULL' : '\''.pSQL($product['my_filed']).'\'').',

Any suggestion?

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