Jump to content
Sign in to follow this  
Farrukh

[Contribution] Header Tags Controller for Admin MS 2.2

Recommended Posts

I have some problems installing this contribution, esp in the Admin part. Should i replace my old admin files with the new ones I get when downloading the contribution? When followig the instructions in "README to Admin", should I make changes to my old files or am I suposed to do the changes in the attached files?

 

:blush:

Share this post


Link to post
Share on other sites

<?php

// /catalog/includes/header_tags.php

// WebMakers.com Added: Header Tags Generator v2.3

// Add META TAGS and Modify TITLE

//

// NOTE: Globally replace all fields in products table with current product name just to get things started:

// In phpMyAdmin use: UPDATE products_description set PRODUCTS_HEAD_TITLE_TAG = PRODUCTS_NAME

//

require(DIR_WS_LANGUAGES . $language . '/' . 'header_tags.php');

 

echo '<!-- BOF: Generated Meta Tags -->' . "\n";

 

$the_desc='';

$the_key_words='';

$the_title='';

 

// Define specific settings per page:

switch (true) {

 

// INDEX.PHP

case (strstr($_SERVER['PHP_SELF'],FILENAME_DEFAULT) or strstr($PHP_SELF,FILENAME_DEFAULT) ):

// parse cpatch to get category

$the_category_query = tep_db_query("select cd.categories_name, cd.categories_head_desc_tag ,cd.categories_head_title_tag, cd.categories_head_keywords_tag from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . $current_category_id . "' and cd.categories_id = '" . $current_category_id . "' and cd.language_id = '" . $languages_id . "'");

$the_category = tep_db_fetch_array($the_category_query);

 

$the_manufacturers_query= tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");

$the_manufacturers = tep_db_fetch_array($the_manufacturers_query);

 

 

if (empty($the_category['categories_head_desc_tag'])) {

$the_desc= $the_category['categories_name'];

}else{

if (HTDA_DEFAULT_ON=='1') {

$the_desc= $the_category['categories_head_desc_tag'] . ' ' . HEAD_DESC_TAG_ALL;

} else {

$the_desc= $the_category['categories_head_desc_tag'] . ' ' . HEAD_DESC_TAG_DEFAULT;

}

}

 

if (HTKA_DEFAULT_ON=='1') {

$the_key_words= clean_html_comments($the_category['categories_head_keywords_tag']) . ' ' . HEAD_KEY_TAG_DEFAULT;

} else {

$the_key_words= clean_html_comments($the_category['categories_head_keywords_tag']) . ' ' . HEAD_KEY_TAG_DEFAULT;

}

 

if (HTTA_DEFAULT_ON=='1') {

$the_title= $the_category['categories_head_title_tag'] . ' ' . HEAD_TITLE_TAG_DEFAULT . " " . $the_category['categories_name'] . $the_manufacturers['manufacturers_name'];

} else {

$the_title= $the_category['categories_head_title_tag'] . ' ' . HEAD_TITLE_TAG_DEFAULT;

}

break;

 

// PRODUCT_INFO.PHP

case ( strstr($_SERVER['PHP_SELF'],'product_info.php') or strstr($PHP_SELF,'product_info.php') ):

// $the_product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_keywords_tag, pd.products_head_desc_tag, 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 = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "'");

$the_product_info_query = tep_db_query("select pd.language_id, p.products_id, pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_keywords_tag, pd.products_head_desc_tag, 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);

 

if (empty($the_product_info['products_head_desc_tag'])) {

$the_desc= HEAD_DESC_TAG_ALL;

} else {

if ( HTDA_PRODUCT_INFO_ON=='1' ) {

$the_desc= $the_product_info['products_head_desc_tag'] . ' ' . HEAD_DESC_TAG_ALL;

} else {

$the_desc= $the_product_info['products_head_desc_tag'];

}

}

 

if (empty($the_product_info['products_head_keywords_tag'])) {

$the_key_words= HEAD_KEY_TAG_ALL;

} else {

if ( HTKA_PRODUCT_INFO_ON=='1' ) {

$the_key_words= $the_product_info['products_head_keywords_tag'] . ' ' . HEAD_KEY_TAG_ALL;

} else {

$the_key_words= $the_product_info['products_head_keywords_tag'];

}

}

 

if (empty($the_product_info['products_head_title_tag'])) {

$the_title= HEAD_TITLE_TAG_ALL;

} else {

if ( HTTA_PRODUCT_INFO_ON=='1' ) {

$the_title= HEAD_TITLE_TAG_ALL . ' ' . clean_html_comments($the_product_info['products_head_title_tag']);

} else {

$the_title= clean_html_comments($the_product_info['products_head_title_tag']);

}

}

 

break;

 

 

// PRODUCTS_NEW.PHP

case ( strstr($_SERVER['PHP_SELF'],'products_new.php') or strstr($PHP_SELF,'products_new.php') ):

if ( HEAD_DESC_TAG_WHATS_NEW!='' ) {

if ( HTDA_WHATS_NEW_ON=='1' ) {

$the_desc= HEAD_DESC_TAG_WHATS_NEW . ' ' . HEAD_DESC_TAG_ALL;

} else {

$the_desc= HEAD_DESC_TAG_WHATS_NEW;

}

} else {

$the_desc= HEAD_DESC_TAG_ALL;

}

 

if ( HEAD_KEY_TAG_WHATS_NEW!='' ) {

if ( HTKA_WHATS_NEW_ON=='1' ) {

$the_key_words= HEAD_KEY_TAG_WHATS_NEW . ' ' . HEAD_KEY_TAG_ALL;

} else {

$the_key_words= HEAD_KEY_TAG_WHATS_NEW;

}

} else {

$the_key_words= HEAD_KEY_TAG_ALL;

}

 

if ( HEAD_TITLE_TAG_WHATS_NEW!='' ) {

if ( HTTA_WHATS_NEW_ON=='1' ) {

$the_title= HEAD_TITLE_TAG_ALL . ' ' . HEAD_TITLE_TAG_WHATS_NEW;

} else {

$the_title= HEAD_TITLE_TAG_WHATS_NEW;

}

} else {

$the_title= HEAD_TITLE_TAG_ALL;

}

 

break;

 

 

// SPECIALS.PHP

case ( strstr($_SERVER['PHP_SELF'],'specials.php') or strstr($PHP_SELF,'specials.php') ):

if ( HEAD_DESC_TAG_SPECIALS!='' ) {

if ( HTDA_SPECIALS_ON=='1' ) {

$the_desc= HEAD_DESC_TAG_SPECIALS . ' ' . HEAD_DESC_TAG_ALL;

} else {

$the_desc= HEAD_DESC_TAG_SPECIALS;

}

} else {

$the_desc= HEAD_DESC_TAG_ALL;

}

 

if ( HEAD_KEY_TAG_SPECIALS=='' ) {

// Build a list of ALL specials product names to put in keywords

$new = tep_db_query("select p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, p.products_image, s.specials_new_products_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_status = '1' and s.products_id = p.products_id and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and s.status = '1' order by s.specials_date_added DESC ");

$row = 0;

$the_specials='';

while ($new_values = tep_db_fetch_array($new)) {

$the_specials .= clean_html_comments($new_values['products_name']) . ', ';

}

if ( HTKA_SPECIALS_ON=='1' ) {

$the_key_words= $the_specials . ' ' . HEAD_KEY_TAG_ALL;

} else {

$the_key_words= $the_specials;

}

} else {

$the_key_words= HEAD_KEY_TAG_SPECIALS . ' ' . HEAD_KEY_TAG_ALL;

}

 

if ( HEAD_TITLE_TAG_SPECIALS!='' ) {

if ( HTTA_SPECIALS_ON=='1' ) {

$the_title= HEAD_TITLE_TAG_SPECIALS . ' - ' . HEAD_TITLE_TAG_ALL;

} else {

$the_title= HEAD_TITLE_TAG_SPECIALS;

}

} else {

$the_title= HEAD_TITLE_TAG_ALL;

}

 

break;

 

 

// PRODUCTS_REVIEWS_INFO.PHP and PRODUCTS_REVIEWS.PHP

case ( strstr($_SERVER['PHP_SELF'],'product_reviews_info.php') or strstr($_SERVER['PHP_SELF'],'product_reviews.php') or strstr($PHP_SELF,'product_reviews_info.php') or strstr($PHP_SELF,'product_reviews.php') ):

if ( HEAD_DESC_TAG_PRODUCT_REVIEWS_INFO=='' ) {

if ( HTDA_PRODUCT_REVIEWS_INFO_ON=='1' ) {

$the_desc= tep_get_header_tag_products_desc(isset($HTTP_GET_VARS['reviews_id'])) . ' ' . HEAD_DESC_TAG_ALL;

} else {

$the_desc= tep_get_header_tag_products_desc(isset($HTTP_GET_VARS['reviews_id']));

}

} else {

$the_desc= HEAD_DESC_TAG_PRODUCT_REVIEWS_INFO;

}

 

if ( HEAD_KEY_TAG_PRODUCT_REVIEWS_INFO=='' ) {

if ( HTKA_PRODUCT_REVIEWS_INFO_ON=='1' ) {

$the_key_words= tep_get_header_tag_products_keywords(isset($HTTP_GET_VARS['reviews_id'])) . ' ' . HEAD_KEY_TAG_ALL;

} else {

$the_key_words= tep_get_header_tag_products_keywords(isset($HTTP_GET_VARS['reviews_id']));

}

} else {

$the_key_words= HEAD_KEY_TAG_PRODUCT_REVIEWS_INFO;

}

 

if ( HEAD_TITLE_TAG_PRODUCT_REVIEWS_INFO=='' ) {

if ( HTTA_PRODUCT_REVIEWS_INFO_ON=='1' ) {

$the_title= tep_get_header_tag_products_title(isset($HTTP_GET_VARS['reviews_id'])) . ' - ' . HEAD_TITLE_TAG_ALL;

} else {

$the_title= tep_get_header_tag_products_title(isset($HTTP_GET_VARS['reviews_id']));

}

} else {

$the_title= HEAD_TITLE_TAG_PRODUCT_REVIEWS_INFO;

}

 

break;

 

// ALL OTHER PAGES NOT DEFINED ABOVE

default:

$the_desc= HEAD_DESC_TAG_ALL;

$the_key_words= HEAD_KEY_TAG_ALL;

$the_title= HEAD_TITLE_TAG_ALL;

break;

 

}

 

echo ' <title>' . $the_title . '</title>' . "\n";

echo ' <meta http-equiv="Content-Type" content="text/html; charset="' . CHARSET . '">'."\n";

echo ' <META NAME="Description" Content="' . $the_desc . '">' . "\n";

echo ' <META NAME="Keywords" CONTENT="' . $the_key_words . '">' . "\n";

echo ' <META NAME="Reply-to" CONTENT="' . HEAD_REPLY_TAG_ALL . '">' . "\n";

 

echo '<!-- EOF: Generated Meta Tags -->' . "\n";

?>

Share this post


Link to post
Share on other sites
I have some problems installing this contribution, esp in the Admin part. Should i replace my old admin files with the new ones I get when downloading the contribution? When followig the instructions in "README to Admin", should I make changes to my old files or am I suposed to do the changes in the attached files?

 

:blush:

If you have a clean shop (no other contributions have been installed) or if you know that those particular files have not been changed, then you can just copy the files. You make the changes to the files in your shop (preferably a backup in case you make a mistake).

 

Jack

Share this post


Link to post
Share on other sites

James - Are you still having the problem? I looked at your site to refresh my memory but it seems to be displaying all of the titles fine.

 

Jack

Share this post


Link to post
Share on other sites

There is an updated version of this contribution available. What file(s) have changed now that the robots tag is included?

Share this post


Link to post
Share on other sites

Ok, I seem to have it installed but my Admin section does not have an area to insert the info for the tags.

 

Also when I used the auto installer, it ran but all the files in the folder are blank.

Share this post


Link to post
Share on other sites

Recheck the admin part of the installation. The boxes should be there. You may want to try checking the difference between your admin files and what is supposed to be installed.

 

As for the autoinstall, where did you place the sed editor?

 

Jack

Share this post


Link to post
Share on other sites

I've been at it for 18 hrs today and I know I'm exhausted and frustrated but I am NOT finding how to fix what appears to be the only error I'm getting with my HTC installation.

 

The error is on the categories.php in the admin:

TEXT_PRODUCT_METTA_INFO

 

TEXT_PRODUCTS_PAGE_TITLE 

Fatal error: Call to undefined function: tep_get_products_head_title_tag() in /hsphere/local/home/effortle/idragonfly.com/admin/categories.php on line 531

 

The code in question is:

<?php
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
        <tr>
           <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>
           <td><table border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
               <td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
               
             </tr>
           </table></td>
         </tr>
  <tr>
           <td colspan="2" class="main"><hr><?php echo TEXT_PRODUCT_METTA_INFO; ?></td>
         </tr>
<?php
   }
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
        <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>          
         <tr>
           <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_PAGE_TITLE; ?></td>
           <td><table border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
               <td class="main"><?php echo tep_draw_textarea_field('products_head_title_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($products_head_title_tag[$languages[$i]['id']]) ? $products_head_title_tag[$languages[$i]['id']] : tep_get_products_head_title_tag($pInfo->products_id, $languages[$i]['id']))); ?></td>
             </tr>
           </table></td>
         </tr>
<?php
   }
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>          
          <tr>
           <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_HEADER_DESCRIPTION; ?></td>
           <td><table border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
               <td class="main"><?php echo tep_draw_textarea_field('products_head_desc_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($products_head_desc_tag[$languages[$i]['id']]) ? $products_head_desc_tag[$languages[$i]['id']] : tep_get_products_head_desc_tag($pInfo->products_id, $languages[$i]['id']))); ?></td>
             </tr>
           </table></td>
         </tr>
<?php
   }
   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>          
          <tr>
           <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_KEYWORDS; ?></td>
           <td><table border="0" cellspacing="0" cellpadding="0">
             <tr>
               <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
               <td class="main"><?php echo tep_draw_textarea_field('products_head_keywords_tag[' . $languages[$i]['id'] . ']', 'soft', '70', '5', (isset($products_head_keywords_tag[$languages[$i]['id']]) ? $products_head_keywords_tag[$languages[$i]['id']] : tep_get_products_head_keywords_tag($pInfo->products_id, $languages[$i]['id']))); ?></td>
             </tr>
           </table></td>
         </tr>
<?php
   }
