If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Notify Customer of Pre-Existing Items in Cart (merging guest and member carts)

Notify Customer of Pre-Existing Items in Cart (merging guest and member carts)

Locked

Started by dmfelder on 17 Feb 2007, 3:06 AM · Views: 3,184

Results 1 to 17 of 17
This thread is locked. New replies are disabled.
17 Feb 2007, 3:06 AM
#1
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Post #1 by dmfelder

When a customer logs out, anything in the cart is saved. The next time they come back and log in, the guest cart contents are merged with the previously saved items.

What is the best way to notify the customer that the contents of both carts were merged?

It seems odd, but if you haven't logged in and you add items to the guest cart, when you select checkout and log in (and the contents are merged), the customer is not immediately notified that there may be more in the cart than they expected.

Please advise.

THANKS!

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

17 Feb 2007, 3:21 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #2 by ajeh

The way to do this is to edit the file:
/includes/modules/pages/login/header_php.php

Around line 90 you will see:

Below that add:

      if ($_SESSION['cart']->count_contents() > 0) {
        $messageStack->add_session('header', WARNING_SHOPPING_CART_COMBINED, 'caution');
        // send to shopping cart for review
        zen_redirect(zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));
      }

This will then only take the customer to the shopping_cart with a message that their old cart was combined ...

You need to define WARNING_SHOPPING_CART_COMBINED somewhere for the message ...

NOTE: This has not been tested under every circumstance but should work the way you are wanting it ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Feb 2007, 12:02 AM
#3
sunabac avatar

sunabac

Zen Follower

Join Date:
Dec 2006
Location:
Summer:Ontaio, Winter:Texas
Posts:
211
Plugin Contributions:
0

Post #3 by sunabac

Ajeh:

The way to do this is to edit the file:
/includes/modules/pages/login/header_php.php

Around line 90 you will see:

Below that add:

  if ($_SESSION['cart']->count_contents() > 0) {
    $messageStack->add_session('header', WARNING_SHOPPING_CART_COMBINED, 'caution');
    // send to shopping cart for review
    zen_redirect(zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));
  }
> 
> You need to define WARNING_SHOPPING_CART_COMBINED somewhere for the message ...
> 
> NOTE: This has not been tested under every circumstance but should work the way you are wanting it ...

It would be nice if (where there are items left in the shopping cart from previous visit), after login, a shopping cart was loaded in with a message like:
These are items that are still in your shopping cart from your last visit.
18 Feb 2007, 12:05 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #4 by ajeh

That is what that constant is for ...

This has been added to the next release with a switch for:

OFF - do not display message
Yes - display message and go to shopping cart
Yes - display message and do not go to shopping cart

Groovy eh? :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

18 Feb 2007, 10:16 PM
#5
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Post #5 by dmfelder

Fantastic!

