Magento – persistent shopping cart disadvantages

magento-1.7persistentshopping-cart

Hi I'm wondering if there are any disadvantages when using persistent shopping cart in magento? If I do enable this are people forced to create an account and no longer check out as guests ?
Thanks

Best Answer

@Marius while you would expect that to be logical in reality there is an edge case where the guest checkout option is disabled.

Replication

  • Logged in customer adds items to basket
  • Customer closes browsers
  • Website session times out kill var/session directory
  • Customer opens browser adds items to basket as guest.
  • Guest checkout it hidden.

Cause

An event called checkout_allow_guest is fired by Mage_Checkout_Helper_Data::isAllowedGuestCheckout()

This then observed by Mage_Persistent_Model_Observer::disableGuestCheckout() which disables the option to use guest checkout.

The cause of which is that the session is loaded by Mage_Persistent_Helper_Session::isPersistent() with the value of the persistence cookie:

    if (is_null($key)) {
        $key = Mage::getSingleton('core/cookie')->get(Mage_Persistent_Model_Session::COOKIE_NAME);
    }

Fix - Disabled event observer

You will need to create a new module with two files.

app/code/local/JZah/AllowPersistentGuestCheckout/etc/config.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <JZah_AllowPersistentGuestCheckout>
            <version>0.1.0</version>
        </JZah_AllowPersistentGuestCheckout>
    </modules>
    <frontend>
        <events>
            <checkout_allow_guest>
                <observers>
                    <persistent>
                        <type>disabled</type>
                    </persistent>
                </observers>
            </checkout_allow_guest>
        </events>
    </frontend>
</config>

app/etc/modules/JZah_AllowPersistentGuestCheckout.xml:

<?xml version="1.0"?>
<config>
    <modules>
        <JZah_AllowPersistentGuestCheckout>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <Enterprise_Persistent/>
            </depends>
        </JZah_AllowPersistentGuestCheckout>
    </modules>
</config>

Created for Magento EE 1.14.1.0

Related Topic