News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Virtuemart 2 - serious add to cart cart bug

Started by Artanis, March 19, 2012, 15:43:36 PM

Previous topic - Next topic

Artanis

Hello!

I'm using Joomla 2.5 with Virtuemart 2.0.3, and also three language packs installed on site and VM2.
There is serious problem with "Add to cart" feature - if user language is not set to English, first product he tries to add to cart is not added - instead empty cart shows up, and language of the site switches to english (which is set as default for non-registred members). Then, when site have self-switched to default english, all next products are added to cart normally.

I have to find solution for this problem, because if client tries to order something, and they see empty cart and language switches spontaneously, they most likely wont try again and will leave my shop.

EDIT: as far I know, most probably problem is caused by this line in components/com_virtuemart/controllers/cart.php :

$continue_link = JRoute::_('index.php?option=com_virtuemart' . $categoryLink);

Because the "JRoute::_" seems to always be default language.
E.g. - if my shop link is "mydomain.com/index.php/ru/shop" than after clicking "Add to cart" it redirects to "mydomain.com/index.php/en/shop"

Please let me know, how to resolve this issue.
Best regards, Arthur

[attachment cleanup by admin]
Animus Project - Design Studio
Running Joomla 2.5.6, Virtuemart 2.0.6a, PHP 5.3.10

jjk

#1
That's probably because from what I see in your images, you didn't set a link to the cart in your Joomla menu. If you have i.e. 3 languages, you need links to your categories and your cart in all three languages, because the Joomla language switcher works with the menu items.

And of course the "Continue Shopping" and "Show Cart" strings have to be translated for example in your frontend ru-RU.com_virtuemart.ini

The orginal en-GB keys/strings are:
COM_VIRTUEMART_CART_SHOW="Show Cart"
COM_VIRTUEMART_CART_SHOW_MODAL="Show Cart"
COM_VIRTUEMART_CONTINUE_SHOPPING="Continue Shopping"
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

Artanis

Jjk - thank You very much once more. You suggestion partly solved my problem, and my workaround solved it completly. :)

So -

Aside from what jjk said - that link to Shop must be in each language's menu, there are one more bit - it seems that after selecting language you have to wait couple seconds (maybe some cache rebuild or JavaScript execution in background), and if you don't click on "add to cart" button in the second right after language selection, than it works ok.

My solution - simple Javascript, that fades "Add to cart" button three seconds after product detail page is loaded, so no chance that hastily buyers won't face up empty cart when clicked on "Add to cart" right after language selection! :)
Animus Project - Design Studio
Running Joomla 2.5.6, Virtuemart 2.0.6a, PHP 5.3.10