VirtueMart Forum

VirtueMart 2 + 3 + 4 => Language/Translations => Topic started by: gallego.d on December 01, 2021, 14:50:25 PM

Title: (SOLVED) bug, enabling seo shows wrong language on category page but not prod.
Post by: gallego.d on December 01, 2021, 14:50:25 PM
Hi all, I just post this here in hopes of avoiding someone else the trouble of finding this,
I don't know if it's a general issue or just one of our custom installs (no code modified, I say custom in the sense that it's a full website with other plugins - themes),

The thing started a couple of versions back (3.x, we suspect 3.2-3.4), and as a result, any one who visited the shop in a non-main language, would see the category page (category description and product names) in the main shop language (in this case es-ES), for instance, visiting one of the categories in /en/ would print the /es/ version,. even when having all content translated, fully working language switcher, home menus, etc...

We found out that (at least in our case) the problem can be fixed by 'overriding' the setLangByTag function in admin/com_virtuemart/helpers/vmlanguage.php (around line 84), by adding :
$siteLang=JFactory::getLanguage()->getTag();

at the start of the function, since we noticed (vmdebuggin) that some part of the VM was trying to set the language to the main (es-ES) somewhere between start and the getChildCategoryListObject which loads the data,

as we understand, this obviates the lang tag passed and always sets the current joomla language as the language for VM

we don't fully know if this could cause some issue with any other (or even our) install, but if it's being looked at, or if this can help fix (what we refer as, but maybe not be a) bug I'd be happy to explain in more detail the testing we used to arrive to this line, or if these changes need to get somewhere (i.e. bugs panel somewhere?).


Also, Thanks to all the community for an amazing ecommerce platform!!
Title: Re: (SOLVED) bug, enabling seo shows wrong language on category page but not prod.
Post by: GJC Web Design on December 01, 2021, 15:10:31 PM
Just to say thank you for the report and I'm sure Max will have seen this ...