Custom fields for product in order variable

  • Posts: 78
  • Thank you received: 4
  • Hikamarket Multivendor Hikashop Business
2 years 7 months ago #340633

Hi,

I created a custom field for the product table which I would need in the order variable:
$order_full = $orderClass->loadFullOrder($order->order_id, true, false);

This custom field is also displayed on the frontend.

I need this custom field for the product in the function: onAfterOrderUpdate(&$order, &$send_email)

But the custom field is not available in the order variable.

Why not and how can I add it , so that I can use it in the function onAfterOrderUpdate ???

Thanks and br
Rene

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 years 7 months ago #340651

Hi,

Well, the whole product data in not loaded with the order. That's because this is usually not needed.
You can do this in your code:

$productClass = hikashop_get('class.product);
foreach( $order_full->products as $product) {
 $productData = $productClass->get($product->product_id);
 echo $productData->xxx;
}
where xxx is the column name of your custom field of the table "product".

Last edit: 2 years 7 months ago by nicolas.
The following user(s) said Thank You: tgdkere2

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

Time to create page: 0.055 seconds
Powered by Kunena Forum