Forums / Templates, Stylesheets, Page Layout / How can I get a confirm message after adding to cart?

How can I get a confirm message after adding to cart?

Locked

Views: 1,825

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
19 Oct 2006, 2:24 PM
#1
m_and_s avatar

m_and_s

New Zenner

Join Date:
Oct 2006
Posts:
21
Plugin Contributions:
0

How can I get a confirm message after adding to cart?

Hi everybody!
I set the "Display Cart After Adding Product" to false in Admin->My Store section,
but I would like the client could see a** message ** (with javascript for example) that confirms the product was successfull added to his shopping cart.
Do someone have an idea how could I do that, for example using the same layer that appears to advise a form check failure while adding a product?
If you could tell me at least which files to check I would appreciate very much :yes:
Thank you

Music and Sons ipod/mp3 tees - WEAR YOUR MUSIC
http://www.musicandsons.it

19 Oct 2006, 2:49 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: How can I get a confirm message after adding to cart?

You would need to add a message to the: init_cart_handler.php

I would place it at the bottom of this IF statement:

  if (DISPLAY_CART == 'true') {
    $goto =  FILENAME_SHOPPING_CART;
    $parameters = array('action', 'cPath', 'products_id', 'pid', 'main_page');
  } else {
    $goto = $_GET['main_page'];
    if ($_GET['action'] == 'buy_now') {
      $parameters = array('action', 'products_id');
    } else {
      $parameters = array('action', 'pid', 'main_page');
    }
    $messageStack->add_session('header', SUCCESS_PRODUCTS_ADDED_TO_CART, 'success');
  }

Then define the message: SUCCESS_PRODUCTS_ADDED_TO_CART

Note: if time, I will play a bit with this for v1.3.6 as it would be helpful to have a meaning full message ... but I need to test based on errors and such what more may be needed under a baziilion conditions ...

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 Oct 2006, 2:53 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: How can I get a confirm message after adding to cart?

Note: test 1 item is not added due to error on required info ... you get the error message and the success message ...

Best to manage this with a paramater deeper in the code ...

Sorry to dash your hopes to heck ...

But, I will look into this further ...

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 Oct 2006, 10:09 AM
#4
m_and_s avatar

m_and_s

New Zenner

Join Date:
Oct 2006
Posts:
21
Plugin Contributions:
0

Re: How can I get a confirm message after adding to cart?

Thank you for your attempt and test...you helped me to understand how a message is dispatched and where to start looking at.
I changed the classes/shopping_cart.php file, adding the line of code with the message dispatch at the end of the "actionAddProduct" fuction, in case of no errors:

if ($the_list == '') {
	  $messageStack->add_session('product_info', SUCCESS_PRODUCTS_ADDED_TO_CART, 'success');
...

And it works :D

Music and Sons ipod/mp3 tees - WEAR YOUR MUSIC
http://www.musicandsons.it

20 Oct 2006, 1:13 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: How can I get a confirm message after adding to cart?

Actually, to avoid the message showing when there are errors for various issues this had to be added to the shopping_cart class ...

This has been added to the upcoming v1.3.6 to display a message when a product or products are added to the cart and the Display Shopping Cart is turned off ...

NOTE: The message displayed can also be disabled just by setting the defines for the two messages to '' in the language file ...

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!