?>
         <tr>
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
         </tr>
         <tr>
           <td colspan="2" class="main"><hr></td>
         </tr>

 

I edited my categories.php by hand since I had other mods in place already, but I've been over it a dozen times or more and keep getting the same issue. Does anyone have any insights? I appreciate the help!


bloom,

php geek wannabe

"The difference between genius and stupidity is that genius has its limits." -Einstein

 

My Contributions

In-Stock Quantity Display

Share this post


Link to post
Share on other sites

On a whim I uploaded the clean version of the categories.php file that came with the HTC contribution...I decided I could re-do the existing mods since I hadn't had a problem with any of them.

 

Anyway, with the clean stock contribution file I get:

 

TEXT_PRODUCT_METTA_INFO

 

TEXT_PRODUCTS_PAGE_TITLE 

Fatal error: Call to undefined function: tep_get_products_head_title_tag() in /hsphere/local/home/effortle/idragonfly.com/admin/categories.php on line 570

 

Therefore...yep, still frustrated.


bloom,

php geek wannabe

"The difference between genius and stupidity is that genius has its limits." -Einstein

 

My Contributions

In-Stock Quantity Display

Share this post


Link to post
Share on other sites

no sleep = bad thing...note to self, be sure to actually include the language files and such before freaking out.


bloom,

