Hi,
The problem is that there is an inconsistency between the custom field table and what you want to do.
An order can have several products. And your custom field is of the table "item" not "order", and thus for one order, you'll have a value of that custom field for each product in the order.
So either:
- you want to actually use a custom field of the table "order" and not "item" so that the custom field is linked to the order and not to each product of the order. In that case, you'll have display options to directly display the value there, without the need for any custom code.
- you want to use a custom field of the table "item" as you want to have the custom field for each product of the order. In that case, you first need to load the products of the order and then encapsulate your code in a foreach on the products. Something like that:
$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder($row->order_id, true);
$fieldsClass = hikashop_get('class.field);
foreach($order->products as $product) {
$fields = $fieldsClass->getFields('frontcomp',$product,'item','checkout&task=state');
echo $fieldsClass->show($fields['venue'],$product->venue);
}