how to show weight in sales backend

  • Posts: 51
  • Thank you received: 0
12 years 9 months ago #46330

Hi Nikolas

how to display weight in total and per product quantity at back end?
like below pictures



and


If it is not doable, how to include total weight in email notification to administrator??
like 'new order has been created... order (number).. sub total (number)... weight (number)'

Or any other way to inform administrator the total weight of one order??

Thanks

Attachments:
Last edit: 12 years 9 months ago by loling.

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 9 months ago #46412

That information is not stored in the orders.

You can always edit the view file and load the data from the product, and do the maths but it's complex if you're not a programmer.

For the order creation email, it should be simpler I think. Try to add such code in it:
Total weight: <?php echo $data->cart->weight; ?>

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

  • Posts: 51
  • Thank you received: 0
12 years 9 months ago #46494

i think order creation email will do the job, where do i insert that code into??

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 9 months ago #46500

In the "order creation notification" email that you can edit via the menu System->Emails in the Business edition.

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

  • Posts: 51
  • Thank you received: 0
12 years 9 months ago #46513

how to do it in starter edition??

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 9 months ago #46535

You can edit the file in the folder media/com_hikashop/mail but beware that unlike when you do it via the interface, you will loose your changes when you update HikaShop.

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

  • Posts: 51
  • Thank you received: 0
12 years 9 months ago #46853

so i edited order_admin_notification.text.php file in media/com_hikashop/mail/ into something like below. i have tried Total weight: <?php echo $data->cart->weight; ?>, Total weight: $data->cart->weight;, and echo "\r\n".JText::_('CART_WEIGHT').' : '.$data->cart->weight; .. Nothing works, please help =|

<?php
$url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id='.$data->order_id;
echo JText::sprintf('ORDER_STATUS_CHANGED',$data->mail_status)."\r\n".JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE',$data->order_number,HIKASHOP_LIVE);
echo $data->cart->weight;
$currency = hikashop_get('class.currency');
echo "\r\n".JText::_('HIKASHOP_TOTAL').' : '.$currency->format($data->order_full_price,$data->order_currency_id);
echo "\r\n".str_replace('<br/>',"\r\n",JText::sprintf('ACCESS_ORDER_WITH_LINK',$url));
if($data->order_payment_method=='creditcard' && !empty($data->credit_card_info->cc_number)){
echo "\r\n".JText::_('CUSTOMER_PAID_WITH_CREDIT_CARD');
if(!empty($data->credit_card_info->cc_owner)){
echo "\r\n".JText::_('CREDIT_CARD_OWNER').' : '.$data->credit_card_info->cc_owner;
}
echo "\r\n".JText::_('END_OF_CREDIT_CARD_NUMBER').' : '.substr($data->credit_card_info->cc_number,8);
if(!empty($data->credit_card_info->cc_CCV)){
echo "\r\n".JText::_('CARD_VALIDATION_CODE').' : '.$data->credit_card_info->cc_CCV;
}
echo "\r\n".JText::_('CREDITCARD_WARNING');
}
$fieldsClass = hikashop_get('class.field');
$fields = $fieldsClass->getFields('frontcomp',$data,'order','');
foreach($fields as $fieldName => $oneExtraField) {
echo "\r\n".$fieldsClass->trans($oneExtraField->field_realname).' : '.$fieldsClass->show($oneExtraField,$data->$fieldName);
}

Last edit: 12 years 9 months ago by loling.

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 9 months ago #46942

You should edit the html version, not the text version of the email which is rarely displayed by email clients.

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

  • Posts: 51
  • Thank you received: 0
12 years 9 months ago #46958

i have edited the html version as well, but it is not showing either.

When i tried to insert Total weight: $data->cart->weight; or echo "\r\n".JText::_('CART_WEIGHT').' : '.$data->cart->weight; ,, the 'Total weight:' was shown, but there was no total weight for that order. so the email that admin receives is like this:

The order is now created.
Order C1A0N70
Total Weight:
Sub Total : Rp 72.000
You can access the order details directly by clicking on the link below after logging in your back end:
www.kliknshop.com/administrator/index.ph...k=edit&order_id=1070

Where did i do wrong??

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 9 months ago #47065

Then if that doesn't work you'll have to calculate the weight yourself...
It can be done with a few lines:
$class = hikashop_get('class.product');
$weight = 0;
foreach($data->cart->products as $prod){
$info = $class->get($prod->product_id);
$weight +=$info->product_weight*$prod->order_product_quantity;
}
echo $weight;

That should be done after:
$data->cart = $class->loadFullOrder($data->order_id,true,false);

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

  • Posts: 12
  • Thank you received: 0
12 years 9 months ago #47339

Hi
Apologies for hijacking on this thread but this is exactly what I would like to achieve as well.
I would also like to be able to show hazardous products with a combined weight/fluid volume too, is there a way of pulling this through in the same way?

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

  • Posts: 83103
  • Thank you received: 13418
  • MODERATOR
12 years 9 months ago #47687

Yes, it's basically the same... Just replace $info->product_weight by ($info->product_width*$info->product_length*$info->product_height)

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

Time to create page: 0.120 seconds
Powered by Kunena Forum