php geek wannabe

"The difference between genius and stupidity is that genius has its limits." -Einstein

 

My Contributions

In-Stock Quantity Display

Share this post


Link to post
Share on other sites
Recheck the admin part of the installation.  The boxes should be there.  You may want to try checking the difference between your admin files and what is supposed to be installed.

 

As for the autoinstall, where did you place the sed editor?

 

Jack

 

Put "sed in same folder and reworked the admin file and it no works,

 

Thanks :rolleyes:

Share this post


Link to post
Share on other sites

hello,

 

have installed yesterday header tag v.2.3.5 and get following error!

 

Warning: main(DIR_WS_FUNCTIONSheader_tags.php): failed to open stream: No such file or directory in /home/www/web/html/shop/includes/application_top.php on line 4

 

Fatal error: main(): Failed opening required 'DIR_WS_FUNCTIONSheader_tags.php' (include_path='.') in /home/www/web/html/shop/includes/application_top.php on line 4

 

can anybody help as i am new to php and cannt understand the problem!

 

 

will be very thank full for ur help:)

 

greetings

 

Noumi

Share this post


Link to post
Share on other sites
hello,

 

have installed yesterday header tag v.2.3.5 and get following error!

 

Warning: main(DIR_WS_FUNCTIONSheader_tags.php): failed to open stream: No such file or directory in /home/www/web/html/shop/includes/application_top.php on line 4

 

