Jump to content
Sign in to follow this  
Farrukh

[Contribution] Header Tags Controller for Admin MS 2.2

Recommended Posts

I understand. The difference between a standard categories file with Header Tags installed and one with Header Tags and Ultimate SEO installed is one or two lines near the top of the file. You said you didn't know how to add the code in for Ultimate SEO. I answered how to find that out. If adding those few lines breaks your shop, then one of the contributions is installed incorrectly since they work great together.

 

Jack

Share this post


Link to post
Share on other sites

actually there is more then just a few lines at the beginning.

At least using winmerge, there is more then just the ones up front.

 

I'll figure it out.

Share this post


Link to post
Share on other sites

Then you are looking at the wrong contribution. Here is the total change for categories.php

// Ultimate SEO URLs v2.1
// If the action will affect the cache entries
if ( eregi("(insert|update|setflag)", $action) ) include_once('includes/reset_seo_cache.php');

 

Jack

Share this post


Link to post
Share on other sites

Can anyone help me out, I'm getting an error not addressed by the readme files of Header tags v2.6.1

 

The header tags shows up in my admin panel at this point but I receive the following error when I click it.

 

Fatal error: Cannot redeclare changeswitch() (previously declared in /home/content/j/w/s/jws8118/html/oscommerce/catalog/admin/includes/functions/header_tags.php:12) in /home/content/j/w/s/jws8118/html/oscommerce/catalog/admin/includes/functions/header_tags.php on line 12

 

Please respond with any help you can come up with. I just did the install this morning and I'm sure I followed the instructions perfectly.

 

Thanks,

 

James

Share this post


Link to post
Share on other sites
Can anyone help me out, I'm getting an error not addressed by the readme files of Header tags v2.6.1

 

The header tags shows up in my admin panel at this point but I receive the following error when I click it.

 

Fatal error: Cannot redeclare changeswitch() (previously declared in /home/content/j/w/s/jws8118/html/oscommerce/catalog/admin/includes/functions/header_tags.php:12) in /home/content/j/w/s/jws8118/html/oscommerce/catalog/admin/includes/functions/header_tags.php on line 12

 

Please respond with any help you can come up with. I just did the install this morning and I'm sure I followed the instructions perfectly.

 

Thanks,

 

James

 

 

Ok well I actually think I fixed it. All I did was open the file mentioned above and comment out the

function Changeswtich command on the first line of code.

 

Let me know if anyone thinks that will cause greater errors for me later on. Also would be interested in understanding why this would have happened in the first place.

 

I'm new to php but very interested in learning!

 

Thanks,

 

JS

Share this post


Link to post
Share on other sites

That will break the code. You need to find out why the code is being added twice to fix it correctly.

 

Jack

Share this post


Link to post
Share on other sites
actually there is more then just a few lines at the beginning.

At least using winmerge, there is more then just the ones up front.

 

I'll figure it out.

John, you are probably seeing differences in the file because the two catagory files are most likely from different versions of osCommerce. But in any case, Jack is correct in saying that there is only a few lines of code at the beginning of the file that needs to be modified for SEO and those modifications in no way effect HTC.

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Share this post


Link to post
Share on other sites

Help!

 

I need a little bit of help in installing the HTC. I have already installed SEO which makes my editing of the configuration.php file a bit of a challenge (more than I can bite). So any help you folks can provide, would be more than appreciated!!

 

The code that I have problems in implementing:

 

 

 

=================================================================== 
Around line 519, find this section of code	

<?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', (($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($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>

 

Replace with the following

 

<!-- HTC BOC //-->
<?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']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>
		  </tr>
		</table></td>
	  </tr>
<?php
}
?>
	  <tr>
		<td colspan="2" class="main"><hr><?php echo TEXT_PRODUCT_METTA_INFO; ?></td>
	  </tr>
	  <tr>
		<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	  </tr>		  
<?php		 
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
	  <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']]) ? stripslashes($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']]) ? stripslashes($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']]) ? stripslashes($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>
<!-- HTC EOC //-->

 

My original configuration.php looks like this:

 

<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
  <tr>
	<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_SEO_URL; ?></td>
	<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_seo_url[' . $languages[$i]['id'] . ']', (isset($products_seo_url[$languages[$i]['id']]) ? $products_seo_url[$languages[$i]['id']] : tep_get_products_seo_url($pInfo->products_id, $languages[$i]['id']))); ?></td>
   </tr>
<?php
}
?>
   <tr>
	 <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
   </tr>

 

So how do I install it here??

 

Again, thanks so much for your help!!

 

-Thomp

Share this post


Link to post
Share on other sites

That section of code to be added for Header Tags is just for the display of the boxes. So it can go just about anywhere (as long as coding rules are followed). Just insert it right before the last section of code you posted.

 

Jack

