Jump to content

[Resolved] View Cart/basket for logged in users


BullishD

Recommended Posts

I have recently started to use CubeCart  (Version 6.0.12).  I have based my skin off of foundation, and everything so far is set up and working as expected except for one piece.     Logged in users cannot view their cart, and are forced to go to the checkout page to view/edit their cart contents.   (.../index.php?_a=basket gets automatically redirected to .../index.php?_a=confirm).    basically, logged in users skip step 1 of the  "1. cart / 2. checkout / 3. complete" process.  The process works as expected for guests.

I understand that users have all the functionality of the 'basket' page on the checkout page, but this is not the expected behaviour for users and will cause confusion.   This redirect behaviour breaks "the principal of least astonishment", as the standard flow of ecommerce websites, is to view/edit cart, and then move to checkout.  I would like to maintain this standard/expected process for my customers (even if it means extra clicks for them)

I would like to remove this redirect for logged in users but have not been able to isolate where this is happening in the code.     Can someone point me in the right direction on where I will find the redirect so I can remove it. 

I should note that in the "your basket" box I only display the 'View Basket' button for both guests and logged in users. 

Thank you! 

 

Forgot to add, that I want to thank the developers for all their hard work on cubecart, it is very much appreciated!   

Edited by BullishD
Mark title as [Resolved]
Link to comment
Share on other sites

Welcome BullishD! Glad to see you made it to the forums.

I haven't done what you are trying to do. The most I have done in this regard is to simply add back the "View Cart" button to the Shopping Basket box for logged in customers. I recall this didn't do much as CubeCart is coded to bounce the user to 'confirm' if CubeCart simply knows that the billing address is a valid address for the customer/visitor - for both the "logged in" and "not logged in" states.

We start with CubeCart->loadPage(). If arriving by 'checkout' or 'confirm', do _checkout().

In _checkout(), if the user is not logged in, then make for showing the form to collect shipping data. Otherwise, show the customer's shipping data.

Back at loadPage(), execution moves to, or if arriving by 'basket' or 'cart', do _basket().

In _basket(), if CubeCart arrived here from 'basket' and has a valid billing address, bounce to 'confirm' and we are back at _checkout().

Otherwise, do _displayBasket().

So, you want logged in customers, arriving from 'basket', to execute _basket(), then _displayBasket(), without first bouncing to 'confirm'.

Try:

In the file /classes/cubecart.class.php, near line 629:

Find:

if ($GLOBALS['user']->is() && in_array($_GET['_a'], array('basket', 'cart'))) {

Change to:

if (false && $GLOBALS['user']->is() && in_array($_GET['_a'], array('basket', 'cart'))) {

Test extensively.

Well, that worked the first time, but not the second.

Also:

Near line 582:

Find:

if ($_GET['_a'] == 'basket' && $this->_basket['billing_address']['user_defined']) {

Change to:

if (!$GLOBALS['user']->is() && $_GET['_a'] == 'basket' && $this->_basket['billing_address']['user_defined']) {

 

Link to comment
Share on other sites

Ok, I was just able to test this, and the code works great, I only made one slight change.     The complete change below.  (including your recommendations)

In the file /classes/cubecart.class.php, near line 587
I changed
		if ($_GET['_a'] == 'basket' && $this->_basket['billing_address']['user_defined']) {
			httpredir('index.php?_a=confirm');
		}
to
		if (false && $_GET['_a'] == 'basket' && $this->_basket['billing_address']['user_defined']) {
			httpredir('index.php?_a=confirm');
		}

i added

if (false &&

 instead of what you had

if (!$GLOBALS['user']->is() && 

because of the case where it is a guest user, and they fill in their address in the checkout page, but decide to go back to home (or elsewhere) and eventually hit 'view basket' again.   with the ['user']->is() statement, it would send them directly to checkout, where I would still like them to head to the 'basket' first.    So, I removed the redirect completely by adding if (false... condition.     Unless you see another reason that i am not to keep the ['user']->is() part of the condition.  (I am new to cubecart so may be missing something) i will stick with the 'false' condition.

Then I followed your code exactly (copied again here)

In the file /classes/cubecart.class.php, near line 629:

Find:

if ($GLOBALS['user']->is() && in_array($_GET['_a'], array('basket', 'cart'))) {

Change to:

if (false && $GLOBALS['user']->is() && in_array($_GET['_a'], array('basket', 'cart'))) {

bsmither,   thank you very much for your help on this.      I am going to run a few more scenarios through but as it stands right now, I am confident in the result. 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...