Jump to content
Sign in to follow this  
Farrukh

[Contribution] Header Tags Controller for Admin MS 2.2

Recommended Posts

Also just wanted to post a thank you to Bill Kellum - I couldn't figure out how to edit my last post :blush:

Share this post


Link to post
Share on other sites

I have added this contribution and everything works great.... but I want to take it a step further.

 

The images displayed on the index.php page when you roll over them show the 'product_name' and I would like them to say the title of that product. I found that index.php pulls the title and alt tags from the module product_listing.php. If you look on product_listing.php around line 127 you will see...

 

case 'PRODUCT_LIST_IMAGE':

$lc_align = 'center';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, ' class=br') . '</a>';

} else {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, ' class=br') . '</a> ';

}

break;

 

The part listed in red is what I think needs to be changed in order to show the title of the page it points too. I just don't know what code to change it too. Can anyone help? I've tried replacing it with TITLE and that just shows the title of the page your on... I want it to show what it is pointing too. I think from looking at the header_tags.php it might have to be something like $the_product_info['products_head_title_tag'] but then that doesn't show anything. Can someone please help me I'm at a loss. :blink:

Edited by redbulladdict

Share this post


Link to post
Share on other sites

The mouseover text is taken from the products name, as is the header tags title, so they all should match as is, without additional code changes. If not, then your code may have been changed somehow to prevent that.

 

Jack

Share this post


Link to post
Share on other sites

Thanks Jack

 

Yeah, it works just fine showing the product name but the <br> tags on the roll over and it looks ugly.... I was just wondering if I could put some code in place of it to show the title instead of the name showing all the br tags

 

eample of my site:

 

http://www.fordtrucksrock.com/ford-truck-a...s-c-63_130.html

 

Note the <br /> on roll over

Edited by redbulladdict

Share this post


Link to post
Share on other sites

Hey jack, I am adding the HTC contrib on my third site and this is the first time I've had a problem. I know that you have heard this before but all the conventional solutions have not worked to this point. Here's the issue:

 

I have installed the contrib as usual, and set the permissions correctly. When I press the Update button, I get "The file isn't writable".

 

Initially I got:

 

Warning: chmod(): Operation not permitted in /home/xxxxxx/public_html/admin/includes/functions/header_tags.php on line 203

Cannot change the mode of file (../includes/languages/english/header_tags.php)

 

so i opened: catalog/admin/includes/functions/header_tags.php and made the recommended changes.

 

if (!is_writable($filename))

{

if (!chmod($filename, 0666)) {

echo "Cannot change the mode of file ($filename)";

exit;

}

}

 

Replced that with the following code:

 

if (!is_writable($filename))

{

echo "The file isn't writable";

exit;

/* if (!chmod($filename, 0666)) {

echo "Cannot change the mode of file ($filename)";

exit;

} */

}

 

I pressed Update and got "The file isn't writable".

 

Again I checked the permissions and they are set to 755. 777 doesn't work. What do you think?


"Artificial intelligence is no match for natural stupidity"

Share this post


Link to post
Share on other sites
Thanks Jack

 

Yeah, it works just fine showing the product name but the <br> tags on the roll over and it looks ugly.... I was just wondering if I could put some code in place of it to show the title instead of the name showing all the br tags

 

eample of my site:

 

http://www.fordtrucksrock.com/ford-truck-a...s-c-63_130.html

 

Note the <br /> on roll over

If you have html tags in the title, you can remove those by enclosing the alt text in strip_tags().

 

Jack

Share this post


Link to post
Share on other sites
Hey jack, I am adding the HTC contrib on my third site and this is the first time I've had a problem. I know that you have heard this before but all the conventional solutions have not worked to this point. Here's the issue:

 

I have installed the contrib as usual, and set the permissions correctly. When I press the Update button, I get "The file isn't writable".

 

Initially I got:

 

Warning: chmod(): Operation not permitted in /home/xxxxxx/public_html/admin/includes/functions/header_tags.php on line 203

