Automatically Generate Meta Description & Keyword

Developer BellWebs
License Free
Compatibility CubeCart v6 CubeCart v5 CubeCart v4 CubeCart v3
Date Added 6th Mar 2015, 20:57
Last Updated 27th May 2015, 04:08
Downloads 3,705

Free

  • meta-update.zip
Description
Documentation

A simple PHP script to automatically update product Meta Description based on the product description, and auto update the Meta Keywords based on the product title.

Note: This was made for CubeCart 5 and 6. If you have CubeCart 4 or 3 then you will need to modify the PHP a bit more. See Documentation for more info.

A simple PHP script to automatically update product Meta Description based on the product description, and auto update the Meta Keywords based on the product title.

The meta description is based on the product description and cleaned of most HTML code, special characters and whitespace.

The meta keyword uses the product title, removes whitespace and adds commas between the words of the title.

There is no limit to the number of items' description and keyword to be modified.

Required instructions for all CubeCart versions:

  • Download file (meta-update.zip)
  • Unzip
  • Modify the file (meta-update.php) to enter the details of your database connection

define ("DB_HOST", "localhost"); // set database host (usually "localhost")

define ("DB_USER", "Database_User"); // set database username

define ("DB_PASS","Database_Password"); // set database password

define ("DB_NAME","Database_Name"); // set database name

  • Save the modified file
  • Upload the file to your web server
  • Backup your database!!!
  • Visit yourdomain.tld/path-to-uploaded/meta-update.php

At this stage, all meta descriptions and keywords will be overwritten.

To change the number of characters in the SEO Meta Description, modify the $truncate variable:

  • $truncate = 160; // set number of characters in seo meta description

Keep in mind that by default CubeCart merges global tags. This means if you have 50 characters in the global Meta Description, you should set $truncate to 110.

NOTE: If you are using CubeCart version less than 5, then this script will still work as long as you change the variables below to match the names of your database's table and columns.

$table = "CubeCart_inventory"; // set database table to modify

$desCol = "description"; // set description column

$seoCol = "seo_meta_description"; // set seo meta description column

$prodId = "product_id"; // set product ID column

$nameCol = "name"; // set name column

$keyCol = "seo_meta_keywords"; // set seo meta keywords column

 

Ref: 36/172