Is there a particular language/english file in which the constant should be defined, or can I just do it anywhere? (It seems like ZenCart loads pretty much every variable in the diretory, but I'd just like to be somewhat consistent.) login.php perhaps?

Thanks!

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

19 Feb 2007, 1:28 AM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #6 by ajeh

I am placing it in the main language file for:
/includes/languages/english.php

As this can be called from multiple pages ...

For now, you can do the same or use the
/includes/languages/english/extra_definitions/something.php

So you can easily remove it on the next upgrade and place it where it really belongs ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

19 Feb 2007, 6:21 PM
#7
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Post #7 by dmfelder

Thank you very much for your guidance on this. I implemented your solution and it definitely does what I asked, but I guess it doesn't do exactly what I had hoped.

I don't want to look a gift horse in the mouth here, but it seems to make more sense if the alert is displayed within the actual cart module rather than above the page header (where someone might not see it). Maybe a big alert just above or below "Shopping Cart Contents."

Am I over-thinking this? I just would prefer it to be blatantly obvious so that the customer isn't confused and wondering why they were redirected back to the cart after they clicked Check Out.

THANKS!

David

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

19 Feb 2007, 7:27 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #8 by ajeh

That is built into the next release ...

If you go to the Shopping Cart when the message is triggered it will be inside the page ...

Otherwise it will be in the header ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

20 Feb 2007, 5:24 AM
#9
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Post #9 by dmfelder

Strange. I did as you suggested, added the verbiage to the header_php.php page, and I redirect to the cart (using your redirect code). Nonetheless, the message was at the top of the header. (Is the header_php.php not the correct page?)

Was something perhaps missing from your post? You wrote, "Around line 90 you will see:" but nothing is below.

Anyway, I pasted your code over the existing code and now my /includes/modules/pages/login/header_php.php file reads:

$db->Execute($sql);
$zco_notifier->notify('NOTIFY_LOGIN_SUCCESS');

// restore cart contents
$_SESSION['cart']->restore_contents();


if ($_SESSION['cart']->count_contents() > 0) {
$messageStack->add_session('header', WARNING_SHOPPING_CART_COMBINED, 'caution');
// send to shopping cart for review
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'));
}


* if (sizeof($_SESSION['navigation']->snapshot) > 0) {
// $back = sizeof($_SESSION['navigation']->path)-2;
//if (isset($_SESSION['navigation']->path[$back]['page'])) {

*It seems to be redirecting to the cart just fine, but the message is way at the top of the screen. Am I not actually going to the cart when the message is triggered? It sure seems as if I am and all the items are displayed.

I put the definition in includes/languages/english.php. That shouldn't cause anything special.

Just a little confused.

Thanks. You are too nice to help with such menial issues.

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

20 Feb 2007, 5:29 AM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #10 by ajeh

I have the dual code in what I committed to manage when to put in the top and middle ... and you don't ... :P

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

21 Feb 2007, 5:14 AM
#11
dmfelder avatar

dmfelder

Zen Follower

Join Date:
Nov 2006
Posts:
102
Plugin Contributions:
0

Post #11 by dmfelder

LOL.

I have no idea what that means, but if I get a "tongue out" icon, it must be good.

I promise not to bother you (everyone) about this anymore after this, but what is dual code...and how do I get it? :lookaroun

I would love to just drop this in and go to bed. lol!

DMFelder | Visit GreatApparelForYou.com for Chicago Direct to Garment printing and Chicago Screen Printing and for Funny Tees and shirts go to gafy.com. We also have Eco-Friendly Printing services.

21 Feb 2007, 5:33 AM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #12 by ajeh

To make it work multiple ways ... would be more coding ... so for now ... suffer ... :eek:

But when the next release is out you will have the option for on the header of any page or take the customer to the cart and have the message in the body of the page ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Feb 2007, 4:03 PM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #14 by ajeh

lol ... don't worry ... we are working out little fingers to the bone to get out the next release ... just a few tweaks here and there ... test a few code methods for this and that ... :lamo:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Jul 2009, 11:25 AM
#15
calljj avatar

calljj

Zen Follower

Join Date:
Mar 2007
Posts:
253
Plugin Contributions:
2

Post #15 by calljj

Ajeh:

That is what that constant is for ...

This has been added to the next release with a switch for:

OFF - do not display message
Yes - display message and go to shopping cart
Yes - display message and do not go to shopping cart

Groovy eh? :cool:

I have this message on 1.3.8.a but cannot for the life of me find out where to turn it off, could you advise please.

Thanks

17 Jul 2009, 2:14 PM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Post #16 by ajeh

Peek in the Configuration ... Stock ... and you will find:

Show Notice of Combining Shopping Cart on Login
When a customer logs in and has a previously stored shopping cart, the products are combined with the existing shopping cart.

Do you wish to display a Notice to the customer?

0= OFF, do not display a notice
1= Yes show notice and go to shopping cart
2= Yes show notice, but do not go to shopping cart

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Jul 2009, 5:42 PM
#17
calljj avatar

calljj

Zen Follower

Join Date:
Mar 2007
Posts:
253
Plugin Contributions:
2

Post #17 by calljj

ahhh, kinda assumed that it would under the config..sessions section.

Thanks for pointing me in the right direction.