Hi Everybody,
I think there is a serious bug in the VirtueMart SEF Extension.
I have the following original url : "index.php?option=com_virtuemart&category_id=7&flypage=my_flypage.tpl&manufacturer_id=1&page=shop.product_details&product_id=1"
It should be replaced by a Sef url.
There is a function called "getSefUrlFromDatabase(&$uri)" in VirtueMart SEF Extension's file "com_virtuemart.php" which, as its name suggest, tries to get a sef url from the database instead of original one.
It uses the following syntax for checking:
$query = "SELECT `sefurl` FROM `#__sefurls` WHERE `origurl` REGEXP '" . addslashes($regexp) . "'" . $where;
In my case it will be translated to:
SELECT `sefurl`
FROM `jos_sefurls`
WHERE `origurl`
REGEXP 'index\\.php\\?option=com_virtuemart&category_id=[^&]*&flypage=my_flypage\\.tpl&manufacturer_id=1&page=shop\\.product_details&product_id=1'
The problem is that the above mentioned syntax will result many rows if you have products with id begining with 1 like 1,11,13,14, ..,111 etc.
index.php?option=com_virtuemart&category_id=7&flypage=my_flypage.tpl&manufacturer_id=1&page=shop.product_details&product_id=11
index.php?option=com_virtuemart&category_id=19&flypage=my_flypage.tpl&manufacturer_id=1&page=shop.product_details&product_id=13
index.php?option=com_virtuemart&category_id=7&flypage=my_flypage.tpl&manufacturer_id=1&page=shop.product_details&product_id=14
index.php?option=com_virtuemart&category_id=7&flypage=my_flypage.tpl&manufacturer_id=1&page=shop.product_details&product_id=1
In this way the replaced sef url will be incorrect.
I think you should put the "$" pattern at the end of regexp:
$regexp.="$";
$query = "SELECT `sefurl` FROM `#__sefurls` WHERE `origurl` REGEXP '" . addslashes($regexp) . "'" . $where;
So it will be translated to:
SELECT `sefurl`
FROM `jos_sefurls`
WHERE `origurl`
REGEXP 'index\\.php\\?option=com_virtuemart&category_id=[^&]*&flypage=my_flypage\\.tpl&manufacturer_id=1&page=shop\\.product_details&product_id=1$'
I'm I correct?
I'm using the following configuration:
Joomla 1.5.15
VirtueMart 1.1.4
JoomSEF 3.6.2
JoomSEF VirtueMart SEF Extension 2.0.20