Product specific email fields

  • Posts: 187
  • Thank you received: 10
11 years 10 months ago #82242

My client wants to send an email with every product sold. Not only a generic one like is standard in Hika but at least some additional text.

Jerome offered to show here how this should be done with adding 5 lines of PHP code and the use of extra fields.

I am patiently waiting :-)

Bastiaan

Please Log in or Create an account to join the conversation.

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
11 years 10 months ago #82575

Hi,

In the "order_status_notification" email, you have this code

	if(!empty($itemFields)){
		foreach($itemFields as $field){
			$namekey = $field->field_namekey;
			if(empty($item->$namekey)) continue;
			echo '<p>'.$fieldsClass->getFieldName($field).': '.$fieldsClass->show($field,$item->$namekey).'</p>';
		}
	}
This part of code display item custom fields.
You can add just after:
if(empty($productClass))
	$productClass = hikashop_get('class.product');
if($item->product_id > 0) {
	$fullProduct = $productClass->get($item->product_id);
	if(!empty($fullProduct))
		echo '<p>My custom field: ' . $fullProduct->mycustom_field . '</p>';
}
And just changing the text "My custom field" and the custom field name "mycustom_field".

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 11 years 10 months ago by Jerome.

Please Log in or Create an account to join the conversation.

Time to create page: 0.053 seconds
Powered by Kunena Forum