Jump to content
Latest News: (loading..)
honda4

<product> has been added to your Cart: I don't want this....

Recommended Posts

Hi, I am running BS osCommerce Online Merchant v2.3.4.1.

After adding a product in the product listing, I get a green banner saying "<product> has been added to your Cart"

Also, the page refreshes and goes to the top.

I prefer not to have these two options. Is there a simple way to have them "gone"?

It looks like it all is happening in application_top.php, but just editing this file without comprehensive knowledge is a bit risky to me....

Cheers, Rene

(sorry was unable to remove the <b>)

 

 


Not too experienced, but very willing to learn.

Share this post


Link to post
Share on other sites

That depends which version of osC BS exactly you have. I guess in your case the EDGE version?
If yes, then to remove that green message just uncomment the messagestack part in the buy_now case inside the application_top.php file

FIND
 

      case 'buy_now' :        if (isset($_GET['products_id'])) {
                                if (tep_has_product_attributes($_GET['products_id'])) {
                                  tep_redirect(tep_href_link('product_info.php', 'products_id=' . $_GET['products_id']));
                                } else {
                                  $cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id'])+1);
                                  $messageStack->add_session('product_action', sprintf(PRODUCT_ADDED, tep_get_products_name((int)$_GET['products_id'])), 'success');
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;

REPLACE WITH THIS
 

      case 'buy_now' :        if (isset($_GET['products_id'])) {
                                if (tep_has_product_attributes($_GET['products_id'])) {
                                  tep_redirect(tep_href_link('product_info.php', 'products_id=' . $_GET['products_id']));
                                } else {
                                  $cart->add_cart($_GET['products_id'], $cart->get_quantity($_GET['products_id'])+1);
                                  //$messageStack->add_session('product_action', sprintf(PRODUCT_ADDED, tep_get_products_name((int)$_GET['products_id'])), 'success');
                                }
                              }
                              tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                              break;

If you use the Frozen version then you can either create a new buy_now action module to avoid core code changes or just do the same thing I showed above inside the existing buy_now action module.

Regarding the page reload that is a different story. osC needs to refresh the page to pass on the paramaters, I think. Using this code here
 

tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));

If you don't want a page reload then my guess would be to use AJAX but that is not easy like 1,2,3. You will have to either hire someone to code that for you or search the forum if someone has ever done such work in the past.

Edited by Tsimi

Share this post


Link to post
Share on other sites

Thanks Tsimi! This worked.

I am not sure if I am running the frozen version, I remember the discussion about this however. We installed in feb 19th this year.

About the reload: I was afraid I would get an answer like this.....

Since I have some long product listings in my shop, it would be nice if the reload just wouldn't happen. But just nice....

Anyway, half of my issue solved within 60 minutes: Long live this forum!


Not too experienced, but very willing to learn.

Share this post


Link to post
Share on other sites

In your Admin Area there is a setting that allows the redirect to cart to be turned off.

You can try that, it still refreshes but stays on the page the buy button is on.

As an alternative, as @Tsimi rightly says, you could try Ajax.
I experimented with something, you can try it http://template.me.uk/234bs3/index.php - this is just to prove it is do-able, it is not currently available as an addon.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest current code (community-supported responsive 2.3.4.1BS Edge) here

 

Share this post


Link to post
Share on other sites

Ah, both look exactly what I would need.

Gary, what you shop on the sample shop is a very nice upgrade indeed!

I will look into these add-ons coming month, when evenings become longer and buisiness slows down :-).


Not too experienced, but very willing to learn.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×