display order weight

  • Posts: 719
  • Thank you received: 3
9 years 5 months ago #176463

Hi,
is there a way to see the total weight of an order only on my backend?
Thanks


my site with Hikashop
www.lacasettabio.it

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

  • Posts: 12953
  • Thank you received: 1778
9 years 5 months ago #176473

Hello,
To do that the solution will be to directly edit the code of the "show_products" file of the "Order" view of your back-end template via "Hikashop->Display->Views", note that some development skills will be required.

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

  • Posts: 719
  • Thank you received: 3
9 years 5 months ago #176568

Hi,
but has the system the total weight already calculated?
If yes, what is the name of the variable?


my site with Hikashop
www.lacasettabio.it

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

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #176580

Hi,

No it's not calculated, you will have to do a foreach on the products and increment a $weight variable for example and then display the value of this variable.

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

  • Posts: 719
  • Thank you received: 3
9 years 5 months ago #176728

Hi,
like that it is too difficult for me.
But, why can not get the value of the shipping?
The system knows the weight because it has calculated the shipping cost.
;)


my site with Hikashop
www.lacasettabio.it

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

  • Posts: 13201
  • Thank you received: 2322
9 years 5 months ago #176734

Hi,

The fees are calculated in earlier based on the weight, etc. But the weight is not stored in the order, only the fees.
So the foreach is required in this case ;)

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

  • Posts: 719
  • Thank you received: 3
9 years 5 months ago #176993

Hi,
so, it is too difficult for me.
I hope that someone else ask you the same feature so that you can put it on your todo list!
;)
Regards


my site with Hikashop
www.lacasettabio.it
Last edit: 9 years 5 months ago by lacasetta.

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

  • Posts: 171
  • Thank you received: 4
8 years 11 months ago #201657

needed it for something else, so just did the code

	$database = JFactory::getDBO();
    $query = 'SELECT a.order_product_quantity,b.product_weight FROM ' .
        hikashop_table('order_product') . ' as a LEFT JOIN ' . hikashop_table('product') .
        ' as b ON a.product_id=b.product_id WHERE order_id=' . $this->order->order_id .'';
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    $weight = 0;
	foreach ($rows as $row) {
		$weight += $row->order_product_quantity*$row->product_weight;
	}

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

  • Posts: 17
  • Thank you received: 0
8 years 9 months ago #206360

Jesper, thank you for providing this! Can you tell me where this code snippet goes? Does it go on a particular line in show_products.php, or somewhere else?

Thanks!

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

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
8 years 9 months ago #206379

Hi,

Regarding the code, it is related to the order ; so I think it's in the front-end display of the order or in the backend edition of the order.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 171
  • Thank you received: 4
8 years 9 months ago #206581

It should be able to be used anywhere you could need it... i used it in the backend to calculate the total wieght of the order to send the info with the shipping module to the postal provider.

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

Time to create page: 0.099 seconds
Powered by Kunena Forum