Fatal error: main(): Failed opening required 'DIR_WS_FUNCTIONSheader_tags.php' (include_path='.') in /home/www/web/html/shop/includes/application_top.php on line 4

 

can anybody help as i am new to php and cannt understand the problem!

will be very thank full for ur help:)

 

greetings

 

Noumi

 

 

here is the code!

 

<?php

// BOF: WebMakers.com Added: Header Tags Controller v1.0
 require(DIR_WS_FUNCTIONS . 'header_tags.php');
// Clean out HTML comments from ALT tags etc.
 require(DIR_WS_FUNCTIONS . 'clean_html_comments.php');
// Also used by: WebMakers.com Added: FREE-CALL FOR PRICE
// EOF: WebMakers.com Added: Header Tags Controller v1.0

// start the timer for the page parse time log
 define('PAGE_PARSE_START_TIME', microtime());

// set the level of error reporting
 error_reporting(E_ALL & ~E_NOTICE);

// check if register_globals is enabled.
// since this is a temporary measure this message is hardcoded. The requirement will be removed before 2.2 is finalized.
 if (function_exists('ini_get')) {
   ini_get('register_globals') or exit('FATAL ERROR: register_globals is disabled in php.ini, please enable it!');
 }

// Set the local configuration parameters - mainly for developers
 if (file_exists('includes/local/configure.php')) include('includes/local/configure.php');

// include server parameters
 require('includes/configure.php');

 if (strlen(DB_SERVER) < 1) {
   if (is_dir('install')) {
     header('Location: install/index.php');
   }
 }

// define the project version
 define('PROJECT_VERSION', 'osCommerce 2.2-MS2');

// set the type of request (secure or not)
 $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL';

// set php_self in the local scope
 if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF'];

 if ($request_type == 'NONSSL') {
   define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG);
 } else {
   define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG);
 }

// include the list of project filenames
 require(DIR_WS_INCLUDES . 'filenames.php');

// include the list of project database tables
 require(DIR_WS_INCLUDES . 'database_tables.php');

// customization for the design layout
 define('BOX_WIDTH', 125); // how wide the boxes should be in pixels (default: 125)

// include the database functions
 require(DIR_WS_FUNCTIONS . 'database.php');

// make a connection to the database... now
 tep_db_connect() or die('Unable to connect to database server!');

// set the application parameters
 $configuration_query = tep_db_query('select configuration_key as cfgKey, configuration_value as cfgValue from ' . TABLE_CONFIGURATION);
 while ($configuration = tep_db_fetch_array($configuration_query)) {
   define($configuration['cfgKey'], $configuration['cfgValue']);
 }

// if gzip_compression is enabled, start to buffer the output
 if ( (GZIP_COMPRESSION == 'true') && ($ext_zlib_loaded = extension_loaded('zlib')) && (PHP_VERSION >= '4') ) {
   if (($ini_zlib_output_compression = (int)ini_get('zlib.output_compression')) < 1) {
     if (PHP_VERSION >= '4.0.4') {
       ob_start('ob_gzhandler');
     } else {
       include(DIR_WS_FUNCTIONS . 'gzip_compression.php');
       ob_start();
       ob_implicit_flush();
     }
   } else {
     ini_set('zlib.output_compression_level', GZIP_LEVEL);
   }
 }

