How to read something from $order?

  • Posts: 28
  • Thank you received: 0
13 years 9 months ago #6925

I'm working on a plugin for HikaShop but my problem is that I can't read attributes from $order like the address. Following code is within the 'onAfterOrderCreate(&$order,&$send_email)' function

$hikaFirstname = $order->billing_address->address_firstname; 
$hikaLastname = $order->billing_address->address_lastname; 
$hikaCompany = $order->billing_address->address_company;
$hikaFoo = $order->order_user_id;

echo "<br />".$hikaFoo;
echo "<br />".$hikaFirstname."<br />";
echo "Lastname: ".$hikaLastname."<br />";
echo "Company".$hikaCompany."<br />";
Why is there only a value in $hikaFoo? The other variables are apparently empty. This is probably a PHP syntax error but I've never worked with such heavy arrays and so I apparently don't know how to adress a specific value.

Is there a more comprehensive developer documentation than this one page?

Best regards!

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
13 years 9 months ago #6932

You should try $order->cart->billing_address instead of $order->billing_address
More information about that on that thread:
www.hikashop.com/en/support/forum/4-how-...-conflicts.html#5794

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

  • Posts: 28
  • Thank you received: 0
13 years 9 months ago #6949

Thanks!

I just made a second look in the var_dump($order) and now I see that the billing_adress is included in the cart-object ... just messend around with the braces :-\

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

Time to create page: 0.056 seconds
Powered by Kunena Forum