Custom field values in Product table in Order

  • Posts: 4
  • Thank you received: 0
9 years 11 months ago #183744

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6

I have a number of custom fields in the product table that I would like to also display in the backend Order>Show view and the Order>Invoice view. I've found discussions on the board, but nothing's worked so far. I'm guessing I'm missing how to jump data between tables. I've found the relevant view files and have confirmed that edits are read properly.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 11 months ago #183777

Hi,

You will have to add custom code, for example in the view "order / show_products" add:

$cids = array();
foreach($this->order->products as $prod){
	if($prod->product_id != '0')
		$cids[]=$prod->product_id;
}
$productClass = hikashop_get('class.product');
$productClass->getProducts($cids);
Before:
foreach($this->order->products as $k => $product) {
And:
<?php
	if(in_array($product->product_id,array_keys($productClass->products))){
		echo $productClass->products[$product->product_id]->CUSTOMFIELD_NAME;
	}
?>
In the desired <td> in the foreach.

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

Time to create page: 0.065 seconds
Powered by Kunena Forum