Getting user name on invoice

  • Posts: 194
  • Thank you received: 5
5 years 6 months ago #299086

-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.8.12
-- PHP version -- : 7.1.15

When I display the Invoice (from admin) the 'Ordered by' area is blank, as is the billing address.

We don't collect that information from users when ordering because they have already supplied that information via Community Builder when they set-up their user account.

Is there any way to ...

1. Pull in the user's data into a HS address record (for billing or shipping) automatically from CB?
OR
2. Can we at least get the order to show the customer's name and email address on the invoice (that is already displaying in the "Customer" area in the order details)

Additionally, when I try to edit the Billing address/Shipping address on the admin side of the order, clicking the check mark (to accept the change) just clears everything entered.

NOTE: I have tried to look through the display area to determine where to make changes to the template; however, I don't know which of the many templates to change and (esp. for option 2 above) how to access the name/email data.

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

  • Posts: 81504
  • Thank you received: 13064
  • MODERATOR
5 years 6 months ago #299090

Hi,

To know which view file you want to edit, you can use the "Display view files" setting of the Hikashop ocnfiguration:
www.hikashop.com/support/documentation/1...-display.html#layout

You sure can pull the address from CB in a HS address.
For example, you could do that in the onBeforeOrderCreate(&$order, &$do) trigger in a custom plugin of the group hikashop.
In there, you could use such code to get the joomla id:

$user = hikashop_loadUser(true);
$id = $user->user_cms_id;
Then, you could call CB to load the address based on that ID, or with a MySQL query (you have to check with the support of CB about how to do that).
Once you have the address, you can create a new record in the table hikashop_address using $user->user_id as the user_id in the hikashop_address table and the data from CB for the other fields. You can use a MySQL query or the code of HikaShop like that:
$addressClass = hikashop_get('class.address');
$address_id = $addressClass->save($address);
And then you can use that address_id in the order like that:
$order->order_billing_address_id = $address_id;

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

Time to create page: 0.061 seconds
Powered by Kunena Forum