Author Topic: Wrong category ID  (Read 3235 times)

novator

  • Beginner
  • *
  • Posts: 30
Wrong category ID
« on: June 30, 2009, 14:34:18 pm »
I have used that hack:

Code: [Select]
1. administrator/components/com_virtuemart/classes/ps_session.php

2. go to +/- line 497 where it says: $Itemid = "&Itemid=".$this->getShopItemid();

3. REPLACE THIS LINE with their code:

// Original Virtuemart Code:
// $Itemid = "&Itemid=".$this->getShopItemid();
// VM-Expert Hack – Start
if(!strpos($text, "category_id="===false)) {
parse_str(str_replace("amp;","",$text),$tk_arr);
if($tk_catid=intval($tk_arr['category_id'])) {
$db = new ps_DB;
$db->query("SELECT id from #__menu where link like '%option=com_virtuemart%' and params like '%category_id=$tk_catid%' and published=1");
if( $db->next_record() ) $result = $db->f("id");
/*
The same with Joomla-DB-Class: $db =& JFactory::getDBO();
$db->setQuery("SELECT id from #__menu where link like '%option=com_virtuemart%' and params like '%category_id=$tk_catid%' and published=1");
$result=$db->loadResult();
*/
if ($result) $tk_itemid=$result;
}
}
$Itemid = "&Itemid=" . ($tk_itemid ? $tk_itemid : $this->getShopItemid());
// VM-Expert Hack - End

and it's almost fix all problem with wrong category id:
1) Main-menu module (work ok)
2) Browsing VM categories in component (works ok)
3) Ask about product in fly-page (works ok)
4) Top 10 module (works ok (except when I press call for pricing))

Problem still in:
1)Search module
2)Next Prev product
3)Call for pricing form (in module and in fly and browse page)

What I can do to fix that last 3 problems. I check links in my website and saw, what Itemid is not correct:
Code: [Select]
OK
http://www.xxx.lt/index.php?page=shop.product_details&category_id=10&flypage=flypage-ask.tpl&product_id=60&option=com_virtuemart&Itemid=66

OK
http://www.xxx.lt/index.php?page=shop.product_details&flypage=flypage-ask.tpl&product_id=60&category_id=10&option=com_virtuemart&Itemid=66

BAD
http://www.xxx.lt/index.php?page=shop.ask&product_id=60&subject=D%C4%97l+kainos+teirautis%3A+HDR+SR10&option=com_virtuemart&Itemid=1


aomegax

  • Beginner
  • *
  • Posts: 9
Re: Wrong category ID
« Reply #1 on: October 25, 2009, 13:54:42 pm »
your hack works for me too!!! but search doesn't work...there are news about?