VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: zenza on July 28, 2016, 15:52:42 PM

Title: How to add categories on product link canoncial
Post by: zenza on July 28, 2016, 15:52:42 PM
Canoncial url by default refers to the most minimum category and how to make that he referred to a subcategory (i.e. to big category), i.e. instead of sitename/category/item.html, there was sitename/category/subcategory/item.html?
Title: Re: How to add categories on product link canoncial
Post by: Jaspers on August 03, 2016, 11:40:26 AM
As i understand if your product is asigned both to category and subcategory, and if you have a menu, which leads to the virtuemart category and subcategory at the same time - the canonnical url will choose the category menu link. So if you choose for product only subcategory - everything will work properly. But i need product to be choosen both category and subcategory.
I Suffer with this question 10 days already. There is no answer anywhere  :(
Title: Re: How to add categories on product link canoncial
Post by: GJC Web Design on August 03, 2016, 12:27:41 PM
how about trying the extended query to show subcat prods if in parent

see models -> product.php from around line 367

if ($virtuemart_category_id > 0) {
         $joinCategory = TRUE;
         if(true){
            $where[] = ' `pc`.`virtuemart_category_id` = ' . $virtuemart_category_id;
         } else {
            /*GJC add subcat products*/  etc
Title: Re: How to add categories on product link canoncial
Post by: Jaspers on August 03, 2016, 13:37:40 PM
So there is no way to add subcategory to the canonical link wuthout removing the category in products?