Author Topic: Problems with virtuemart products that are listed in multiple categories!  (Read 3420 times)

Nakke

  • Beginner
  • *
  • Posts: 7
I'm running my site with following config:

Joomla! version 1.5.8
VM 1.1.2.
sh404SEF build 147

Products on my site are often in multiple categories. sh404SEF pulls the new URL from the database, but links to the first added category.

Example:

Product: Nokia 5660
Categories: Cell Phones, On offer

If the "On offer" page is visited first, the URL for the product, no matter where it is linked from, will load the product page showing the category of "On offer". But, because 'Cell Phones' is the first category listed in the database, the URL will be

/cell-phones/nokia-5660

when it should be

/On-offer/Nokia-5660

So the problem is wrong URL on the product details page. This is a problem because my menu shows where you are in the site, so if you choose "on offer" category and example Nokia-5660, then the menu shows that you are in "cell-phones" category.

Anybody have any ideas?

Thanks

way

  • Beginner
  • *
  • Posts: 2
Re: Problems with virtuemart products that are listed in multiple categories!
« Reply #1 on: December 30, 2008, 03:46:56 am »
I met the same problem too. I tried to modify the following file

components/com_sh404sef/sef_ext/com_virtuemart.php

and purge the SEF Urls in back end, seems it works.

Add:
Code: [Select]
if (!function_exists('vmSefGetCatName'))
{
function vmSefGetCatName($catId)
{
$db = &JFactory::getDBO();
$query = "SELECT `category_name` \n".
         "FROM `#__vm_category` \n".
     "WHERE `category_id` = '". $catId ."'";
$db->setQuery($query);
$catName = $db->loadResult();
if (!empty($catName))
{
$catName = preg_replace("/(?:^[^0-9a-zA-Z]+)|(?:[^0-9a-zA-Z]+$)/", "", $catName);
$catName = preg_replace("/[^0-9a-zA-Z]+/", "-", $catName);
}
return $catName;
}
}
before
Code: [Select]
if (!function_exists('vmSefGetProductName')) {  // V 1.2.4.s
Change
Code: [Select]
if (isset($category_id))  // V 1.2.4.m
shRemoveFromGETVarsList('category_id');
to
Code: [Select]
if (isset($category_id)) { // V 1.2.4.m
$title[] = vmSefGetCatName($category_id);
shRemoveFromGETVarsList('category_id');
}

Hope it helps.

_fD_

  • Jr. Member
  • **
  • Posts: 118
    • Printdesign :: Joomla! CMS Webdesign :: Apple Computer Support
Re: Problems with virtuemart products that are listed in multiple categories!
« Reply #2 on: December 31, 2008, 18:10:20 pm »
Hello Way,

thank u for this fix. I cant copy it right and get parse error failures. Do u can insert here the file for downloading please?

Best regards, Urs