Share this post


Link to post
Share on other sites

Jack I figured it out.

MY MESSUP - I was editing the incorrect configuration file - oops.

ALL works now, thanks

 

So if you follow the instructions to a 'tee' it does work correctly. :)

Share this post


Link to post
Share on other sites

Hi all..

 

Well I installed this just fine, or so i thought.. everything seems to work ok. but when i try to edit a product or tyr to add a new one, the product name disappears...

 

The problem must have accurred when i edited the configure file

I know its a peice of code thats missing, but havent a clue where it is or where to edit.

 

Can anyone let me know?

 

Thanks Tom.

Share this post


Link to post
Share on other sites

This is a common mistake in the installation for some reason. There is a problem in your admin/categories.php file. You can compare to the one in the contribution to find the problem.

 

Jack

Share this post


Link to post
Share on other sites
This is a common mistake in the installation for some reason. There is a problem in your admin/categories.php file. You can compare to the one in the contribution to find the problem.

 

Jack

 

Thanks jack. worked like a dream

Share this post


Link to post
Share on other sites

I'm not getting the catagory name or description showing on the page ?

 

what could be the reason ? the code is in place ?

 

Have i missed something?

Share this post


Link to post
Share on other sites

I installed this contribution last night and everthing works fine..... except when I click on any of the the categories I get the following code appear between the top and the rest of the page:

 

if (isset($HTTP_GET_VARS['manufacturers_id'])) $db_query = tep_db_query("select manufacturers_htc_title_tag as htc_title, manufacturers_htc_description as htc_description from " . TABLE_MANUFACTURERS_INFO . " where languages_id = '" . (int)$languages_id . "' and manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); else $db_query = tep_db_query("select categories_htc_title_tag as htc_title, categories_htc_description as htc_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'"); $htc = tep_db_fetch_array($db_query); ?>

 

I'm guessing that when I cut'n'pasted some code I cut over something I shouldn't have. but I have looked and can't work out where - any pointers

 

If you want to look at the site to see what I mean check out:

 

http://www.katipo.net.nz

 

and where the error shows up:

 

http://katipo.net.nz/index.php/cPath/48?os...a8c8c87cdbdbb5b

 

Thanks

Share this post


Link to post
Share on other sites
I'm not getting the catagory name or description showing on the page ?

 

what could be the reason ? the code is in place ?

 

Have i missed something?

Same problem as the post above yours. Just compare your categories file with the included one.

 

Jack

Share this post


Link to post
Share on other sites
I installed this contribution last night and everthing works fine..... except when I click on any of the the categories I get the following code appear between the top and the rest of the page:

 

if (isset($HTTP_GET_VARS['manufacturers_id'])) $db_query = tep_db_query("select manufacturers_htc_title_tag as htc_title, manufacturers_htc_description as htc_description from " . TABLE_MANUFACTURERS_INFO . " where languages_id = '" . (int)$languages_id . "' and manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); else $db_query = tep_db_query("select categories_htc_title_tag as htc_title, categories_htc_description as htc_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'"); $htc = tep_db_fetch_array($db_query); ?>

 

I'm guessing that when I cut'n'pasted some code I cut over something I shouldn't have. but I have looked and can't work out where - any pointers

 

If you want to look at the site to see what I mean check out:

 

http://www.katipo.net.nz

 

and where the error shows up:

 

http://katipo.net.nz/index.php/cPath/48?os...a8c8c87cdbdbb5b

 

Thanks

There's a mistake in your index.php file. Most likely, you forgot to copy a php delimiter tag so the code you added is being seen as text for the page.

 

Jack

Share this post


Link to post
Share on other sites
if (isset($HTTP_GET_VARS['manufacturers_id'])) $db_query = tep_db_query("select manufacturers_htc_title_tag as htc_title, manufacturers_htc_description as htc_description from " . TABLE_MANUFACTURERS_INFO . " where languages_id = '" . (int)$languages_id . "' and manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); else $db_query = tep_db_query("select categories_htc_title_tag as htc_title, categories_htc_description as htc_description from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$current_category_id . "' and language_id = '" . (int)$languages_id . "'"); $htc = tep_db_fetch_array($db_query); ?>

 

I'm guessing that when I cut'n'pasted some code I cut over something I shouldn't have. but I have looked and can't work out where - any pointers

 

The file you need to look at is catalog/index.php

 

not sure what you've done , prolly pasted the code in the wrong place. go over the install instructions for index.php.

Share this post


Link to post
Share on other sites

Jack? any idea where i've gone wrong in the catagory titles not showing ?

 

is there any other file other than index.php that controls the catagory title ?

 

i've checked my install and it all looks fine , i'm getting no errors , just no catagory title showing.

Share this post


Link to post
Share on other sites

I've checked through admin/catagories and it's all as it should be apart from one section of code that i had trouble with , maybe i've edited this incorrectly?

 

It was clashing with the extra fields contrib , so i edited it as best i could. It all seemed to worked ok , so it took me awhile to realise that the catagory title and description were not working.

 

this is the install instructions for the section that isn't quite right

 

Around line 394, find this lines

if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {
  $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
  $product = tep_db_fetch_array($product_query);

Replace with the following

  //HTC BOC
  if (isset ($HTTP_GET_VARS['pID']) && (!$HTTP_POST_VARS) ) {
  $product_query = tep_db_query("select 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_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
  $product = tep_db_fetch_array($product_query);							
  //HTC EOC

 

 

And i have in place this.....

 

 

<?php
 if ($action == 'new_product') {
$parameters = array('products_name' => '',
				   'products_description' => '',
				   'products_url' => '',
				   'products_id' => '',
				   'products_quantity' => '',
				   'products_model' => '',
				   'products_image' => '',
				   'products_price' => '',
				   'products_weight' => '',
				   'products_date_added' => '',
				   'products_last_modified' => '',
				   'products_date_available' => '',
				   'products_status' => '',
				   'products_tax_class_id' => '',
				   'manufacturers_id' => '');

$pInfo = new objectInfo($parameters);

if (isset ($HTTP_GET_VARS['pID']) && (!$HTTP_POST_VARS) ) {
// START: Extra Fields Contribution	  
  $products_extra_fields_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " WHERE products_id=" . (int)$HTTP_GET_VARS['pID']);
  while ($products_extra_fields = tep_db_fetch_array($products_extra_fields_query)) {
  $extra_field[$products_extra_fields['products_extra_fields_id']] = $products_extra_fields['products_extra_fields_value'];
  }
  $extra_field_array=array('extra_field'=>$extra_field);
  $pInfo->objectInfo($extra_field_array);
// END: Extra Fields Contribution
  //HTC BOC
  $product_query = tep_db_query("select 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_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");
  $product = tep_db_fetch_array($product_query);							
  //HTC EOC 

  $pInfo->objectInfo($product);
} elseif (tep_not_null($HTTP_POST_VARS)) {
  $pInfo->objectInfo($HTTP_POST_VARS);
  $products_name = $HTTP_POST_VARS['products_name'];
  $products_description = $HTTP_POST_VARS['products_description'];
  $products_url = $HTTP_POST_VARS['products_url'];
}

$manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));
$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");
while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {
  $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],
								 'text' => $manufacturers['manufacturers_name']);
}

$tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));
$tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");
while ($tax_class = tep_db_fetch_array($tax_class_query)) {
  $tax_class_array[] = array('id' => $tax_class['tax_class_id'],
							 'text' => $tax_class['tax_class_title']);
}