// set the HTTP GET parameters manually if search_engine_friendly_urls is enabled
 if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
   if (strlen(getenv('PATH_INFO')) > 1) {
     $GET_array = array();
     $PHP_SELF = str_replace(getenv('PATH_INFO'), '', $PHP_SELF);
     $vars = explode('/', substr(getenv('PATH_INFO'), 1));
     for ($i=0, $n=sizeof($vars); $i<$n; $i++) {
       if (strpos($vars[$i], '[]')) {
         $GET_array[substr($vars[$i], 0, -2)][] = $vars[$i+1];
       } else {
         $HTTP_GET_VARS[$vars[$i]] = $vars[$i+1];
       }
       $i++;
     }

     if (sizeof($GET_array) > 0) {
       while (list($key, $value) = each($GET_array)) {
         $HTTP_GET_VARS[$key] = $value;
       }
     }
   }
 }

// define general functions used application-wide
 require(DIR_WS_FUNCTIONS . 'general.php');
 require(DIR_WS_FUNCTIONS . 'html_output.php');

// set the cookie domain
 $cookie_domain = (($request_type == 'NONSSL') ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN);
 $cookie_path = (($request_type == 'NONSSL') ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH);

// include cache functions if enabled
 if (USE_CACHE == 'true') include(DIR_WS_FUNCTIONS . 'cache.php');

// include shopping cart class
 require(DIR_WS_CLASSES . 'shopping_cart.php');

// include navigation history class
 require(DIR_WS_CLASSES . 'navigation_history.php');

// some code to solve compatibility issues
 require(DIR_WS_FUNCTIONS . 'compatibility.php');

// check if sessions are supported, otherwise use the php3 compatible session class
 if (!function_exists('session_start')) {
   define('PHP_SESSION_NAME', 'osCsid');
   define('PHP_SESSION_PATH', $cookie_path);
   define('PHP_SESSION_DOMAIN', $cookie_domain);
   define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);

   include(DIR_WS_CLASSES . 'sessions.php');
 }

// define how the session functions will be used
 require(DIR_WS_FUNCTIONS . 'sessions.php');

// set the session name and save path
 tep_session_name('osCsid');
 tep_session_save_path(SESSION_WRITE_DIRECTORY);

// set the session cookie parameters
  if (function_exists('session_set_cookie_params')) {
   session_set_cookie_params(0, $cookie_path, $cookie_domain);
 } elseif (function_exists('ini_set')) {
   ini_set('session.cookie_lifetime', '0');
   ini_set('session.cookie_path', $cookie_path);
   ini_set('session.cookie_domain', $cookie_domain);
 }

// set the session ID if it exists
  if (isset($HTTP_POST_VARS[tep_session_name()])) {
    tep_session_id($HTTP_POST_VARS[tep_session_name()]);
  } elseif ( ($request_type == 'SSL') && isset($HTTP_GET_VARS[tep_session_name()]) ) {
    tep_session_id($HTTP_GET_VARS[tep_session_name()]);
  }

// start the session
 $session_started = false;
 if (SESSION_FORCE_COOKIE_USE == 'True') {
   tep_setcookie('cookie_test', 'please_accept_for_session', time()+60*60*24*30, $cookie_path, $cookie_domain);

   if (isset($HTTP_COOKIE_VARS['cookie_test'])) {
     tep_session_start();
     $session_started = true;
   }
 } elseif (SESSION_BLOCK_SPIDERS == 'True') {
   $user_agent = strtolower(getenv('HTTP_USER_AGENT'));
   $spider_flag = false;

   if (tep_not_null($user_agent)) {
     $spiders = file(DIR_WS_INCLUDES . 'spiders.txt');

     for ($i=0, $n=sizeof($spiders); $i<$n; $i++) {
       if (tep_not_null($spiders[$i])) {
         if (is_integer(strpos($user_agent, trim($spiders[$i])))) {
           $spider_flag = true;
           break;
         }
       }
     }
   }

   if ($spider_flag == false) {
     tep_session_start();
     $session_started = true;
   }
 } else {
   tep_session_start();
   $session_started = true;
 }

// set SID once, even if empty
 $SID = (defined('SID') ? SID : '');

// verify the ssl_session_id if the feature is enabled
 if ( ($request_type == 'SSL') && (SESSION_CHECK_SSL_SESSION_ID == 'True') && (ENABLE_SSL == true) && ($session_started == true) ) {
   $ssl_session_id = getenv('SSL_SESSION_ID');
   if (!tep_session_is_registered('SSL_SESSION_ID')) {
     $SESSION_SSL_ID = $ssl_session_id;
     tep_session_register('SESSION_SSL_ID');
   }

   if ($SESSION_SSL_ID != $ssl_session_id) {
     tep_session_destroy();
     tep_redirect(tep_href_link(FILENAME_SSL_CHECK));
   }
 }

