Skip to main content

[SOLVED]custom product field in order confirmation

More
10 years 9 months ago - 10 years 9 months ago #224718 by nico.van.leeuwen
-- 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 :
Code:
<?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: 10 years 9 months ago by nico.van.leeuwen.

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

More
10 years 9 months ago #224757 by nicolas
Hi,

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

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

More
10 years 9 months ago #224761 by nico.van.leeuwen
Sure, the image is attatched.

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

More
10 years 9 months ago #224767 by nicolas
Hi,

If you want to include that in the code that you proposed in your first message, it would be:
Code:
<?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.

More
10 years 9 months ago - 10 years 9 months ago #224823 by nico.van.leeuwen
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: 10 years 9 months ago by nico.van.leeuwen.

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

Time to create page: 0.185 seconds
Powered by Kunena Forum