VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: lysov on March 16, 2012, 20:38:48 PM

Title: VM 202 - 2.0.20b - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: lysov on March 16, 2012, 20:38:48 PM
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
Title: Re: VirtueMart 2.0.3D BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on March 16, 2012, 21:54:09 PM
 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".
Title: Re: VirtueMart 2.0.3D BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: osp on March 19, 2012, 20:40:36 PM
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
Title: Re: VirtueMart 2.0.3D BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on March 22, 2012, 11:12:52 AM
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 "*")
Title: Re: VirtueMart 2.0.3D BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on March 22, 2012, 11:45:39 AM
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).
Title: Re: VirtueMart 2.0.3D BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on March 23, 2012, 04:42:09 AM
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.'")';
Title: Re: VirtueMart 2.0.3D BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: osp on March 23, 2012, 08:02:31 AM
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?
Title: Re: VirtueMart 2.0.3D BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on March 24, 2012, 15:30:12 PM
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.
Title: Re: VirtueMart 2.0.3D BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on March 30, 2012, 10:10:31 AM
Subrelease VirtueMart 2.0.3H: why you do not like the operator "LIKE"?
Title: Re: VirtueMart 2.0.5 BUG - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on April 13, 2012, 10:54:38 AM
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]
Title: Re: VirtueMart 2.0.6 - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on April 17, 2012, 09:05:20 AM
VM 2.0.6
With the update of each new release I have to edit the router.php
Title: Re: VirtueMart 2.0.6 - COM_VIRTUEMART_ASSIGN_VM_TO_MENU <-- IMPORTANT & NEW
Post by: lysov on May 03, 2012, 07:50:34 AM
Up - VM 2.0.7
There will be 2 months soon ...
Title: Re: VirtueMart 2.0.7E - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: lysov on June 12, 2012, 07:46:25 AM
Up: 207E
It took three months...
Title: Re: VM 204 - 208 - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: lysov on July 06, 2012, 12:39:26 PM
208с the same...
Should I hope this correction?
Title: Re: VM 204 - 208 - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: lysov on July 14, 2012, 08:47:51 AM
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

Title: Re: VM 204 - 208 - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: fedster on September 10, 2012, 10:31:50 AM
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.
Title: Re: VM 204 - 208 - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: DaggaTora on October 18, 2012, 11:07:29 AM
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".
Title: Re: VM 204 - 212d - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: 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.'")';
Title: Re: VM 202 - 212f - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: lysov on October 23, 2012, 10:50:10 AM
VM 2.12f: I'd rather not say
Title: Re: VM 202 - 212f - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: 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.
Title: Re: VM 202 - 215a - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: lysov on December 04, 2012, 03:12:28 AM
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.
Title: Re: VM 202 - 215a - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: Milbo on December 18, 2012, 17:07:25 PM
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.
Title: Re: VM 202 - 215a - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: Rune Rasmussen on February 27, 2013, 15:02:15 PM
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
Title: Re: VM 202 - 2.0.20b - COM_VIRTUEMART_ASSIGN_VM_TO_MENU
Post by: lysov on April 03, 2013, 08:06:54 AM
Not at all. Have to wait until it's developers will make a small correction. I am surprised at their tenacity