// verify the browser user agent if the feature is enabled
 if (SESSION_CHECK_USER_AGENT == 'True') {
   $http_user_agent = getenv('HTTP_USER_AGENT');
   if (!tep_session_is_registered('SESSION_USER_AGENT')) {
     $SESSION_USER_AGENT = $http_user_agent;
     tep_session_register('SESSION_USER_AGENT');
   }

   if ($SESSION_USER_AGENT != $http_user_agent) {
     tep_session_destroy();
     tep_redirect(tep_href_link(FILENAME_LOGIN));
   }
 }

// verify the IP address if the feature is enabled
 if (SESSION_CHECK_IP_ADDRESS == 'True') {
   $ip_address = tep_get_ip_address();
   if (!tep_session_is_registered('SESSION_IP_ADDRESS')) {
     $SESSION_IP_ADDRESS = $ip_address;
     tep_session_register('SESSION_IP_ADDRESS');
   }

   if ($SESSION_IP_ADDRESS != $ip_address) {
     tep_session_destroy();
     tep_redirect(tep_href_link(FILENAME_LOGIN));
   }
 }

// create the shopping cart & fix the cart if necesary
 if (tep_session_is_registered('cart') && is_object($cart)) {
   if (PHP_VERSION < 4) {
     $broken_cart = $cart;
     $cart = new shoppingCart;
     $cart->unserialize($broken_cart);
   }
 } else {
   tep_session_register('cart');
   $cart = new shoppingCart;
 }

// include currencies class and create an instance
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

// include the mail classes
 require(DIR_WS_CLASSES . 'mime.php');
 require(DIR_WS_CLASSES . 'email.php');

// set the language
 if (!tep_session_is_registered('language') || isset($HTTP_GET_VARS['language'])) {
   if (!tep_session_is_registered('language')) {
     tep_session_register('language');
     tep_session_register('languages_id');
   }

   include(DIR_WS_CLASSES . 'language.php');
   $lng = new language();

   if (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) {
     $lng->set_language($HTTP_GET_VARS['language']);
   } else {
     $lng->get_browser_language();
   }

   $language = $lng->language['directory'];
   $languages_id = $lng->language['id'];
 }

// include the language translations
 require(DIR_WS_LANGUAGES . $language . '.php');

// currency
 if (!tep_session_is_registered('currency') || isset($HTTP_GET_VARS['currency']) || ( (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') && (LANGUAGE_CURRENCY != $currency) ) ) {
   if (!tep_session_is_registered('currency')) tep_session_register('currency');

   if (isset($HTTP_GET_VARS['currency'])) {
     if (!$currency = tep_currency_exists($HTTP_GET_VARS['currency'])) $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
   } else {
     $currency = (USE_DEFAULT_LANGUAGE_CURRENCY == 'true') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY;
   }
 }

// navigation history
 if (tep_session_is_registered('navigation')) {
   if (PHP_VERSION < 4) {
     $broken_navigation = $navigation;
     $navigation = new navigationHistory;
     $navigation->unserialize($broken_navigation);
   }
 } else {
   tep_session_register('navigation');
   $navigation = new navigationHistory;
 }
 $navigation->add_current_page();

// Shopping cart actions
 if (isset($HTTP_GET_VARS['action'])) {
// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled
   if ($session_started == false) {
     tep_redirect(tep_href_link(FILENAME_COOKIE_USAGE));
   }

   if (DISPLAY_CART == 'true') {
     $goto =  FILENAME_SHOPPING_CART;
     $parameters = array('action', 'cPath', 'products_id', 'pid');
   } else {
     $goto = basename($PHP_SELF);
     if ($HTTP_GET_VARS['action'] == 'buy_now') {
       $parameters = array('action', 'pid', 'products_id');
     } else {
       $parameters = array('action', 'pid');
     }
   }
   switch ($HTTP_GET_VARS['action']) {
     // customer wants to update the product quantity in their shopping cart
     case 'update_product' : for ($i=0, $n=sizeof($HTTP_POST_VARS['products_id']); $i<$n; $i++) {
                               if (in_array($HTTP_POST_VARS['products_id'][$i], (is_array($HTTP_POST_VARS['cart_delete']) ? $HTTP_POST_VARS['cart_delete'] : array()))) {
                                 $cart->remove($HTTP_POST_VARS['products_id'][$i]);
                               } else {
                                 if (PHP_VERSION < 4) {
                                   // if PHP3, make correction for lack of multidimensional array.
                                   reset($HTTP_POST_VARS);
                                   while (list($key, $value) = each($HTTP_POST_VARS)) {
                                     if (is_array($value)) {
                                       while (list($key2, $value2) = each($value)) {
                                         if (ereg ("(.*)\]\[(.*)", $key2, $var)) {
                                           $id2[$var[1]][$var[2]] = $value2;
                                         }
                                       }
                                     }
                                   }
                                   $attributes = ($id2[$HTTP_POST_VARS['products_id'][$i]]) ? $id2[$HTTP_POST_VARS['products_id'][$i]] : '';
                                 } else {
                                   $attributes = ($HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]]) ? $HTTP_POST_VARS['id'][$HTTP_POST_VARS['products_id'][$i]] : '';
                                 }
                                 $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     // customer adds a product from the products page
     case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                               $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     // performed by the 'buy now' button in product listings and review page
     case 'buy_now' :        if (isset($HTTP_GET_VARS['products_id'])) {
                               if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
                                 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
                               } else {
                                 $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
     case 'notify' :         if (tep_session_is_registered('customer_id')) {
                               if (isset($HTTP_GET_VARS['products_id'])) {
                                 $notify = $HTTP_GET_VARS['products_id'];
                               } elseif (isset($HTTP_GET_VARS['notify'])) {
                                 $notify = $HTTP_GET_VARS['notify'];
                               } elseif (isset($HTTP_POST_VARS['notify'])) {
                                 $notify = $HTTP_POST_VARS['notify'];
                               } else {
                                 tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                               }
                               if (!is_array($notify)) $notify = array($notify);
                               for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
                                 $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $notify[$i] . "' and customers_id = '" . $customer_id . "'");
                                 $check = tep_db_fetch_array($check_query);
                                 if ($check['count'] < 1) {
                                   tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . $notify[$i] . "', '" . $customer_id . "', now())");
                                 }
                               }
                               tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action', 'notify'))));
                             } else {
                               $navigation->set_snapshot();
                               tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
                             }
                             break;
     case 'notify_remove' :  if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['products_id'])) {
                               $check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                               $check = tep_db_fetch_array($check_query);
                               if ($check['count'] > 0) {
                                 tep_db_query("delete from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . $HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
                               }
                               tep_redirect(tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action'))));
                             } else {
                               $navigation->set_snapshot();
                               tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
                             }
                             break;
     case 'cust_order' :     if (tep_session_is_registered('customer_id') && isset($HTTP_GET_VARS['pid'])) {
                               if (tep_has_product_attributes($HTTP_GET_VARS['pid'])) {
                                 tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['pid']));
                               } else {
                                 $cart->add_cart($HTTP_GET_VARS['pid'], $cart->get_quantity($HTTP_GET_VARS['pid'])+1);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
   }
 }

