News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

(Solved) How to Populate Meta-Description Info (nearly) Automatically.

Started by ariplatinum, May 05, 2012, 09:44:52 AM

Previous topic - Next topic

ariplatinum

Below is my suggested contribution to the community on how to nearly automatically populate your meta-description information for all your, maybe thousands of products. This is particularly useful if you have not yet entered meta information and don't wish to enter them in manually via VM.

Why do you need this?


VM 2 has a pretty good SEF function built in, given the nice URLs it produces based on product categories and product name. However, for SEO purposes, you need an accurate meta-description for your products. I have used AceSEF, which despite a whole range of attractive features such as auto-meta fill, unfortunately broke my site causing a whole range of JS and Ajax problems, and sh404SEF doesn't have plans for a VM 2 plugin anytime soon... moreover the built in VM SEF facility will suffice.

Firstly, I note that BanquetTables.pro has previouslyput forward a suggestion on how automatically populate meta-description: http://forum.virtuemart.net/index.php?topic=96433.0

However, I was unable to get it to work with VM 2.0.4 -  I am not sure what went wrong, however I have instead come up with my own alternative solution.

What you need:
- CSVI Pro (www.csvimproved.com)
- Microsoft Excel
& If you use a Mac, a CSVEditor, such as that available from DSD.net


So what do you do?

1) Open CSVI Pro, export a CSV with all your products and ensure that the following fields are exported (you can select more than these fields, but these are the ones you are probably most likely to use... keep reading)

product_sku
product_name
product_s_desc
manufacturer_name
category_path

and of course
metadesc

2) Open your CSV file in Excel. You will notice all of your fields are filled in, except for the "metadesc" column.

What we want to achieve here is a formula that will automatically populate your metadesc column based on the other information available in your CSV sheet. The above fields are my suggested fields, however you can select the fields with the most relevant information for your product's metadescription.

The formula we want to enter into the metadesc column is a CONCATENATE formula in Microsoft Excel. What that does is it joins several text strings into one single text string.

So if B1=Manufacture and B2=ProductName and we place the following formula into another cell, aka our metadesc cell;

=B1&B2

we end up with string "ManufacturerProductName" being entered.

Naturally, we may want to put a space between the words so we alter the formula to look like this

=B1&" "&B2

Now we have "Manufacturer ProductName" entered into our cell.

So if you understand the logic of this, then you need to simply edit the formula based on what you want to enter into the 'metadesc' column as per your preferences. Perhaps you want

product_sku = GTApple (B1)
product_name = Great Tasting Apple (B2)
product_s_desc = A truly delicious apple. (B3)
manufacturer_name = Great Tasting (B4)
category_path = Apples (B5)


our formula here to enter into B6 (assuming that is your metadesc column) could be

=B2&", "&B3&", "&B1&", "&B4&", "&B5


This would produce into your metadesc column: "Great Tasting Apple, A truly delicious apple., GTApple, Great Tasting, Apples"

Now you can obviously play around with the formula based on what you prefer. Once you have your metadesc columns now all filled out, delete all the other columns other than "product_sku" and "metadesc columns", and your your file is ready to go for upload. If you are a Windows user, you can upload your CSV into CSVI Pro as you normally would...

Bingo, your products all now have a great custom built meta-description. This process I hope will save you hours of time like it did me. ;D ;D ;D

(If you are a Mac user like me, you will notice that you have endless problems uploading Mac Excel CSV files into CSVI Pro. Even if you save your MS CSV file as pure text files, they still save the UTF-8 coding with Mac specific "line ending" information written into the CSV file which conflicts with CSVI Pro upload process. So open up your CSV File, in a program like CSVEditor, such as the one I suggested previously (you can buy it through the App Store), which will allow you save your CSV with non-Mac line ending information. Namely ensure that "CR+LF (Windows + DOS)" line ending is selected upon export and your file will be good to go for upload).
Joomla 2.5.4
Virtuemart 2.0.4
Firefox 11

derek webster

I've found another way to do this automatically - if anyones interested?

for example uner Views/productdetails/view.html

around line 266 you can change
if ($product->metadesc) {
    $document->setDescription($product->metadesc);
}
to if ($product->metadesc) {
    $document->setDescription($product->metadesc);
} else {
$document->setDescription("Buy ".$category->category_name." | ".$this->product->mf_name." | ".$product->product_name." | ".$product->product_desc);
}




This should automaticallyset the Metadesc to use the Mnufacturer | category | prod description

This is just on the product pages tho.

I've not tried on the category pages yet.

Thanks

PRO

Quote from: derek webster on September 28, 2012, 17:22:08 PM
I've found another way to do this automatically - if anyones interested?

for example uner Views/productdetails/view.html

around line 266 you can change
if ($product->metadesc) {
    $document->setDescription($product->metadesc);
}
to if ($product->metadesc) {
    $document->setDescription($product->metadesc);
} else {
$document->setDescription("Buy ".$category->category_name." | ".$this->product->mf_name." | ".$product->product_name." | ".$product->product_desc);
}




This should automaticallyset the Metadesc to use the Mnufacturer | category | prod description

This is just on the product pages tho.

I've not tried on the category pages yet.

Thanks

1st, you should not hack  the code

2nd your code is wrong

$product     does not work on the product page


$this->



derek webster

$product works just fine on the view.html.php file. This code renders perfectly. however I get your point that this is not a template override. I shall perhaps try to put this code in my override file.

Just trying to be helpful


blacksheep

Quote from: derek webster on September 28, 2012, 21:47:58 PM
$product works just fine on the view.html.php file. This code renders perfectly. however I get your point that this is not a template override. I shall perhaps try to put this code in my override file.

Just trying to be helpful

I tried this way, it works but I see html formatting of my description when share pages.
How come?

mfuller526

Thanks ariplatinum for the excellent step by step explanation. Also, using Excel avoids hacking code which will be overwritten on the next VM update.
Joomla! 2.5.28, PHP 5.4.36,  MoWebSo3.2.19