News:

Support the VirtueMart project and become a member

Main Menu

Shortcut for entering Meta-Information

Started by schefzig, May 29, 2012, 14:25:57 PM

Previous topic - Next topic

schefzig

Hi there,

After migrating from V1, I wanted to find an easy way to enter Meta-Data. The goal was to enter meta-data at category-level and to automatically take those to the products.
Since I could not find anything similar within this forum, I started experimenting a bit with meta-information and I want to share my solution.

\components\com_virtuemart\views\productdetails\view.html.php
Starting at line 261, I added an "else" to the Keys and Description


if ($product->metadesc) {
    $document->setDescription($product->metadesc);
}
else
{
$document->setDescription($category->metadesc);
}
if ($product->metakey) {
    $document->setMetaData('keywords', $product->metakey);
}
else
{ $document->setMetaData('keywords', ($category->metakey) . ", " . $product->product_name);
}


If there are no metadata at product-level, it now takes the category-description as well as the category-keys + the product name.

Problem solved! For me, that's way better than taking the meta-data from the main-site!

Cheers

Schefzig