// include the who's online functions
 require(DIR_WS_FUNCTIONS . 'whos_online.php');
 tep_update_whos_online();

// include the password crypto functions
 require(DIR_WS_FUNCTIONS . 'password_funcs.php');

// include validation functions (right now only email address)
 require(DIR_WS_FUNCTIONS . 'validations.php');

// split-page-results
 require(DIR_WS_CLASSES . 'split_page_results.php');

// infobox
 require(DIR_WS_CLASSES . 'boxes.php');

// auto activate and expire banners
 require(DIR_WS_FUNCTIONS . 'banner.php');
 tep_activate_banners();
 tep_expire_banners();

// auto expire special products
 require(DIR_WS_FUNCTIONS . 'specials.php');
 tep_expire_specials();

// calculate category path
 if (isset($HTTP_GET_VARS['cPath'])) {
   $cPath = $HTTP_GET_VARS['cPath'];
 } elseif (isset($HTTP_GET_VARS['products_id']) && !isset($HTTP_GET_VARS['manufacturers_id'])) {
   $cPath = tep_get_product_path($HTTP_GET_VARS['products_id']);
 } else {
   $cPath = '';
 }

 if (tep_not_null($cPath)) {
   $cPath_array = tep_parse_category_path($cPath);
   $cPath = implode('_', $cPath_array);
   $current_category_id = $cPath_array[(sizeof($cPath_array)-1)];
 } else {
   $current_category_id = 0;
 }

// include the breadcrumb class and start the breadcrumb trail
 require(DIR_WS_CLASSES . 'breadcrumb.php');
 $breadcrumb = new breadcrumb;

 $breadcrumb->add(HEADER_TITLE_TOP, HTTP_SERVER);
 $breadcrumb->add(HEADER_TITLE_CATALOG, tep_href_link(FILENAME_DEFAULT));

