Jump to content

Adding cost field in back office order summary


Recommended Posts

Hello,

 

I have a problem with orders in back office. I need to have extra field in order summary.

 

What I need is an extra field in order(I'm posting screen of place that I'm talking about)), but it can't be seen by customer(as it is cost of products)

 

I've putted cost in every product, now I need to now which file I have to change to make it visible in order summary)

 

Thanks for all your help

 

Greetings

M.Modzelewski

post-824452-0-90133300-1407500835_thumb.png

Link to comment
Share on other sites

You can try and modify this method of the adminordercontroller


	protected function getProducts($order)
	{
		$products = $order->getProducts();

		foreach ($products as &$product)
		{
			if ($product['image'] != null)
			{
				$name = 'product_mini_'.(int)$product['product_id'].(isset($product['product_attribute_id']) ? '_'.(int)$product['product_attribute_id'] : '').'.jpg';
				// generate image cache, only for back office
				$product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');
				if (file_exists(_PS_TMP_IMG_DIR_.$name))
					$product['image_size'] = getimagesize(_PS_TMP_IMG_DIR_.$name);
				else
					$product['image_size'] = false;
			}
		}

		return $products;
	}
	

But it means another query for each product. OR, you can grab the wholesale  price by joining the product table in


	public function getProductsDetail()
	{
		return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
		SELECT *
		FROM `'._DB_PREFIX_.'order_detail` od
		LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = od.product_id)
		LEFT JOIN `'._DB_PREFIX_.'product_shop` ps ON (ps.id_product = p.id_product AND ps.id_shop = od.id_shop)
		WHERE od.`id_order` = '.(int)($this->id));
	}

Of the order class

Link to comment
Share on other sites

×
×
  • Create New...