Cart_id outside Hikashop

  • Posts: 9
  • Thank you received: 2
  • Hikashop Business Hikashop Essential
2 months 1 week ago #363152

-- url of the page with the problem -- : www.mijnpvcwinkel.nl
-- HikaShop version -- : 5.1.0
-- Joomla version -- : 5.1.4
-- PHP version -- : 8.2.0
-- Browser(s) name and version -- : Safari

Hi,

I am running a hikashop version for a showroom and appointment system. Customers can select different styles and/or products they are interested in and put them into the cart. When they are done they can go to view the cart and proceed to the checkout where they are redirected to an appointment system. In this appointment system they can select a date from the booking calendar and they have to put in their name, address and other contactdetails.
All I want is to do is add the cart_id or the list of products to a field (I have custom fields to play with) into the booking form, which will be send to me. In that case I can select all the samples to take with me on a visit at the customers address.
Because the wishlist demands me to make a login, this is not applicable, since the customer should not be forced to make an account (GDPR proof). I can adapt the system to my needs, but only this slight problem keeps me from publishing the new layout.

So the question is: is there a way to transfer the cart_id ($cart_id) to another (not hikashop) component?

Thanks in advance.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
2 months 1 week ago #363154

Hi,

How do you redirect from the HikaShop checkout to your booking form ?
I think that's where you want to provide the id of the cart. You could just add it to the URL when performing the redirection.
Another simple way is to look in

$_COOKIES['hikashop_cart_id']
in your PHP code.
Another way is to load hikashop's main helper file, if it's not already loaded, and use the normal HikaShop PHP code to get the current cart id:
if(!@include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php')){ return false; }
$cartClass = hikashop_get('class.cart');
$cart_id = $cartClass->getCurrentCartId();

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

  • Posts: 9
  • Thank you received: 2
  • Hikashop Business Hikashop Essential
2 months 6 days ago #363245

Nicolas,

Thanks for your support. I did implement the extension of the url, since it was an easy addition. Although I tried this earlier and couldn't get it to work, this time it was a quick fix.

Again thanks for the support.

The following user(s) said Thank You: Philip

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

Time to create page: 0.036 seconds
Powered by Kunena Forum