0

Since upgrading to Cartthrob 2.6 (on EE 2.7.0) I can only view the items in my cart when I'm logged into the control panel. When anyone else tries to add to cart they just see the page refresh and an empty cart. We're not using or creating members for the cart, everyone uses the cart as a guest.

I'm using the standard add to cart form with the return set to the same page. There is only one product but with a range of options.

{exp:cartthrob:add_to_cart_form return="samepage" entry_id="2720"}

        <label>Card Value</label>
        {exp:cartthrob:item_options entry_id="2720"}
            {select}
                <option {selected} value="{option_value}">${option_value}</option>
            {/select}
        {/exp:cartthrob:item_options}

    ...

{/exp:cartthrob:add_to_cart_form}

If I add to cart when logged out (and see an empty cart) - I can then log in, refresh the page and can see that the item is in the cart. If I then log out and refresh the page again, the cart shows as empty.

I've tried changing the redirection method in EE, setting the cookie domain... I haven't found anything that alters this behaviour so far.

1

Again: NOTE ExpressionEngine 2.8 + is REQUIRED to run CartThrob 2.6+ Lesser versions may be able to run CartThrob 2.6, but they are not supported.

A lot changed with session/security between 2.8 and 2.8 so it's probably not a big surprise you'll have issues in this area if you're on an older EE

| improve this answer | |
0

I also need to find a solution to this and found that it was a session issue. This was my fix:

File: cartthrob/libraries/Cartthrob_session.php

Replace $this->EE->input->set_cookie('cartthrob_session_id', '', -3600); on line 168 with:

if ( version_compare(APP_VER, '2.8', '>='))
{
    $this->EE->input->set_cookie('cartthrob_session_id', '', -3600);
}
else 
{
    $this->EE->functions->set_cookie('cartthrob_session_id', '', -3600);
}

And replace $this->EE->input->set_cookie('cartthrob_session_id', $this->session_id, $this->expires); on line 195 with:

if ( version_compare(APP_VER, '2.8', '>='))
{
    $this->EE->input->set_cookie('cartthrob_session_id', $this->session_id, $this->expires);
}
else 
{
    $this->EE->functions->set_cookie('cartthrob_session_id', $this->session_id, $this->expires);
}

Besides this I haven't yet seen any other major issues with CT2.6 installed on my EE2.7.3, so this fix may also apply to 2.7.0.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.