Change fields in orders backend

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #34343

I use HikaShop for wholesale orders. Our sales person enters orders for all our sales. He is listed as the customer for all the orders in the backend under "Customer". Is there a way to replace the "customer" field with the billing company field instead?

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 3 months ago #34387

Hi,

You need to edit the file "form" of the view "order" for your back end template via the menu Display->Views and change the line:

<?php echo $this->order->customer->name.' ('.$this->order->customer->username.')'; ?>

to:
<?php echo $this->order->billing_address->address_firstname.' '.$this->order->billing_address->address_lastname; ?>

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

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #34435

I followed your instructions, but it did not change the field. I still see "customer" listed in the back menu. Please see attached image. Instead of customer, I need the name of the company that is billed. I do not know anything about PHP, but your code referenced first name and last name, which is not what I need.

Attachments:

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 3 months ago #34485

Which field are you talking about ? Are you sure that you edited the correct file ?
Could you do a screenshot ? The screenshot you attached to your message doesn't seem to be the correct one.

Indeed that code is for the customer address first and last names. For the company name it's similar:

<?php echo $this->order->billing_address->address_company; ?>

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

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #34571

Sorry about hta, I did not uplaod the wrong image file. Here is the correct one.

Attachments:

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

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #34572

Also, here is a screenshot of where I placed the code.

Attachments:

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 3 months ago #34600

Ah now I see.

I thought that you were talking about the customer information on the order details page.

For the orders listing, it's more difficult to do as that information is not loaded on the listing.
You would have to first load it with a MySQL query and then you would be able to display the address company.

You can do that in the file "listing" of the view "order" of the back end via the menu Display->Views

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

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #34689

I do not know how to do that. I tried changing the existing code, which did not work. So, I replaced the original code. And now, the listing does not appear at all. I get this error message: "Parse error: syntax error, unexpected '<' in /home/kurtsnow/public_html/kingsofkustoms.com/administrator/templates/bluestork/html/com_hikashop/order/listing.php on line 116" I checked line 116 and I cannot figure out the problem.

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 3 months ago #34746

If you want to revert your changes, please go in the menu Display->Views and click on the delete icon in the "remove customization" column for the view file you edited and your modifications will be reverted and it should work again.

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

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #34953

Thanks. It now displays fine. So, back to my original problem. How do I ...

"load it with a MySQL query and then you would be able to display the address company.

You can do that in the file "listing" of the view "order" of the back end via the menu Display->Views"

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 3 months ago #34985

You can try something like that:

$addressClass = hikashop_get('class.address');
$address = $addressClass->get($row->order_billing_address_id);
echo $address->address_company;

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

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #34992

I entered this code:

<?php
$addressClass = hikashop_get('class.address');
$address = $addressClass->get($row->order_billing_address_id);
echo $address->address_company;
?>

to replace this line:
<?php echo $this->order->customer->name.' ('.$this->order->customer->username.')'; ?>

And it does not work

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 3 months ago #34996

There is no such code in the file "listing" of the view "order" of the back end.
You're not editing the correct view file.

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

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #34998

And that would be .... ?

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 3 months ago #35005

The file "listing" of the view "order" of the back end.

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

  • Posts: 20
  • Thank you received: 0
12 years 3 months ago #35064

That worked. Thank you.

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

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
12 years 2 months ago #37671

Hi, I want to do something similar to this thread.

Can an extra field be inserted to show the shipping cost or shipping method name?

thanks

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 2 months ago #37789

Where do you want to display that ?
The listing of orders ? The orders information ? The invoice ? On the front end or the back end ?

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

  • Posts: 513
  • Thank you received: 8
  • Hikashop Business
12 years 2 months ago #37814

Administration, orders, same place as the screen dump higher up this thread.

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

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
12 years 2 months ago #37977

Yes you can do that by editing the file "listing" of the view "order" of the back end via the menu Display->Views.
The shipping method information is in $row->order_shipping_id (you will have to load the shipping information from the database to display the name:
$class = hikashop_get('class.shipping');
$shipping = $class->get($row->order_shipping_id);
echo $shipping->shipping_name;

and the shipping cost is in: $row>->order_shipping_price.

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

Time to create page: 0.077 seconds
Powered by Kunena Forum