Metatag e motori di ricerca
Inviato: 28/10/2003, 17:37
Salve,
ho appena implementato questa contribution:
ho però sempre il problema che al posto del titolo mi viene richiamata la scritta oscommerce.
ma dov'è il problema???
ho appena implementato questa contribution:
Codice: Seleziona tutto
Dynamic Product Meta Tags
---------------------
9/09/2003
All credit remains to the original Author - just modified the code slightly to not include HTML tags.
9/08/2003
This contribution was a simple attempt at creating dynamic meta tags for the product_info.php, so that search engines spidering your website may gather more relevant information regarding your product(s).
Thanks to Linda McGrath for inspiring this easy fix from her Header Controller Tags contribution.
Just copy and paste into your products_info.php page and your done!
BE SURE TO BACKUP FIRST AS ALWAYS!
--------------------------------------
Files to be added/altered and uploaded upon completion:
catalog/product_info.php
tested successfully on MS1 and MS2.
--------------------------------------
INSTRUCTIONS:
1. Open your product_info.php file.
Find this (line 1):
<?php
/*
$Id: product_info.php,v 1.92 2003/02/14 05:51:21 hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);
?>
And add this directly below it:
<!-- begin dynamic meta tags query -->
<?php
$the_product_info_query = tep_db_query("select pd.language_id, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'" . " and pd.language_id ='" . (int)$languages_id . "'");
$the_product_info = tep_db_fetch_array($the_product_info_query);
$the_product_name = strip_tags ($the_product_info['products_name'], "");
$the_product_description = strip_tags ($the_product_info['products_description'], "");
$the_product_model = strip_tags ($the_product_info['products_model'], "");
?>
<?php
$the_manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
$the_manufacturers = tep_db_fetch_array($the_manufacturer_query);
?>
<!-- end dynamic meta tags query -->
2. Directly below the <head> tag within this page (roughly line 27 after pasting the above), copy and paste this:
<!-- begin dynamic meta tags -->
<title><?php echo TITLE ?>: <?php echo $the_product_name; ?></title>
<meta name="keywords" content="<?php echo TITLE ?>, <?php echo $the_product_name; ?>, <?php echo $the_product_model; ?>, <?php echo $the_manufacturers['manufacturers_name']; ?>">
<meta name="description" content="<?php echo $the_product_description . "," . $the_product_name; ?>">
<!-- end dynamic meta tags -->
KNOWN BUGS:
----------------------
if you are currently using the WYSIWYG Contribution within admin for adding HTML coding for product descriptions, then the product_description field that is pulled into the META DESCRIPTION will show the added HTML coding and may:
1. Toss an error message
2. Certain Search Engines may not properly spider your website.
NOTE: This shouldn't be a problem with the "strip_tags" added on 9/09/2003.
----------------------
THATS IT! Hope this helps out and email me if you have any problems, questions, or suggestions relating to this.
If you need additional help, customization work with oscommerce, oscommerce graphical templates, or affordable hosting with included SSL certificate, feel free to contact us.
~ Bruce
email: bhakala@pc-productions.net
http://www.pc-productions.net
http://www.tsunamihosting.com
ho però sempre il problema che al posto del titolo mi viene richiamata la scritta oscommerce.
ma dov'è il problema???