Belfiore1 Posted December 25, 2004 Posted December 25, 2004 Hi, I tried to add the meta tag utility and it turned into a disaster,Is there a easy straight forward way? Thank You Justin
bobg7 Posted December 26, 2004 Posted December 26, 2004 A simple one I thnk is the Dynamic Meta Tags contribution, 1 file to edit (meta_tags.php) and upload and one line to add to the /catalog/index.php. Easy 1, 2, 3 instructions. Here is a file that shows the changes I made to my meta_tags.php if you want to see how it looks after it's edited. <?php //Step 1. Construct the general Query! $metaQuery = "SELECT `products_description`.`products_name`, `categories_description`.`categories_name`, `manufacturers`.`manufacturers_name` "; $metaQuery .= "FROM products, products_description, products_to_categories, categories, categories_description, languages, manufacturers, configuration "; $metaQuery .= "WHERE products.products_id = products_description.products_id "; $metaQuery .= "AND products_description.language_id = languages.languages_id "; $metaQuery .= "AND products_description.products_id = products_to_categories.products_id "; $metaQuery .= "AND products_to_categories.categories_id = categories.categories_id "; $metaQuery .= "AND categories.categories_id = categories_description.categories_id "; $metaQuery .= "AND categories_description.language_id = languages.languages_id "; $metaQuery .= "AND products.manufacturers_id = manufacturers.manufacturers_id "; $metaQuery .= "AND products.products_status = 1 "; $metaQuery .= "AND configuration.configuration_key = 'DEFAULT_LANGUAGE' "; $metaQuery .= "AND languages.code = configuration.configuration_value "; //Step 2. Narrow the search! //Are we looking within a category? if (isset($cPath) && tep_not_null($cPath)) { $metaCategoryArray = explode ("_",$cPath); if (strpos($cPath, '_')) { $metaCategoryArray = array_reverse($metaCategoryArray); } $metaCategoryId = $metaCategoryArray[0]; $metaQuery .= "AND categories.categories_id = '" . $metaCategoryId . "' "; } //Are we looking within a manufacturer? if (isset($manufacturers_id) && tep_not_null($manufacturers_id)) { $metaManufacturersId = $manufacturers_id; $metaQuery .= "AND manufacturers.manufacturers_id = '" . $metaManufacturersId . "' "; } //Step 3. Extract the info from the DB $metaQueryResult = tep_db_query ( $metaQuery ); $metaProductsNames = array(); $metaCategoriesNames = array(); $metaManufacturersNames = array(); //Step 4. Remove duplicates by using the name as the key in an array while($metaQueryData = tep_db_fetch_array ($metaQueryResult)) { $metaProductsNames[$metaQueryData['products_name']] = $metaQueryData['products_name']; $metaCategoriesNames[$metaQueryData['categories_name']] = $metaQueryData['categories_name']; $metaManufacturersNames[$metaQueryData['manufacturers_name']] = $metaQueryData['manufacturers_name']; } //Step 5. Construct the keywords $metaKeywords = "grasshopper, gifts, novelties, ceramic, glass, wood, african american, cherub, animal, dolls, bath and beauty, business, travel, america, clocks, divine, inspiration, far east, garden, metal, golf, holidays, christmas, birthday, decor, home, paypal, pay pal, ebay"; foreach($metaProductsNames as $metaProductsName) { if($metaKeywords == "") { //First Row $metaKeywords = $metaProductsName; } else { //Other Rows $metaKeywords .= ", " . $metaProductsName; } } foreach($metaCategoriesNames as $metaCategoriesName) { if($metaKeywords == "") { //No previous entries $metaKeywords = $metaCategoriesName; } else { //Other Rows $metaKeywords .= ", " . $metaCategoriesName; } } //Limit the keywords to 1000 characters $metaKeywords = substr($metaKeywords, 0, 999); //Step 6. Construct the description $metaDescription = "Grasshoppers Gifts and Novelties Is Your One Stop Gift and Novelties Shopping Experience "; $i = 0; foreach($metaManufacturersNames as $metaManufacturersName) { //Limit the decription to 150 words if($i >= 149) { break; } if($i == 0) { //First Row $metaDescription .= $metaManufacturersName; } else { //Other Rows $metaDescription .= ", " . $metaManufacturersName; } $i++; } //Step 7. Construct the abstract $metaAbstract = "Grasshoppers Gifts and Novelties Is Your One Stop Gift and Novelties Shopping Experience "; $i = 0; foreach($metaManufacturersNames as $metaManufacturersName) { //Limit the decription to 150 words if($i >= 149) { break; } if($i == 0) { //First Row $metaDescription .= $metaManufacturersName; } else { //Other Rows $metaDescription .= ", " . $metaManufacturersName; } $i++; } //Step 8. Construct the author $metaAuthor = "Bob Griffin "; $i = 0; foreach($metaManufacturersNames as $metaManufacturersName) { //Limit the decription to 150 words if($i >= 149) { break; } if($i == 0) { //First Row $metaDescription .= $metaManufacturersName; } else { //Other Rows $metaDescription .= ", " . $metaManufacturersName; } $i++; } //Step 9. Construct the distributor $metaDistributor = "Grasshoppers Gifts and Novelties "; $i = 0; foreach($metaManufacturersNames as $metaManufacturersName) { //Limit the decription to 150 words if($i >= 149) { break; } if($i == 0) { //First Row $metaDescription .= $metaManufacturersName; } else { //Other Rows $metaDescription .= ", " . $metaManufacturersName; } $i++; } //Step 10. Construct the copyright $metaCopyright = "2004 Grasshoppers Gifts and Novelties "; $i = 0; foreach($metaManufacturersNames as $metaManufacturersName) { //Limit the decription to 150 words if($i >= 149) { break; } if($i == 0) { //First Row $metaDescription .= $metaManufacturersName; } else { //Other Rows $metaDescription .= ", " . $metaManufacturersName; } $i++; } //Step 11. Construct the language $metaLanguage = "EN-US "; $i = 0; foreach($metaManufacturersNames as $metaManufacturersName) { //Limit the decription to 150 words if($i >= 149) { break; } if($i == 0) { //First Row $metaDescription .= $metaManufacturersName; } else { //Other Rows $metaDescription .= ", " . $metaManufacturersName; } $i++; } //Step 12. Construct the distribution $metaDistribution = "global "; $i = 0; foreach($metaManufacturersNames as $metaManufacturersName) { //Limit the decription to 150 words if($i >= 149) { break; } if($i == 0) { //First Row $metaDescription .= $metaManufacturersName; } else { //Other Rows $metaDescription .= ", " . $metaManufacturersName; } $i++; } //Step 12. Construct the rating $metaRating = "general "; $i = 0; foreach($metaManufacturersNames as $metaManufacturersName) { //Limit the decription to 150 words if($i >= 149) { break; } if($i == 0) { //First Row $metaDescription .= $metaManufacturersName; } else { //Other Rows $metaDescription .= ", " . $metaManufacturersName; } $i++; } echo '<meta name="keywords" content="' . $metaKeywords . '">' . "\n"; echo '<meta name="description" content="' . $metaDescription . '">' . "\n"; echo '<meta name="abstract" content="' . $metaAbstract . '">' . "\n"; echo '<meta name="author" content="' . $metaAuthor . '">' . "\n"; echo '<meta name="distributor" content="' . $metaDistributor . '">' . "\n"; echo '<meta name="copyright" content="' . $metaCopyright . '">' . "\n"; echo '<meta name="language" content="' . $metaLanguage . '">' . "\n"; echo '<meta name="distribution" content="' . $metaDistribution . '">' . "\n"; echo '<meta name="rating" content="' . $metaRating . '">' . "\n"; ?> Bob G. Installed Contributions: CCGV, Close Popup, Dynamic Meta Tags, Easy Populate, Froogle Data Feeder, Google Position, Infobox Header Entire Row, Live Support for OSC, PayPal Seal with CC images, Report_m Sales, Shop by Price Revised, SQL Updater, Who's Online Enhancement, Footer, GNA EP Assistant and still going.
Jack_mcs Posted December 26, 2004 Posted December 26, 2004 Hi, I tried to add the meta tag utility and it turned into a disaster,Is there a easy straight forward way? Thank You Justin <{POST_SNAPBACK}> You can install meta tags a few different ways. Most of the files in your catalog directory will need to be edited (if you are not using STS). But this won't take into account the product pages. There is a method somewhere here on one of the forums that has a method to do this by just editing a few lines (IIRC). But after making all of those changes, what happens if you find you need to tweak your keywords or add a new page (thus a new title). Your work load increases. The only way to do it right, IMO, is to install the Header Tags Controller contribution. Jack Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons
Recommended Posts
Archived
This topic is now archived and is closed to further replies.