VirtueMart Forum

VirtueMart 2 + 3 + 4 => Security (https) / Performance / SEO, SEF, URLs => Topic started by: Leila on August 21, 2019, 09:55:21 AM

Title: Manufacturer pages with wrong urls and metatags
Post by: Leila on August 21, 2019, 09:55:21 AM
Hi!
I ve already posted my question in topic https://forum.virtuemart.net/index.php?topic=142723.msg506051#msg506051.

An extra ending is randomly added to /manufacturer/name/ending when I click on manufactuter link on product details page or manufacturer module.

The normal manufacturer category should look like this : https://www.kovrovik.com.ua/manufacturer/confetti-carpet - with proper meta tags and description.

But instead I get this: https://www.kovrovik.com.ua/manufacturer/confetti-carpet/kovry - metatags are from category https://www.kovrovik.com.ua/kovry.

The added ending is from Virtuemart category alias.
I also get pages with no products because the added category (ending) doesnt contain products of needed manufacturer.

Joomla cache turn off doesnt help. After cleaning all cache I get proper url but only first two or three times. And then again!
The only thing that seems to help 100% is turning off Joomla SEF as well as Virtuemart SEF.


Virtuemart 3.4.2.
Joomla 3.9.8.
Php 7.2.21.
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: GJC Web Design on August 21, 2019, 11:42:35 AM
QuoteJoomla cache turn off doesn't help. After cleaning all cache I get proper url but only first two or three times

which cache??

if it works with caches cleared then it is obviously a caching problem .. afaik VM is only reliable with the Joomla conservative caching
but I don't use any of the Joomla caches on my sites  - my current favourite is the Litespeed server cache system or on Siteground servers their proprietary cache system - both seem 100% reliable

try installing the module https://github.com/OSTraining/OSURL .. it will show u the real url that is being sef'd .. might help
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: Leila on August 21, 2019, 12:21:40 PM
Joomla standart cache in General settings and cache plugin. When all is turned off the problem remains. Clearing cache in System > Clear cache   helps only for some time.

Osurl module output:

$_SERVER["REQUEST_URI"]: /manufacturer/confetti-carpet/akrilovye-kovry
JRouter::getVars() and buildQuery: /index.php?Itemid=392&option=com_virtuemart&limitstart=0&virtuemart_manufacturer_id=2&virtuemart_category_id=29&view=category&limit=


where &virtuemart_category_id=29 - is ID of category "akrilovye-kovry"


Title: Re: Manufacturer pages with wrong urls and metatags
Post by: GJC Web Design on August 21, 2019, 13:00:58 PM
what is menu item Itemid=392 assigned to?

what does the url

/index.php?Itemid=392&option=com_virtuemart&limitstart=0&virtuemart_manufacturer_id=2&view=category&limit=  give u?  i.e. no virtuemart_category_id
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: Leila on August 21, 2019, 13:08:54 PM

Itemid=392 is joomla menu with Virtuemart top level category layout. This is front page in Russhian language.

/index.php?Itemid=392&option=com_virtuemart&limitstart=0&virtuemart_manufacturer_id=2&view=category&limit= gives the correct manufacturer page with proper metatags!
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: GJC Web Design on August 21, 2019, 13:15:38 PM
how is the link to the manu page constructed in the template?

does it come from the view.html.php?

what about a https://www.php.net/manual/en/function.preg-replace.php in the template to get rid of the  virtuemart_category_id?
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: Leila on August 21, 2019, 13:52:06 PM
Quotehow is the link to the manu page constructed in the template?
I dont really understand what you mean :(
I guess you mean the link in default_manufactuter.php
$link = JRoute::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id=' . $manufacturers_details->virtuemart_manufacturer_id. '&tmpl=component', FALSE);

Quotedoes it come from the view.html.php?
Maybe. But I didn't override it and dont have it in overrides.

I get to manu page from product details page i.e https://www.kovrovik.com.ua/efes-0559-green-round-detail
To show manufacturer on product page I added to template override /templates/my_template/html/com_virtuemart/productdetails/custom.php (I dont really understand the code: I found the solution on a forum).
<?php
      // Manufacturer of the Product
      if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
         echo $this->loadTemplate('manufacturer');
      }
      ?>

When I click on manufacturer name I get popup with link to view all products. And this link randomly leads to wrong url. So does the manufacturer link when I add manufacturers module.

Quotewhat about a https://www.php.net/manual/en/function.preg-replace.php in the template to get rid of the  virtuemart_category_id?
I'd like to but I dont understand PHP.
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: GJC Web Design on August 21, 2019, 14:10:58 PM
components\com_virtuemart\views\productdetails\tmpl\default_manufacturer.php

I don't see any virtuemart_category_id there

   //Link to products
      $link = JRoute::_('index.php?option=com_virtuemart&view=manufacturer&virtuemart_manufacturer_id=' . $manufacturers_details->virtuemart_manufacturer_id. '&tmpl=component', FALSE);

so how is it being added?
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: Leila on August 21, 2019, 14:17:35 PM
maybe  in /components/com_virtuemart/views/manufacturer/tmpl/details.php

JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=' . $this->manufacturer->virtuemart_manufacturer_id, FALSE);

Because when I tried to change link as here http://forum.virtuemart.net/index.php?topic=136209.0,  the link started to lead to to main page.
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: GJC Web Design on August 21, 2019, 15:23:35 PM
also there .. no mention of virtuemart_category_id - so why is the virtuemart_category_id being added to your links?
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: Leila on August 21, 2019, 16:06:57 PM
I dont know. I didnt hack virtuemart core, only did some template overrides.

Title: Re: Manufacturer pages with wrong urls and metatags
Post by: Leila on August 21, 2019, 19:00:05 PM
When Joomla SEF is off page url looks like https://www.kovrovik.com.ua/index.php?option=com_virtuemart&view=category&virtuemart_manufacturer_id=6&Itemid=184&lang=ru
Without virtuemart_category_id!
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: Milbo on September 07, 2019, 13:15:15 PM
That should be correct. Please try the last version. I think we worked on that http://dev.virtuemart.net/attachments/1177/com_virtuemart.3.6.1.10121_package_or_extract.zip
Title: Re: Manufacturer pages with wrong urls and metatags
Post by: Leila on September 17, 2019, 08:50:09 AM
Now it works! Thank you very much for help!