- Posts: 1
- Thank you received: 0
User order info
7 years 4 months ago #307482
by the_g
User order info was created by the_g
Hi am developing a plugin for hikashop and I do not know how to get the following info for my plugin
Is it something like $user->address1?
P.S I am new to Joomla development
"first_name"
"last_name"
"email"
"phone"
"country"
"region"
"address1"
"address2"
"city"
"zip"
Is it something like $user->address1?
P.S I am new to Joomla development
"first_name"
"last_name"
"email"
"phone"
"country"
"region"
"address1"
"address2"
"city"
"zip"
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307486
by nicolas
Replied by nicolas on topic User order info
Hi,
The exact code to get the address of the user will depend in which trigger you want to do that. Could you provide more information on that ?
Supposing that you have the user_id of the user from the hikashop_user table in the variable $user_id, and supposing that HikaShop is already loaded, you can use such code to get the addresses of the user:
The exact code to get the address of the user will depend in which trigger you want to do that. Could you provide more information on that ?
Supposing that you have the user_id of the user from the hikashop_user table in the variable $user_id, and supposing that HikaShop is already loaded, you can use such code to get the addresses of the user:
Code:
$addressClass = hikashop_get('class.address');
$addresses = $addressClass->loadUserAddresses($user_id);
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307540
by the-g
Replied by the-g on topic User order info
After a user pays I want his info to be sent via post
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307544
by nicolas
Replied by nicolas on topic User order info
Hi,
So in that case, I would recommend to implement the "onAfterOrderUpdate(&$order)" trigger in a plugin of the group "hikashop".
In it, you would first check the new and old status, and then load the order data and get the info of the billing address:
So in that case, I would recommend to implement the "onAfterOrderUpdate(&$order)" trigger in a plugin of the group "hikashop".
In it, you would first check the new and old status, and then load the order data and get the info of the billing address:
Code:
if($order->order_status != $order->old->order_status && $order->order_status == 'confirmed') {
$orderClass = hikashop_get('class.order');
$orderData = $orderClass->loadFullOrder($order->order_id, false, false);
echo $orderData->billing_address->address_city;
// etc
}
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307566
by the-g
Replied by the-g on topic User order info
What about name and other info?
Please Log in or Create an account to join the conversation.
7 years 4 months ago #307573
by nicolas
Replied by nicolas on topic User order info
Hi,
It's the same as for the city, just replace the address_city with the column name of the custom address field you want. You can see the column names in the menu Display>Custom fields of HikaShop.
It's the same as for the city, just replace the address_city with the column name of the custom address field you want. You can see the column names in the menu Display>Custom fields of HikaShop.
Please Log in or Create an account to join the conversation.
Time to create page: 0.159 seconds