Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Header Tag Controller - default.php/index.php "tip&quot


VJ

Recommended Posts

Hello,

 

I use index.php as my home page, and had a little hiccup getting the Linda's Header Tag Controller to work as it should.

 

Just thought this "tip" could help, if you use Linda's Header Tag Controller contrib... especially for users who use "index.php" instead of the default "default.php" as their home page.

 

In file /catalog/includes/header_tags.php, replace

 

(at around line 20)

// DEFAULT.PHP

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

 

with,

 

// DEFAULT.PHP

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

 

 

HTH,

VJ

Link to comment
Share on other sites

  • 1 month later...

I cannot find ANY referance to <title> when doing an in text search through all the files in /catalog/*.* <including sub directories.

where exactly do I find the title tag in the header? I'm running 2.2 MS2

 

 

Replace the existing line in all files that you want to use the Header Tags Controller:

Old Line:

<title><?php echo TITLE ?></title>

New Lines:

<?php

// BOF: WebMakers.com Changed: Header Tag Controller v1.0

// Replaced by header_tags.php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

<title><?php echo TITLE ?></title>

<?php

}

// EOF: WebMakers.com Changed: Header Tag Controller v1.0

?>

Link to comment
Share on other sites

Maybe your text editor doesn't handle the '<', '>' too well. Have you tried a search for 'TITLE'?

 

If it still doesn't bring anything, I guess you might have replaced the existing title tags accidentally (I've done that while doing mass search/replace). In that case you can just paste the header tag controller code anywhere between the '<head>' and '</head>' tags in /catalog/*.php files.

 

Hope this helps,

VJ

Link to comment
Share on other sites

I cannot find <title><?php echo TITLE ?></title>

 

all of my files except 2 (which are added files from other things I have installed) have <title><?php echo TITLE; ?></title>

 

notice the extra semi colon.... can I still just change?

Angela

Link to comment
Share on other sites

In PHP, the semi-colon after the last statement before the "?>" is redundant. For example,

 

<?php

statement1;

statement2;

statement3;

?>

 

and,

 

<?php

statement1;

statement2;

statement3

?>

 

are both valid. So, you can go ahead and make the changes.

 

HTH,

VJ

Link to comment
Share on other sites

Does anyone know which version of the header tag controller contribution is the correct one to use for a snapshot version of oscommerce from 4/2003?

 

thanks

Link to comment
Share on other sites

  • 2 months later...

I installed Header Tags Controller and the Admin. I have two major issues.

I've gone through all the posts in this thread and many others. I've tried the suggested solutions and still having challenges getting them fixed.

 

When ever I click on any individual product or category I get the following:

 

 

1064 - You have an error in your SQL syntax near 'and c.parent_id = '21' and c.categories_id = cd.categories_id and cd.language_id' at line 1

 

select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where and c.parent_id = '21' and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name

 

TEP STOP

 

 

Here is an example of the address it goes to when I click a product:

 

 

 

 

 

Second when I am in Admin and go to edit a product, the Meta Tags forms look correct but after previewing upon clicking to update product info I go the the following screan:

 

 

1054 - Unknown column 'products_head_title_tag' in 'field list'

 

update products set products_quantity = '49', products_model = '', products_price = '1.0000', products_date_available = null, products_weight = '0.00', products_status = '1', products_tax_class_id = '1', manufacturers_id = '', products_head_title_tag = '', products_head_desc_tag = '', products_head_keywords_tag = '', products_image = 'j0178039_small.jpg', products_last_modified = now() where products_id = '41'

 

TEP STOP

 

 

I've got the entries in my database under products_descriptions as required. They do not show on the main list of fields but they do show under products_descriptions. I've played with the null values, turning on and off, droped and re-added to DB with no success.

 

Possible relevant Code:

 

Catolog\Admin\Catagories.php

 

  

<?php
  $categories_count = 0;
  $rows = 0;
  if (isset($HTTP_GET_VARS['search'])) {
    $search = tep_db_prepare_input($HTTP_GET_VARS['search']);

    $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
  } else {
    $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
  }
  while ($categories = tep_db_fetch_array($categories_query)) {
    $categories_count++;
    $rows++;

// Get parent_id for subcategories if search
    if (isset($HTTP_GET_VARS['search'])) $cPath= $categories['parent_id'];

    if ((!isset($HTTP_GET_VARS['cID']) && !isset($HTTP_GET_VARS['pID']) || (isset($HTTP_GET_VARS['cID']) && ($HTTP_GET_VARS['cID'] == $categories['categories_id']))) && !isset($cInfo) && (substr($action, 0, 3) != 'new')) {
      $category_childs = array('childs_count' => tep_childs_in_category_count($categories['categories_id']));
      $category_products = array('products_count' => tep_products_in_category_count($categories['categories_id']));

      $cInfo_array = array_merge($categories, $category_childs, $category_products);
      $cInfo = new objectInfo($cInfo_array);
    }

    if (isset($cInfo) && is_object($cInfo) && ($categories['categories_id'] == $cInfo->categories_id) ) {
      echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '\'">' . "\n";
    } else {
      echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '\'">' . "\n";
    }
?>

 

 

 

 

<?php
} elseif ($action == 'new_product_preview') {
  if (tep_not_null($HTTP_POST_VARS)) {
    $pInfo = new objectInfo($HTTP_POST_VARS);
    $products_name = $HTTP_POST_VARS['products_name'];
    $products_description = $HTTP_POST_VARS['products_description'];
    $products_head_title_tag = $HTTP_POST_VARS['products_head_title_tag'];
    $products_head_desc_tag = $HTTP_POST_VARS['products_head_desc_tag'];
    $products_head_keywords_tag = $HTTP_POST_VARS['products_head_keywords_tag'];
    $products_url = $HTTP_POST_VARS['products_url'];
 //BOF Header Tag Controler
 //Added the following 3 lines
 $products_head_title_tag = $HTTP_POST_VARS['products_head_title_tag'];
 $products_head_desc_tag = $HTTP_POST_VARS['products_head_desc_tag'];
 $products_head_keywords_tag = $HTTP_POST_VARS['products_head_keywords_tag'];
 //EOF Header Tag Controler
  } else {
    //BOF Header Tag Controler
 $product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "'");

    $product = tep_db_fetch_array($product_query);
 //EOF Header Tag Controler
    //$product = tep_db_fetch_array($product_query);
 
    $pInfo = new objectInfo($product);
    $products_image_name = $pInfo->products_image;
  }

  $form_action = (isset($HTTP_GET_VARS['pID'])) ? 'update_product' : 'insert_product';

  echo tep_draw_form($form_action, FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

 

 

I've been working for over 100 Hours on these two problems. Hopefully I didn't miss the answer somewhere. I will post the results of any suggestions given so others will know if they worked for this and will post a final recap when issues are solved to help others.

 

osCommerce 2.2ms2

 

Contribs:

Header Tag Controller Admin MS 2.2i

 

Header Tags Controller v2.1

 

All-Prods-v2.61)

 

 

Thanks,

Adam

Link to comment
Share on other sites

This problem has been resolved:

 

1064 - You have an error in your SQL syntax near 'and c.parent_id = '21' and c.categories_id = cd.categories_id and cd.language_id' at line 1

 

select c.categories_id, cd.categories_name, c.parent_id from categories c, categories_description cd where and c.parent_id = '21' and c.categories_id = cd.categories_id and cd.language_id='1' order by sort_order, cd.categories_name

 

TEP STOP

 

Restored all original files All-Prods-v2.61 had me modify in it's installation process and it fixed the problem. I then altered the files to the All-Prods Specs and the system works properly again. Now I will remove and re-edit Controller Files to attemt to resolve problem below.

 

This problem remains unresolved:

 

1054 - Unknown column 'products_head_title_tag' in 'field list'

 

update products set products_quantity = '49', products_model = '', products_price = '1.0000', products_date_available = null, products_weight = '0.00', products_status = '1', products_tax_class_id = '1', manufacturers_id = '', products_head_title_tag = '', products_head_desc_tag = '', products_head_keywords_tag = '', products_image = 'j0178039_small.jpg', products_last_modified = now() where products_id = '41'

 

TEP STOP

Link to comment
Share on other sites

Second Problem Solved:

 

I mixed up the edits from:

 

Add Metta Tags to Product Pages with Header Tag Controller Admin MS 2.2i

 

Re-Edited my original file: catalog/admin/categories.php and updated with changes required by Header Tag Controller Admin MS 2.2i and the problem was solved.

 

Not a database issue, just need to be more attentive to the directions.

 

Good luck to the rest of you, nice contrib.

Link to comment
Share on other sites

I thought everything was working, but when I go to an individual item page, I get the following:

 

Fatal error: Call to undefined function: clean_html_comments() in /home/linda/public_html/catalog/includes/header_tags.php on line 79

 

I tried adding a require for the clean_html_comments.php page, but then I got a redeclare error...

 

Any ideas?

Link to comment
Share on other sites

Sorry... I'm running a newly installed version 2.2 MS2 snapshot.

 

I also had to comment out the modification code in 'application_top.php' because I was getting this:

 

Fatal error: Cannot redeclare clean_html_comments() (previously declared in /home/linda/public_html/catalog/includes/functions/clean_html_comments.php:13) in /home/linda/public_html/catalog/includes/functions/clean_html_comments.php on line 13

 

Hope that helps...

Link to comment
Share on other sites

  • 4 months later...
  • 2 weeks later...
  • 3 weeks later...

I've installed my shopping cart to a new site that I'm building so I need to change the title and metatags. Problem is that I can't figure out where.

 

The page source on the home page reads

 

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

  <META NAME="Reply-to" CONTENT="[email protected]">

  <META NAME="Description" Content="Supplier of red worms and european nightcrawlers for both fishing and vermicomposting ... Supplier of red worms and european nightcrawlers for both fishing and vermicomposting.">

  <META NAME="Keywords" CONTENT="red worms european nightcrawlers earthworms vemiculture vermicomposting live bait wholesale books bins worm farming red worms european nightcrawlers earthworms vemiculture vermicomposting live bait wholesale books bins worm farming ">

  <title>Jenkins Creek Farms  </title>

 

 

The code on the index page reads

 

<?php

// BOF: WebMakers.com Changed: Header Tag Controller v1.0

// Replaced by header_tags.php

if ( file_exists(DIR_WS_INCLUDES . 'header_tags.php') ) {

  require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

  <title><?php echo TITLE ?></title>

 

So where do I look to make this change?

Confused worm farmer looking for assistance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...