Author Topic: Uri parse with category ID  (Read 1011 times)


  • Beginner
  • *
  • Posts: 18
Uri parse with category ID
« on: December 16, 2021, 16:05:19 pm »

I was helping a user who have problem on switching with Falang on the same product to another language.
It was working before without problem.

The user don't use id for category and product. from a category page when you click on the product all work fine but the language switcher don't build the right url.

The problem is during the parse of the url, the category is not set in the vars (virtuemart_category_id), the category should be get from the menu ItemId or the category of the product displayed.

in the file
the function line 1256
public function getProductId($names,$catId = NULL, $seo_sufix = true ){...}

i have to change the fuction like this ()
Code: [Select]
$prodIds[$hash]['virtuemart_product_id'] = $this->getFieldOfObjectWithLangFallBack('#__virtuemart_products_', 'virtuemart_product_id', 'virtuemart_product_id', 'slug', $productName);
if(empty($categoryName) and empty($catId)){
$prodIds[$hash]['virtuemart_category_id'] = false;
} else if(!empty($categoryName)){
$prodIds[$hash]['virtuemart_category_id'] = $this->getCategoryId($categoryName,$catId ) ;
} else {
//$prodIds[$hash]['virtuemart_category_id'] = false;
                $prodIds[$hash]['virtuemart_category_id'] = $catId;//changed line

the $catId is passed to the function but false is stored , i don't know why.

$prodIds[$hash]['virtuemart_category_id'] = false;
and not
$prodIds[$hash]['virtuemart_category_id'] = $catId;

The user use the embeded multilanguage for all products/categories .... and falang for menu/module/article....



  • Beginner
  • *
  • Posts: 2
  • A beginner
Re: Uri parse with category ID
« Reply #1 on: January 04, 2022, 13:21:25 pm »
Same Problem ♥