[SOLVED]custom product field in order confirmation

  • Posts: 290
  • Thank you received: 22
8 years 11 months ago #224718

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.6
-- PHP version -- : 5.6

Hi,

I'm trying to create a very stripped down version of the order creation email in plain text.
Now I would like to add a field to the row with the product lines.
This field is a custom field that is in the products and is called "gewichtsklasse". It's only visible in the backend.

I've been reading and tried something like this:
echo $data->cart->gewichtsklasse."\n";
But no luck yet. The line it should be appended to is now looking like this :

<?php
foreach($data->cart->products as $item){
	$price = $item->order_product_price*$item->order_product_quantity;
	echo strip_tags($item->order_product_name) . "|" . $currencyHelper->format($item->order_product_price,$data->order_currency_id)."|".$item->order_product_quantity."|".$currencyHelper->format($price,$data->order_currency_id)."\n";
}

Thanks for any help.

Last edit: 8 years 11 months ago by nico.van.leeuwen.

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
8 years 11 months ago #224757

Hi,

Can you provide a screenshot of the settings of your custom field ?

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

  • Posts: 290
  • Thank you received: 22
8 years 11 months ago #224761

Sure, the image is attatched.

Attachments:

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

  • Posts: 82868
  • Thank you received: 13375
  • MODERATOR
8 years 11 months ago #224767

Hi,

If you want to include that in the code that you proposed in your first message, it would be:

<?php $productClass = hikashop_get('class.product');
foreach($data->cart->products as $item){
	$product = $productClass->get($item->product_id);
	$price = $item->order_product_price*$item->order_product_quantity;
	echo strip_tags($item->order_product_name) . "|" . $currencyHelper->format($item->order_product_price,$data->order_currency_id)."|".$item->order_product_quantity."|".$currencyHelper->format($price,$data->order_currency_id)."\n";
	echo $product->gewichtsklasse;
}

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

  • Posts: 290
  • Thank you received: 22
8 years 11 months ago #224823

Hi Nicolas,

Thanks for your reply,

It looks like it's working now, great !
Will check more and then mark this post as solved after that.

Last edit: 8 years 11 months ago by nico.van.leeuwen.

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

Time to create page: 0.064 seconds
Powered by Kunena Forum