Getting buyers name and mobile in php script mass action

  • Posts: 41
  • Thank you received: 5
4 months 2 weeks ago #338326

-- HikaShop version -- : 4.4.5
-- Joomla version -- : 4.0.5
-- PHP version -- : 7.4

Hi. I know that in mass actions for products, I can use the tag {product_code} to get the product code in php script mass action.

I'm creating a mass action php script for orders, I need to get the buyer name and mobile number in my script, how can I get that information of the buyer of an order ??
is there a list of all availables tags tahn can be used in php script mass action ?

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

  • Posts: 75522
  • Thank you received: 11755
  • MODERATOR
4 months 2 weeks ago #338328

Hi,

Only the information of the main element can be used.
So for the product mass actions, you can look at the columns of the hikashop_product table for all the tags you can use, and for the order mass actions, you can look at the columns of the hikashop_order table for all the tags you can use.
The user account name is stored in the joomla users table, the billing address name and phone number are stored in the hikashop_address table. So you can't directly use a tag to get the information.
However, you can use the {order_id} to load the order information, as explained in one of the examples of our developer documentation:
www.hikashop.com/support/documentation/6...umentation.html#code
And then, you'll have all the information of the order available.
For example:

$orderClass = hikashop_get('class.order');
$order = $orderClass->loadFullOrder({order_id}, true, false);
echo $order->customer->username;
echo $order->customer->name;
echo $order->billing_address->addres_firstname;
echo $order->billing_address->addres_lastname;
echo $order->billing_address->addres_telephone;

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

  • Posts: 41
  • Thank you received: 5
4 months 2 weeks ago #338420

Thank you Nicolas.

The following user(s) said Thank You: Philip

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

Time to create page: 0.059 seconds
Powered by Kunena Forum