Cannot change the mode of file (../includes/languages/english/header_tags.php)

 

so i opened: catalog/admin/includes/functions/header_tags.php and made the recommended changes.

 

if (!is_writable($filename))

{

if (!chmod($filename, 0666)) {

echo "Cannot change the mode of file ($filename)";

exit;

}

}

 

Replced that with the following code:

 

if (!is_writable($filename))

{

echo "The file isn't writable";

exit;

/* if (!chmod($filename, 0666)) {

echo "Cannot change the mode of file ($filename)";

exit;

} */

}

 

I pressed Update and got "The file isn't writable".

 

Again I checked the permissions and they are set to 755. 777 doesn't work. What do you think?

Changing that code like that only hides the problem. The reason for the failure is because the file is not being seen as writeable, which is probably due to some setting on the server, assuming the permissions are correct.

 

Jack

Share this post


Link to post
Share on other sites
Changing that code like that only hides the problem. The reason for the failure is because the file is not being seen as writeable, which is probably due to some setting on the server, assuming the permissions are correct.

 

Jack

 

Thanks for the reply Jack. My other two installations are on different servers, but at the same hosting company. I also set the permissions on those other two at 777 not 755. The error message in the admin of my new install tells me to set it to 755. I have to figure some way to check the server settings, but this one has me stumped, if anyone has any ideas please let me know.

 

P.S. Jack: This is still a killer contribution and I for one appreciate the work that you put in on it. Thanks.


"Artificial intelligence is no match for natural stupidity"

Share this post


Link to post
Share on other sites

I have added this contribution and everything works great.... but I want to take it a step further.

 

The images displayed on the index.php page when you roll over them show the 'product_name' and I would like them to say the title of that product. I found that index.php pulls the title and alt tags from the module product_listing.php. If you look on product_listing.php around line 127 you will see...

 

case 'PRODUCT_LIST_IMAGE':

$lc_align = 'center';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, ' class=br') . '</a>';

} else {

$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT, ' class=br') . '</a> ';

}

break;

 

The part listed in red is what I think needs to be changed in order to show the title of the page it points too. I just don't know what code to change it too. Can anyone help? I've tried replacing it with TITLE and that just shows the title of the page your on... I want it to show what it is pointing too. I think from looking at the header_tags.php it might have to be something like $the_product_info['products_head_title_tag'] but then that doesn't show anything.

 

Here is a picture describing what I am seeing.... (PLEASE NOTE THE BR TAGS) in the roll over box is the purpose of this change . Also this is a php page it is redirected to look like an html page for SEO reasons. Can anyone please help?

 

screenshot.jpg

Edited by redbulladdict

Share this post


Link to post
Share on other sites
Thanks for the reply Jack. My other two installations are on different servers, but at the same hosting company. I also set the permissions on those other two at 777 not 755. The error message in the admin of my new install tells me to set it to 755. I have to figure some way to check the server settings, but this one has me stumped, if anyone has any ideas please let me know.

Different servers with the same hosting company can have different levels of php and mysql, as well as different settings so you may want to check with your host to see if there is a difference. The code is telling you to set them to 755 because that is what it is reading from the images directory. You might want to check that yourself since the script may not be returning the proper permissions.

 

P.S. Jack: This is still a killer contribution and I for one appreciate the work that you put in on it. Thanks.
I appreciate that - thanks. :)

 

Jack

Share this post


Link to post
Share on other sites
It means you made a mistake in the installation and wrote over a php delimiter, or didn't copy one. You should revert back to your original file and try again.

 

Jack

Hey, Jack:

 

Thanks a lot for your help as always! I covered the index.php file with the original file and re-edited it, the error didnot appear again but the titel etc. didnot seem ok. So I realized I could not just re-edited the original index.php file. I compared the newly-edited index.php file with the previously-edited index.php file, I found the problem with the previously-edited index.php file was, I did not overwrite the "?>" on line 246. So I changed the previously-edited index.php file ( namely erase the "?>" on line 246 ) and everything is ok now. I am sorry to bother you with such careless question.

 

