Access cart info from Fields step in checkout

  • Posts: 23
  • Thank you received: 1
8 years 10 months ago #226123

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.4.45
-- Browser(s) name and version -- : Chrome latest

Hello,

I'd like to access order informations (full price with tax, shipping address) from the "fields" checkout step in order to display (or not) different custom fields, is it possible and if so, how ?

Thank you very much !

Last edit: 8 years 10 months ago by Phane.

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

  • Posts: 4753
  • Thank you received: 644
  • MODERATOR
8 years 10 months ago #226180

Hello,

This video may help you to understand how the checkout views can be configured.

Video tutorial link

And For the custom field, this tutorial as well will give you some clue to create an Order Custom field.
With all of these, you have to add in your checkout configuration the "Fields" elements and create your required custom field

Regards,

Last edit: 8 years 10 months ago by Philip.

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

  • Posts: 23
  • Thank you received: 1
8 years 10 months ago #226250

Hello Philip,

Thank you for your answer.

I understand all of this, I already configured the checkout workflow and added custom fields. The thing is I would like to, in the code (on the checkout/fields.php view), access the order informations with a line like "$this->orderInfos", and use them to hide or show the custom fields. I know it's possible to access these informations from the checkout/step.php view but is it possible from the fields view ?

Thanks.

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

  • Posts: 82907
  • Thank you received: 13378
  • MODERATOR
8 years 10 months ago #226335

Hi,

I suppose that you're talking about the cart information, not the order information since there is not yet any order on the checkout.

You can use such code:
$cartClass = hikashop_get('class.cart');
$cart = $cartClass->loadFullCart();

You'll get all the information available for the current cart in $cart.

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

  • Posts: 23
  • Thank you received: 1
8 years 10 months ago #226358

That's great, thanks a lot !

Would it be possible to also get the shipping address ? knowing that the client selects it before the fields step.

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

  • Posts: 82907
  • Thank you received: 13378
  • MODERATOR
8 years 10 months ago #226382

Hi,

The shipping address should also be available in $cart.

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

  • Posts: 23
  • Thank you received: 1
8 years 10 months ago #226473

Hello,

I just need to turn the "additionalInfos" to true : $cart = $cartClass->loadFullCart(true);
Now it works perfectly, thank you very much !

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

Time to create page: 0.064 seconds
Powered by Kunena Forum