Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Items staying in cart between stores

by

Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Items staying in cart between stores

  • This topic has 4 replies, 3 voices, and was last updated 12 years, 7 months ago by amin007.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • August 20, 2010 at 9:14 pm #1720
    wrich
    Member

    Hello,

    I am using a WordPress 3.0.1 build so that I can have multiple sites with WP-carts under one domain. But when ever I add an item from one store and travel to another store, my shopping cart keeps the product from the previous store. So if I were to buy two products from two different stores, when I checked out, I go to the paypal account of the store I am on. Am I setting thing up incorrectly somewhere?

    Thanks,

    Chase

    August 21, 2010 at 2:32 am #23550
    wpCommerce
    Moderator

    Are you running multiple sites from one domain? Can you please give examples of your sites?

    August 21, 2010 at 3:34 am #23551
    amin007
    Participant

    when say multiple sites do you mean actual multiple sites like the following:

    example1.com

    example2.com

    or do you mean multiple wordpress installs within the same site?

    example1.com

    example1.com/site2

    August 21, 2010 at 1:20 pm #23552
    wrich
    Member

    example1.com

    example1.com/site2

    Just like that, we had a temporary solution by terminating the session if a user switched sites, so there no cart items will travel from site to site. We added this to our index.php

    $locationArray = explode('/', $_SERVER['REQUEST_URI']);
    $store_id = $locationArray[1];
    if ($store_id == 'favicon.ico') {
    $store_id = 'other';
    }

    if (!(isset($_COOKIE['store_id']))) {
    if ($store_id != 'other') {
    setcookie('store_id', $store_id, mktime(0,0,0,date("n")+1,date("j"),date("Y")), '/', $_SERVER['SERVER_NAME'], false, true);
    }
    } else {
    if (($_COOKIE['store_id'] != $store_id) && ($store_id != 'other')) {
    session_destroy();
    $params = session_get_cookie_params();
    setcookie('PHPSESSID', '', time()-42000, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
    setcookie('cart_in_use', '', time()-3600);
    setcookie('store_id', $store_id, mktime(0,0,0,date("n")+1,date("j"),date("Y")), '/', $_SERVER['SERVER_NAME'], false, true);
    }
    }

    Any better ideas?

    Chase

    August 22, 2010 at 4:20 am #23553
    amin007
    Participant

    Okay so thats not two different sites. It’s the same site. Remember just because you have installed multiple WordPress in your one site doesn’t make it two different sites in PHP and Apache.

    What you have there will do but I would recommend resetting the shopping cart using something like the following rather than destroying the session (in case you have other session variables that you might need):

    unset($_SESSION['eStore_cart']);

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • WP PDF Stamper Documentation
  • WP Photo Seller Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial
  • WP Photo Seller Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2023 | Tips and Tricks HQ