Address chosen in user panel to show up in invoice

  • Posts: 41
  • Thank you received: 9
11 years 9 months ago #121828

Hello!

I've made some modifications so that upon placing order invoice is instantly generated and sent to client's email as PDF. I've also enabled Hikashop user profile, so that clients can edit their email and addresses. But there is slight problem - even if client have added/edited his address through frontend profile, invoice generator use address that client entered during registration phase in Hikashop. So this address can't be edited through Hikashop client profile in frontend?

The question is - is there any way to allow client edit his real credentials via Hikashop frontend, and, if not, then how to at least use his chosen/edited address in inoive form/PDF?

At this moment in invoice.pdf client's address is echoed this way:

$addresses = array('billing_address');
foreach($addresses as $oneAddress){	

if(empty($order->$oneAddress)) continue;

if(!empty($order->$oneAddress->address_company))
echo $order->$oneAddress->address_company.'<br/>';
echo$order->$oneAddress->address_street.', '.$order->$oneAddress->address_city.', '.$order->$oneAddress->address_post_code.'<br/><br/>';
if(!empty($order->$oneAddress->address_vat)) echo JText::_('VAT_NUMBER').': '.$order->$oneAddress->address_vat.'<br/>'; if(!empty($order->$oneAddress->address_bank)) echo JText::_('BANK_NAME').':  '.$order->$oneAddress->address_bank.'<br/>'; if(!empty($order->$oneAddress->address_account)) echo JText::_('BANK_ACCOUNT').': '.$order->$oneAddress->address_account.'<br/>'; }

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

  • Posts: 83932
  • Thank you received: 13588
  • MODERATOR
11 years 9 months ago #121850

Hi,

That's normal.
The address that the user enter during the checkout is saved as his address.
At the same time, a copy is selected automatically as the address of the order.
If the user changes his address, his previous orders address is not changed. That's normal and that's how it is on all ecommerce websites.
It's not normal to allow a user to change the address of an order two months later. Suppose that you have to charge taxes for users in your country and not for users outside your country... If the user changes the country of his address in the order, then the taxes of the order need to be updated too, but you can't charge again the user for the taxes update...And you can't refund partly the taxes that you probably already sent to your tax office.

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

  • Posts: 41
  • Thank you received: 9
11 years 9 months ago #121892

Hi, Nicolas! Thanky You very much for Your effort, as usual.

Yes, I understand that under normal conditions (if shop is selling physical goods) client billing/shipping/profile addresses is seperate instances. BUT - in my case client is selling virtual goods, so there is no shipping address, but clients wants that customers can really change their address through frontend profile.

So, let me rephrase my question -

How to edit Hikashop user profile component, so that address (email and shipping address) that have been entered by customer in his forntend profile would show up in invoice, and also be stored as hikashop customer data. So that customer logs in, edit his profile (change email/address) and invoices will be sent to his new email and contain his entered address as billing address.

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

  • Posts: 83932
  • Thank you received: 13588
  • MODERATOR
11 years 9 months ago #121945

The email address is attach only to the user, not to the orders. So if the user changes his email address, it applies for everything.

For the physical address, you will have to change the line:

$this->loadAddress($order->order_billing_address_id,$order,'billing','name',$type);
to:
$addressClass = hikashop_get('class.address');
$addresses = $addressClass->getByUser($order->order_user_id);
$main_address = reset($addresses);
$this->loadAddress($main_address->address_id,$order,'billing','name',$type);
in the file administrator/components/com_hikashop/classes/order.php

Last edit: 11 years 9 months ago by nicolas.
The following user(s) said Thank You: Savickis

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

Time to create page: 0.062 seconds
Powered by Kunena Forum