With you a happy holiday season!

Share this post


Link to post
Share on other sites

Hi,

 

First of all, thanks for this great contri and support!

 

I have installed this contri in my Osc v2.2rc1 and have a problem making this part working in product_info.php:

 

<td class="smallText" align="center"><?php echo TEXT_VIEWING; ?> 
   <?php echo '<a title="' . $tags_array['title'] . '" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'], 'NONSSL') . '"/# ' . $tags_array['title'] . '">' . $tags_array['title']; ?></a></td>

 

I must say I have a modified product_info.php but even with the original one the link is invissable...

I do see the text "Currently viewing:" but the rest of the code really messes up my page.

The source code shows me the link though, but in the browser it's not vissable.

I already tried moving it to different positions in the page, no luck... :'(

Stylesheet looks OK.

 

It looks like this part of the link messes up things: "/# '

 

Can somebode please help me out here... :blush:

 

Thanks!

 

Kind regards,

 

Arne.

Share this post


Link to post
Share on other sites

That code is just a standard html anchor so it won't matter which version you are using. The only reason I can think that it would cause a problem is if it is not installed in the correct place. If that were the case, the alignment of the page would be corrupted, which it sounds like it is. You can skip that step if you like. Otherwise, you will need to figure out the correct placement. By the way, the code you posted is not the full code. I'm assuming you only posted part of it on purpose but, if not, that would be the problem.

 

Jack

Share this post


Link to post
Share on other sites

Hi Jack,

 

Thanks for answering!

 

Jack, I did all the mods in product_info.php the instructions are telling me... ;)

 

I don't want to be a wiseXXXX Jack but are you really sure this piece of code to build the link is correct??

 

	  
   <?php echo '<a title="' . $tags_array['title'] . '" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'], 'NONSSL') . '"/# ' . $tags_array['title'] . '">' . $tags_array['title']; ?></a

 

To me it looks like there is missing one " somewhere and I think it is behind the /#

When I add a " here all looks ok... :rolleyes:

 

	  
   <?php echo '<a title="' . $tags_array['title'] . '" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'], 'NONSSL') . '"/# "' . $tags_array['title'] . '">' . $tags_array['title']; ?></a

 

Please tell me what you think about this Jack.

 

Kind regards,

 

Arne.

Share this post


Link to post
Share on other sites

BTW Jack, this is the way the link looks like viewing the source code (IE):

 

<a title="verbeter weerstand" href="http://www.mysite.com/verbeter-weerstand-capsules-p-60.html?osCsid=a3eb7939b2a6d2225be7a46e6b13d3ca"/# verbeter weerstand">verbeter weerstand</a>

 

Please have a look at the red " signs... Five off them... ?? :wacko: :wacko:

 

Jack, I never saw /# used in a link this way... :blink:

 

Kind regards,

 

Arne.

Edited by ArneK

Share this post


Link to post
Share on other sites

It's called an anchor link and is normal html. That code has been in the contribution for most of the year and works in many shops. But like I said, not using it is an option.

 

Jack

Share this post


Link to post
Share on other sites

Thanks Jack!

 

Jack, what do you think about these, are the called "quotes"?

Shouldn't they be used in pairs?

 

Jack, when I cut the link part from the produced sourcecode (IE) and paste it into the original product_info.php, Dreamweaver is telling me (tag color) that

something is wrong with my markup...

 

Kind regards,

 

Arne.

Share this post


Link to post
Share on other sites

Please feel free to alter the code as you see fit. That is the joy of open source.

 

Jack

Share this post


Link to post
Share on other sites

Hi, I installed this contrib and it seemed to be going well until I tried to access the admin, at which time I got the 'page cannot be found' message. With this in the address bar: /admin/FILENAME_LOGIN

 

This is the second time I've tried it with the same results. I must be doing something wrong but just can't seem to figure out what.

 

The catalog loads and shows the header as 'Home Page' as it should, the problem arises when I try to get to the admin area.

 

Any ideas what this newbie may have screwed up?

 

