News:

Looking for documentation? Take a look on our wiki

Main Menu

Manufacturer products view custom title and meta info

Started by julash, September 23, 2017, 16:58:30 PM

Previous topic - Next topic

julash

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

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

julash

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

julash

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.

Milbo

I wonder a bit about the best mode. First I write it so, that it becomes active, when no category is selected.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

julash

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.

Milbo

is ready. You can see the committ. I will contact you per skype
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

julash

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?

julash

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.