VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: julash on September 23, 2017, 16:58:30 PM

Title: Manufacturer products view custom title and meta info
Post by: julash on September 23, 2017, 16:58:30 PM
Hi,

Normally a virtuemart category page can have custom browser page title, meta key/desc defined in vm backend and that load in frontend for that category products list view. This is very essential for SEO.

The website I am developing right now has 400 manufacturer as arts/books artist/author. Now I was wondering how can I achieve same functionality like category products list view for manufacturer products list view. So when visitor check all products of a manufacturer, browser title and meta key/desc load from that manufacturer. Manufacturer meta key/desc are fine for manufacturer details view, but not for manufacturer products list view.

In /components/com_virtuemart/views/category/view.html.php file I found this code below that set manufacturer name in browser title. I am not good with code, but tried a lot to show manufacturer custom title by replacing mf_name with various code like ($manufacturer->customtitle) but no luck.


if ($virtuemart_manufacturer_id>0 and !empty($this->products['products'])){
if (!empty($this->products['products'][0])) $title .=' '.$this->products['products'][0]->mf_name ;
// Override Category name when viewing manufacturers products !IMPORTANT AFTER page title.
if (!empty($this->products['products'][0]) and isset($category->category_name)) $category->category_name = $this->products['products'][0]->mf_name ;
}


And no idea where to look for meta key/desc load for manufacturer. Can someone please help me. Without this the website I am developing will have bad seo optimization. Is there any SEO extension that will support this?

I was wondering is it possible to set manufacturer customtitle, meta key/desc in category view of template override by something like this:


if ($virtuemart_manufacturer_id>0 and !empty($this->products['products'])) {
                        $document->setTitle($manufacturer->customtitle);
                       
                        if ($manufacturer->metakey) {
$document->setMetaData('keywords', $manufacturer->metakey);
}

if ($manufacturer->metarobot) {
$document->setMetaData('robots', $manufacturer->metarobot);
}
}


By "if ($virtuemart_manufacturer_id>0 and !empty($this->products['products']))" I meant for manufacturer products list view detection.

Will appreciate any help.

Thanks
Julash
Title: Re: Manufacturer products view custom title and meta info
Post by: Milbo on September 23, 2017, 21:48:02 PM
I can add it for a bronze membership http://extensions.virtuemart.net/support/virtuemart-supporter-membership-bronze-detail
Title: Re: Manufacturer products view custom title and meta info
Post by: julash on September 23, 2017, 22:06:19 PM
Hi Milbo, thank you for your reply.

I will have to come back to you about this after I talk with my client. I think he will be happy to get a membership.

Regards
Julash
Title: Re: Manufacturer products view custom title and meta info
Post by: julash on September 25, 2017, 11:38:04 AM
Hi Milbo,

My client got a membership. I have send you order id and our website link to your pm.

Thank you for your help.
Title: Re: Manufacturer products view custom title and meta info
Post by: Milbo on September 26, 2017, 11:27:35 AM
I wonder a bit about the best mode. First I write it so, that it becomes active, when no category is selected.
Title: Re: Manufacturer products view custom title and meta info
Post by: julash on September 26, 2017, 11:44:40 AM
A manufacturer might have products in different categories. In that case, no category should be selected.

For example, udemy or coursera.org has many types of course. In that case, if a virtuemart website build for courses from various organisation, then manufacturer page should not have any category bind.
Title: Re: Manufacturer products view custom title and meta info
Post by: Milbo on September 27, 2017, 17:54:53 PM
is ready. You can see the committ. I will contact you per skype
Title: Re: Manufacturer products view custom title and meta info
Post by: julash on September 27, 2017, 19:22:20 PM
Its working. Many many thanks for adding manufacturer description too. You are awesome :D

Just one little problem, both manufacturer browser custom title and manufacturer title are showing for browser title and meta title. First custom title and then the manufacturer title. Is that intended?
Title: Re: Manufacturer products view custom title and meta info
Post by: julash on September 27, 2017, 20:25:42 PM
I think this line no 452 of /components/com_virtuemart/views/category/view.html.php

if (!empty($this->products['products'][0])) $title .=' '.$this->products['products'][0]->mf_name ;

should be like this


     if (!empty($metaObj->customtitle)) {} else {
    if (!empty($this->products['products'][0])) $title .=' '.$this->products['products'][0]->mf_name ;
     }


So manufacturer name won't show for browser/meta title when manufacturer has custom page title set. Its working for me. But I am not good with code, so please verify the code.