- Posts: 82
- Thank you received: 5
Custom fields for product in order variable
4 years 5 months ago #340633
by tgdkere2
Custom fields for product in order variable was created by tgdkere2
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
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.
4 years 5 months ago - 4 years 5 months ago #340651
by nicolas
Replied by nicolas on topic Custom fields for product in order variable
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:
where xxx is the column name of your custom field of the table "product".
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:
Code:
$productClass = hikashop_get('class.product);
foreach( $order_full->products as $product) {
$productData = $productClass->get($product->product_id);
echo $productData->xxx;
}
Last edit: 4 years 5 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.357 seconds