Synchronize cart with two domains on same server

  • Posts: 19
  • Thank you received: 2
9 years 7 months ago #197181

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.4

Hello,

I have setup Joomla Hikashop website which has 2 domains.
- First is designed for genral iinformation vzimageoptionz.com
- Second is used for shop-menu access dermaquestskincare.com
I have setup 2 carts one which is visible on all pages (top bar), also I use Best seller Hikashop module on vzimageoptionz.com pages.
If I add an item on vzimageoptionz.com part and after gor to dermaquestskincare.com the items will not be visible (reset back to 0), If go back to vzimageoptionz.com they will be vizible again.
I wonder to know if there any configuration to do this sync?
Repeate both domain use same server same Hikashop.
Thank you in advance.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 7 months ago #197210

Hi,

There is no options for that, this will require custom code, potentially a plugin which will create/update the cart of the other website when the cart of one site is updated.

This plugin must be based on the function "onBeforeCartUpdate()" or "onAfterCartUpdate()" and have to call the cart class of the other website to add the product in the other cart too. The plugin must be installed on both websites, and both websites will need to have the same products with the same ids (even if not displayed in frontend).

So it require good PHP knowledges.

Here is the developer documentation:
www.hikashop.com/support/support/documen...r-documentation.html

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

  • Posts: 19
  • Thank you received: 2
9 years 7 months ago #197250

Hi Xavier,

thank you for your response.
Can't I do it even I have this 2 domains on same hosting, same hikashop ?

Br.

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

  • Posts: 19
  • Thank you received: 2
9 years 7 months ago #197278

Hello again,
I found a work around to solve this problem.
I found that there is a cookie with name "cd1ac7c17388496dd92390b8e1351a5d" , so when I redirect from one domain to another I send its value in request parameter:
$domain = "mydomain.com";
if(isset($_COOKIE)){
$url = $domain . $uri . "?CID=".$_COOKIE;
}
else{
$url = $domain . $uri;
}
header("Location: http://$url");

On the another side (mydomain2.com) I set this request value in cookie

$config =& JFactory::getConfig();
$config->set( 'sitename', 'DermaQuest Skin Care' );
if(isset($_GET)){
setcookie("cd1ac7c17388496dd92390b8e1351a5d", $_GET, time() + 3600);
}

It works for me.
I wonder just to be sure that what I'm doing is ok and will not have problems in future, Is this cookie name something constant?

Best regards,
Victoria.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
9 years 7 months ago #197264

Hi,

If you're using the same server, with the same Joomla/HikaShop (so the same database), you will need to have a shared session.
So the users will have the same session in the two domains ; thanks to that, they will keep their cart (their login, etc) in the two domains.

I don't see that your solution will work. This is session cookie and it will changed its key for different users as far as I know. Try with different browsers, or with the private mode of your browser.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Last edit: 9 years 7 months ago by nicolas.

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

Time to create page: 0.049 seconds
Powered by Kunena Forum