Thanks!

Cheri

Share this post


Link to post
Share on other sites
Hi, I installed this contrib and it seemed to be going well until I tried to access the admin, at which time I got the 'page cannot be found' message. With this in the address bar: /admin/FILENAME_LOGIN

 

This is the second time I've tried it with the same results. I must be doing something wrong but just can't seem to figure out what.

 

The catalog loads and shows the header as 'Home Page' as it should, the problem arises when I try to get to the admin area.

 

Any ideas what this newbie may have screwed up?

 

Thanks!

Cheri

Please read back a page or two. This has been addressed.

 

Jack

Share this post


Link to post
Share on other sites
Please read back a page or two. This has been addressed.

 

Jack

 

 

Thanks so much Jack! I got it fixed and am going great guns now!

Thanks again,

Cheri

Share this post


Link to post
Share on other sites

I installed this contribution and seems to be working well although I am having one small problem with this code in product_info.php:

 

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

</tr>

<tr>

<td class="smallText" align="center"><?php echo TEXT_VIEWING; ?> 

<?php echo '<a title="' . $tags_array['title'] . '" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'], 'NONSSL') . '"/# ' . $tags_array['title'] . '">' . $tags_array['title']; ?></a></td>

</tr>

 

It is displaying the TEXT_VIEWING variable which is "Currently Viewing:" but nothing else is displayed.

 

I've overlooked something simple I'm sure.

 

Any Ideas?

Share this post


Link to post
Share on other sites

Hi Keith,

 

I also had this problem but according to Jack this is good coding practice... :blink:

Just take a look a couple of posts back, you will see I didn't get a proper answer to my questions...

Maybe too complicated... ?? ;) ;)

 

In my eyes when this code has been used for a year or so, it doesn't automaticly mean the code is free of errors...

 

But:

Please feel free to alter the code as you see fit. That is the joy of open source

 

Thanks and good luck! :thumbsup:

 

Okay Keith, back to our problem, we are discussing this on the Dutch forum as we speak: http://forums.oscommerce.nl/index.php?act=...f=2&t=17843

 

Keith, I'm NOT an expert but I think the code should more look like this:

 

<?php echo '<a title="' . $tags_array['title'] . '" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product_info['products_id'], 'NONSSL') . '#' . $tags_array['title'] . '">' . $tags_array['title']; ?></a>

 

Please let me know if this helps, okay?

 

Kind regards,

 

Arne.

Edited by ArneK

Share this post


Link to post
Share on other sites

Hello ArneK, Thanks for the reply but it seems I got it working with the existing code. I am also using the STS contribution with my shop and the directions in the STS forum said if you are installing HTC contribution to not follow the Catalog side of the HTC instructions, they are handling it with STS but I Looked at the Catalog instructions anyway and added this bit of code from HTC directions for the Product_info.php file and it seemed to solve my problem.

 

I did not modify the index file because it seemed to be working fine as far as I could see but then again I am using STS Templates.

 

 

QUOTE:

----------------------------------------------------------------------------------------------

CHANGES TO ALL FILES:

 

For Header Tags to work on a page of your site, that page must have the code

change mentioned below installed. You should make the following changes to

 

index.php

product_info.php

 

and any other file in the root directory (the same location where your

index.php file is located) that you want to have Header Tags to work with. For

example, if you want your privacy page to have its own title and meta tags,

then you should make this change to the privacy.php file. Only files that

contain <title><?php echo TITLE; ?></title> can be altered.

 

NOTE: The <TITLE> tag is different in popup_image.php and is not handled by

Header Tags Controller so there is no need to modify that file.

 

In each file you want to edit, make the following modification:

 

FIND:

 

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

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

 

REPLACE with:

 

<?php

// BOF: Header Tag Controller v2.6.3

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

require(DIR_WS_INCLUDES . 'header_tags.php');

} else {

?>

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

<?php

}

// EOF: Header Tag Controller v2.6.3

?>

-------------------------------------------------------------------------------------------------------------------

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  

×