$languages = tep_get_languages();

if (!isset($pInfo->products_status)) $pInfo->products_status = '1';
switch ($pInfo->products_status) {
  case '0': $in_status = false; $out_status = true; break;
  case '1':
  default: $in_status = true; $out_status = false;
}
?>

 

I've posted a bit more code than the contribs modify.

 

could this be where the problem lies or should i be looking in another section of admin/catagories ?

 

 

Only one catagory is working and this has a sub-catagory , it is the only sub-catagory on the site. all the others don't have subs....don't know if this gives a clue ? but the sub-catagories themselves don't have a title either.... :blink:

 

 

any help appreciated ... even a hint where to look

 

cheers

Share this post


Link to post
Share on other sites
I've posted a bit more code than the contribs modify.

 

could this be where the problem lies or should i be looking in another section of admin/catagories ?

Only one catagory is working and this has a sub-catagory , it is the only sub-catagory on the site. all the others don't have subs....don't know if this gives a clue ? but the sub-catagories themselves don't have a title either.... :blink:

any help appreciated ... even a hint where to look

 

cheers

The line numbers in the instructions are for a stock shop. If your file has been heavily modified, they probably won't be very close. When that happens, as with any contribution, you have to try to figure out where the code should go. Sometimes that is very difficult. But I haven't an across a categories file yet that Header Tags couldn't be added to.

 

Jack

Edited by Jack_mcs

Share this post


Link to post
Share on other sites

I'm trying to update from HTC 2.59 to 2.61. No problem on the inital edits. But I'm unsure about 2 things.

 

1 - Are the category descriptions update needed for this? Any other changes beyond the update text?

 

2 - The catalog/includes/header_tags.php is very different from mine. The main difference seems to be the queries. No queries in my original file. I have the Disable/Enable contribution installed. Will I need to edit all the queries to adapt them for c.categories_status = 1?

 

BTW - The update instructions mention update from 2.59 to 2.60 not 2.61. Those are the instructions I'm using.

 

Thanks for the assistance.

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  

×