// add category names or the manufacturer name to the breadcrumb trail
 if (isset($cPath_array)) {
   for ($i=0, $n=sizeof($cPath_array); $i<$n; $i++) {
     $categories_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$cPath_array[$i] . "' and language_id = '" . (int)$languages_id . "'");
     if (tep_db_num_rows($categories_query) > 0) {
       $categories = tep_db_fetch_array($categories_query);
       $breadcrumb->add($categories['categories_name'], tep_href_link(FILENAME_DEFAULT, 'cPath=' . implode('_', array_slice($cPath_array, 0, ($i+1)))));
     } else {
       break;
     }
   }
 } elseif (isset($HTTP_GET_VARS['manufacturers_id'])) {
   $manufacturers_query = tep_db_query("select manufacturers_name from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
   if (tep_db_num_rows($manufacturers_query)) {
     $manufacturers = tep_db_fetch_array($manufacturers_query);
     $breadcrumb->add($manufacturers['manufacturers_name'], tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id']));
   }
 }

// add the products model to the breadcrumb trail
 if (isset($HTTP_GET_VARS['products_id'])) {
   $model_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   if (tep_db_num_rows($model_query)) {
     $model = tep_db_fetch_array($model_query);
     $breadcrumb->add($model['products_model'], tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $cPath . '&products_id=' . $HTTP_GET_VARS['products_id']));
   }
 }

// initialize the message stack for output messages
 require(DIR_WS_CLASSES . 'message_stack.php');
 $messageStack = new messageStack;

// set which precautions should be checked
 define('WARN_INSTALL_EXISTENCE', 'true');
 define('WARN_CONFIG_WRITEABLE', 'true');
 define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true');
 define('WARN_SESSION_AUTO_START', 'true');
 define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true');
?>

Share this post


Link to post
Share on other sites
hello,

 

have installed yesterday header tag v.2.3.5 and get following error!

 

Warning: main(DIR_WS_FUNCTIONSheader_tags.php): failed to open stream: No such file or directory in /home/www/web/html/shop/includes/application_top.php on line 4

 

Fatal error: main(): Failed opening required 'DIR_WS_FUNCTIONSheader_tags.php' (include_path='.') in /home/www/web/html/shop/includes/application_top.php on line 4

 

can anybody help as i am new to php and cannt understand the problem!

will be very thank full for ur help:)

 

greetings

 

Noumi

Answered in your duplicate post here.

 

Jack

Share this post


Link to post
Share on other sites

Hey Jack:)

 

u mean i should add it to just on the bottom of /shop/includes/application_top.php

// BOF: WebMakers.com Added: Header Tags Controller v1.0
require(DIR_WS_FUNCTIONS . 'header_tags.php');

thanx for ur help! and great contribution:)

greetings

NOumi

Share this post


Link to post
Share on other sites

hey:)

 

it has worked!!!!!

 

thanx to all who worked on this contribution!!!!

 

 

had a question and it is how can i put all the infos in meta tags or how it worx because no i m getting the default descriptions!!

 

plz help that i can finish it ( m working on it since last evening approx 22 hours) :)

 

 

thanx again for help

 

greetings

 

Noumi

Share this post


Link to post
Share on other sites

hi again,

 

 

i have installed the contribution and it worx too but gives wrong infos can anybody tell me how can i edit my keywords, description and title?

 

the site is:

 

http://awanco.com

 

plz help want to finish it!

 

thanx

 

greetings

 

Noumi

Share this post


Link to post
Share on other sites

I posted a link to a thread where I went into depth on how to do this a few pages back.

 

Jack

Share this post


Link to post
Share on other sites

Is there some place/document that describes how this is supposed to be used once it is installed and what each field of the Metatag Information does or is related to? I've got it installed and running fine but I'm not quite clear on it.

 

Also, I think I remember reading about how the keywords section need to be seperated with commas; is this correct? I entered info into the keyword metadata field and when I checked the source code of the page for the item I noticed that the keyword section doesn't have commas and it is appending additional info without useing a comma. Here is the code I'm talking about

 

<!-- BOF: Generated Meta Tags -->

<title>fictional video card from matrox called the viper

this is on the products page - osCommerce : </title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<meta NAME="Description" Content="fictional video card from matrox called the viper

this is on the page header description osCommerce : What's New Here? - Hardware Software DVD Movies">

<meta NAME="Keywords" CONTENT="fictional, video, card, matrox, viper Hardware Software DVD Movies What's New Here?">

<meta NAME="Reply-to" CONTENT="christina@christinajs.com">

<meta NAME="Robots" CONTENT="index,follow">

 

<!-- EOF: Generated Meta Tags -->

 

I guess what I'm really looking for is a manual on operation/useage/hints/tips for this contribution.

 

Thanx, Dave.

Share this post


Link to post
Share on other sites

There's nothing describing these items AFAIK since they are common html tags. Just search on google for meta tags and spend a day going through all of the results. If you look back in this thread, I gave a link to a thread in which I describe how to create and use entries for pages. That might help a little.

 

You are correct - keywords should be comma seperated but HTC doesn't insert commas for you. It just enter whatever you have in the english/header_tags.php file.

 

Jack

Share this post


Link to post
Share on other sites

If you go to Christina J's in the upper left hand corner above the osCommerce logo is a lowercase 'n'.

 

I think it is from this install and it's easy to find in the source code of the web page but I can't find it in the actual code to remove it.

 

Any ideas?

 

Thanx, Dave.

Share this post


Link to post
Share on other sites

It's an extra character added to one of the header_tags files. This usually happens if you edit a file using the filemanager in admin.

 

Jack

Share this post


Link to post
Share on other sites

Thanx Jack.

 

One other problem that I just found though. When I click on Orders in the Admin section it gives me Parse error: parse error, unexpected '}' in /home/cjadmin/public_html/store/admin/orders.php on line 425. I've followed the directions again on a blank file and it does the same thing.

 

Here is a link to the file orders.php

 

Thanx, Dave.

Share this post


Link to post
Share on other sites

Just did a quick compare of that file with the standard OSC one and all that is different is the code for echeck. I would try reinstalling that part of the code.

 

Jack

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×