News:

Looking for documentation? Take a look on our wiki

Main Menu

manufacturer in product name on product detail page

Started by marvays, April 12, 2019, 06:40:50 AM

Previous topic - Next topic

marvays

Hi. for SEO i need update my template. I have problem. How I add manufacturer inot this code?
I need the manufacturer's name before the product name in the h1 tag.
I've tried many variations, but none worked.

<?php // Product Title ?>
<h1 class="FlexibleProductDetailProductName"><?php echo $this->product->product_name ?></h1>
<?php // Product Title END ?>

marvays

And maybe even add product_mpn.

So the resulting shape would be "manufacturer product name product_mpn"
Can anybody help me, please?

Ghost

<?php echo $this->product->mf_name ' ' $this->product->product_name ' ' $this->product->product_mpn?>

marvays

Thx very much.
I need to edit the <title> tag to make the work perfect. To make the product detail the same.

Ghost

Normally you should use plugins to set things like metadata. But for your own purposes you can add this to the template override:

JFactory::getDocument()->setTitle('Your Title Here');

Or you can set custom title when editing the product.

marvays

Know you any good plugins? I need change it for all product page automatically. I only use sh404sef and there is very limited SEO.

marvays

Ok. Found it.

// Set the titles
// $document->setTitle should be after the additem pathway
if ($product->customtitle) {
$document->setTitle(strip_tags(html_entity_decode($product->customtitle,ENT_QUOTES)));
} else {
$catName = '';
if($category->published and !empty($category->category_name)){
$catName = $category->category_name.': ';
}
$document->setTitle(strip_tags(html_entity_decode($catName . $product->product_name,ENT_QUOTES)));
}