AJAX(Javascript)-based "add to cart" button Bug

If you turn off the AJAX(Javascript)-based “add to cart” button it does not show the cart when you add an item to the cart. It just stays on the same page.

For me is diferent

if AJAX(Javascript)-based “add to cart” is turn on add to cart is OK but when I want to Checkout = cart empty



AJAX(Javascript)-based “add to cart” is turn off all work corectly

New version looks promising, but same problem for me;



Ajax add to cart enabled = Add to cart ok but empty cart on view cart/checkout



Ajax add to cart disabled = Works ok but after adding an item to the cart the page doesn’t change. It would be better to go to view cart as per previous versions.



I find older users and stores with large ticket items benefit most from this “add to cart → view cart → checkout or continue” checkout flow.



[url]http://www.mjdwebdesign.com.au/cscart2beta1/[/url]

[quote]

New version looks promising, but same problem for me;



Ajax add to cart enabled = Add to cart ok but empty cart on view cart/checkout



Ajax add to cart disabled = Works ok but after adding an item to the cart the page doesn’t change. It would be better to go to view cart as per previous versions.



I find older users and stores with large ticket items benefit most from this “add to cart → view cart → checkout or continue” checkout flow.

[/quote]

Sorry for this error.



It occurs if Mysql type equal to 41 is specified in the configuration,

namely in the following file [CSCART_ROOT_DIR]/config.php



It is necessary to change the value $config[‘db_type’] in line 176.



[B]old code:[/B] $config['db_type'] = 'mysql41';




[B]new code:[/B] $config['db_type'] = 'mysql';




This error will be fixed.

Let me apologize for it once again.

Thanks Isergi, that works great now. :smiley:

You are welcome! :wink:

Hi,

Does this fix apply to all versions including 2.0 Beta?

Thanks,

Bob

[quote name=‘pbannette’]Hi,

Does this fix apply to all versions including 2.0 Beta?

Thanks,

Bob[/QUOTE]



Hi Pbannette,



This problem exists in 2.0 only.

[quote name=‘isergi’]Hi Pbannette,



Yes. This fix will be added to CS-CART 2.0 version.[/QUOTE]



This fixed the AJAX for me too. Apparently I was looking at my 1.35 config.php rather than the 2.0 version.



However, each time I click this (in AJAX mode) it adds 2 items to the cart instead of one. Great for sales, but customers don’t appreciate it! :wink: [url]http://forum.cs-cart.com/images/smilies/icon_wink.gif[/url]

:wink:

[quote name=‘Triplets’]If you turn off the AJAX(Javascript)-based “add to cart” button it does not show the cart when you add an item to the cart. It just stays on the same page.[/QUOTE]



If Ajax add to cart disabled, then after adding a product to the cart there will be redirection to the page where the “Add to cart” button was clicked. This is a default functionality of CS-Cart version 2.0.

[quote name=‘tbirnseth’]

However, each time I click this (in AJAX mode) it adds 2 items to the cart instead of one. Great for sales, but customers don’t appreciate it! :wink: :wink:

;)[/QUOTE]



This is an error which occured in CS-Cart 2.0 beta version, when in Administration settings the Number of columns in the product list is set to more than 1.

We will definitely fix it.

Thank you.

Yes, it does/will go to the cart page.

Matt,

This is re-occurring spam. It’s best to report it so the moderators can remove it.

Hi Isergi,



Ajax functions work with CS-Cart 1.3.5 with Proxomitron anti-popup turn on.



Ajax functions doesn’t work with CS-Cart 2.0 with Proxomitron anti-popup turn on.



Proxomitron is very famous on my market, and a lot of my customers use it.



Isergi, can you fix it please?







Thank you so much!







Lee Li Pop

Dear Lee Li Pop,



If you want to fix it, you need to edit a file, namely:



[CSCART_ROOT_DIR]/core/class.ajax.php at line 135.



Old code:


session_write_close();
// Return json object
echo '{text: ' . $this->php2js(trim($text)) . ', data : ' . $this->php2js($this->_result) . '}';




New code:


session_write_close();
header('Content-type: application/json'); // <-- What you need to do is just to add this line here.
// Return json object
echo '{text: ' . $this->php2js(trim($text)) . ', data : ' . $this->php2js($this->_result) . '}';




I am always glad to help you. :wink:

Hello Isergi,



I saw now, CS-Cart 2.0 works perfectly with Proxomitron!







Isergi, you are the best!







Lee Li Pop

Thanks a lot! I do appreciate that! And I’m really glad that you find CS-Cart 2.0 great!

I’m pleased to be of service to you.

Sincerely yours, isergi.

Hi isergi,


[QUOTE]If Ajax add to cart disabled, then after adding a product to the cart there will be redirection to the page where the “Add to cart” button was clicked. This is a default functionality of CS-Cart version 2.0[/QUOTE]



Where can I change this behaviour so that the user is being redirected to the Cart content?



Another thing; I think there’s a bug in 2.0.2 when using SEO Addon. After clicking on a Order-button the page is redirected to the same location, but with an extra slash after the domain. Example:



[url]http://www.domain.com/category-167/category-169.html[/url]

is redirect to:

[url]http://www.domain.com//category-167/category-169.html[/url] which results in a error page



I think it has to do with the fn_convert_php_urls function in /addons/seo/func.php on line 365. If I uncomment the following rule, everything works fine:

$prefix = fn_seo_get_current_path() . '/' . ((Registry::get('addons.seo.seo_language') == 'Y') ? (strtolower(CART_LANGUAGE) . '/') : '');

Hi studio-web,


[quote name=‘studio-web’]

Where can I change this behaviour so that the user is being redirected to the Cart content?

[/QUOTE]





For this purpose you should:

1) First of all disable “Ajax add to cart”

2) In the following file:

[SIZE=“2”][CSCART_ROOT_DIR]/skins/[YOUR_SKIN_NAME]/customer/views/products/components/buy_now.tpl [/SIZE]

delete the code from line 33 till 35.


{if !$stay_in_cart}

{/if}





[quote name=‘studio-web’]

Another thing; I think there’s a bug in 2.0.2 when using SEO Addon. After clicking on a Order-button the page is redirected to the same location, but with an extra slash after the domain.

[/QUOTE]



We are aware of this bug and you can be assured that it will be fixed in the nearest future. There will be no such bug in the next update.

isergi thanks for that last tip - I was getting frustrated the page would not redirect to the Cart.



I realize this is not ‘tech support’ but since we are on a subject relating to the Cart, why is there a drop-down “Click here for more options” under each product on the Cart page - why would additional options be hidden by default instead of just showing them? Surely space is not an issue?



Not sure about anyone else but I would rather not give customers any more things to get frustrated about and just show the additional options by default, just as they would see these options on the product page. Any suggestions how I can make this appear by default?