There is error in the VM router: when VM is used for only one language comes the following error "Assign the component VirtueMart to a menu item". To avoid this please replace line into router.php from
$query = 'SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language="'.$this->langTag.'")';
to
$query = 'SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language = "*" or language LIKE "'.$this->langTag.'")';
Due to the different character cases in the langTag, the original query does not work properly for those cases when a VM-component is assigned to the menu for only one language (not for "*").
Thx
2.0.3E - the same bug too :(
I have VM assigned to a menu item for Russian only and VM router reports "Assign the component VirtueMart to a menu item".
Hi Lysov,
please check your menu item links in DB. Slash in query you added indicates some malformed path I think...
Can you review this?
Thx
The sign "backslash" only escapes the question mark (mysql it extends to any character). But the main thing is that the equal sign in the query is incorrect, in my case, using LIKE operator, I get a non-empty result set, and the use of "=" the empty result set is empty. And searching by the messages on the forum I am not alone in facing the situation "Assign the component VirtueMart to a menu item" and non-working router. Try this by phpMyAdmin with only one language (without the lang "*")
After a system upgrade (to version 5.5.21 Mysql and php to version 5.3.10) were both queries return the same result set! But you should still use my version of the query - it works correctly on older versions of software (5.5.20 and 5.3.9).
With the "\?", I made a mistake, but the operator LIKE should be used instead "=". The correct version of the query is
$query = 'SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language LIKE "*" or language LIKE "'.$this->langTag.'")';
It does not make a sense to me. Asterisk is not a wildcard, so if = or like is used odes not matter ( like "*" yelds the same results as ="*")
So then this can only be true if the lang tag is different in case ( ru instead of RU)?
Can you check this?
Yeah, I've already checked. The sign "=" and the operator LIKE is not always the same thing, that's the whole point - http://stackoverflow.com/questions/1003381/difference-between-like-and-in-mysql. Specifically in my case, when using MySQL version 5.5.20 (and php 5.3.9), the query works properly with using LIKE operator. This was the reason for creating topic: I was puzzled that the system is requested to assign a link in the menu for the VM.
Subrelease VirtueMart 2.0.3H: why you do not like the operator "LIKE"?
VirtueMart 2.0.5 rc
MySQL: 5.5.21
PHP: 5.3.10
There is my query (from vmdebug()):
SELECT * FROM `vm_without_bugs_menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language="ru_ru")
It returns empty result set. Неre is my data (attached) - the lang tag is 'ru-RU', not 'ru_ru':
119 mainmenu The First step first-step catalog/first-steps index.php?option=com_virtuemart&view=category&virt... component 1 120 2 10082 0 0 0000-00-00 00:00:00 0 1 1 {"menu-anchor_title":"","menu-anchor_css":"","menu... 16 17 0 ru-RU
The query should be
SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language LIKE "ru_ru")
[attachment cleanup by admin]
VM 2.0.6
With the update of each new release I have to edit the router.php
Up - VM 2.0.7
There will be 2 months soon ...
Up: 207E
It took three months...
208с the same...
Should I hope this correction?
VM v2.0.8d released and I'm still having the same issue shown here...
J! 2.5.6
MySQL 5.5.24
PHP 5.3.14
Hi there I'm getting the same error, but I'm not sure if it is the same case or a variant.
I have my menu item for all languages, the content of the products is there just in spanish. I can see the categories and access virtuemart from the menu, but I cant see the product pages, I get a 500 error on the log as you I get [10-Sep-2012 08:10:23 UTC] PHP Fatal error: Cannot access empty property in path-to-joomla/libraries/joomla/registry/registry.php on line 336
I made the change you did to the router with no luck....
If I turn of Joomla's SEF I can see the product page.
any ideas are welcome and appreciated.
Same here after update to 2.0.12b.
When i click on Ask a question i get: "Fatal error: Cannot access empty property in /libraries/joomla/registry/registry.php on line 336".
To avoid the message COM_VIRTUEMART_ASSIGN_VM_TO_MENU you need change the line #951 at the components/com_virtuemart/router.php from
$query = 'SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language="'.$this->langTag.'")' ;
to
$query = 'SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language LIKE "'.$this->langTag.'")';
VM 2.12f: I'd rather not say
For General non-technical Public may follow the following solution. I was deeply lost reading this form. Thanks i did not alter Code.
[SOLVED]
Go to the 'Menus > Menu Manager > Main Menu' to create a menu item for your VirtueMart shop.
Quote from: naseemj2 on October 25, 2012, 06:36:21 AM
For General non-technical Public may follow the following solution. I was deeply lost reading this form. Thanks i did not alter Code.
[SOLVED]
Go to the 'Menus > Menu Manager > Main Menu' to create a menu item for your VirtueMart shop.
Your solution is not always acceptable. Do you have multilanguage site? There is router bug, the right decision - to build the correct SQL-query.
Quote from: lysov on October 20, 2012, 12:57:30 PM
To avoid the message COM_VIRTUEMART_ASSIGN_VM_TO_MENU you need change the line #951 at the components/com_virtuemart/router.php from
$query = 'SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language="'.$this->langTag.'")' ;
to
$query = 'SELECT * FROM `#__menu` where `link` like "index.php?option=com_virtuemart%" and client_id=0 and published=1 and (language="*" or language LIKE "'.$this->langTag.'")';
lysov you are in the developer chat, why you never mentioned it? Why do you lament and cry here and in the meantime chatting with me and not saying anything? I think most people do not imagine how many posts are written on this board. I cannot and I must not check the forum daily. If I would do that, the core would be like march 9 months ago, because instead of developing I would answer alll the time posts, explaining that the bug is not fixed, because I am answering. If there is a problem and an unanswered thread, write a pn, ask me skype, that is the reason that we have this developer chat.
and I read your explanations and we do with the language tag this:
self::$_jpConfig->lang = strtolower(strtr($siteLang,'-','_'));
So if you need a like, then there is something else broken and using LIKE is bad, because it is slowing down the query, therefore I did not add it yet. Additionally others solve the problem just assigning an menu item, because 99% of people need it anyway.
So and before I fix something for free for just 1% of vm users,then I prefer to fix something for free which helps 50% of vm users, that is just a lot more economic.
WOW - Is it really only 1 percent of VM users who have a multilingual site??
Thanks lysov, your fix saved my day on a multilingual site witch indeed had menu items for VM, but still throw out the annoying error message.
#someoneblindfolded
Not at all. Have to wait until it's developers will make a small correction. I am surprised at their tenacity