Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Change header depending on category - HELP


Guest

Recommended Posts

Hello all!

 

I am trying to do something with no success, so I am counting on all users of the forum to help me. I already tried a search about this on the forums, but nothing seems to help me on what I want.

 

What I need is to change an image on the header depending on which category the user is browsing.

 

The website is: www.worldgames.com.mx (it is a live site, please don't make any test orders)

 

As you can see, the header has a blue rectangle on the left side (the header image is sliced), that rectangle is supposed to change depending on the category, so 7 changes should be made. If the user is browsing whatever outside the categories, it should show the blue rectangle (the generic one).

 

I've tried to use an IF with HTTP_GET_VARS, or PHP_SELF, with the idea that, if you are on "/index.php?cPath=nn" display "this" image.

 

The problem is, that for HTTP_GET_VARS I need some page to send a variable first (for what I understand, based on the error messages the same headers.php uses... after all my php knowledge is limited) and for PHP_SELF, it returns only the name of the script, that is "index.php" and not the rest that follows, the "?cPath=nn" part, which is the thing that defines which category is being viewed, and also defines which image to show.

 

So I need to know if there's some way to get the full path of the URL being visited, including whatever comes next of ".php"... on this case, the question mark, cPath and the number.

 

I am going the right way to reach my goal? if there is another idea to get the same result, please let me know!! any help will be appreciated.

 

Thanks in advance!!

Link to comment
Share on other sites

if you check the categories sql table there is a column that is used categories_image So you could extend the table add a 2nd image column like categories_image2 where you could store the header image for the category. See the extra images contributions how they include additional images for products.

Link to comment
Share on other sites

See the top of the index.php file. The code to find what is showing is there. You would need to do a test to see if categories are showing. If they are, you would then need to switch the logo depending upon that category in the header.php file. Remember to put in a default section for when categories are not showing.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks in advance for the help.

 

enigma1 - I can do that fine, the problem is that... how do I tell the code to know which image to use? that's my problem.

 

Jack_mcs - great idea! I am checking the code and it seems to solve my problem just fine. I'll do the tests in the next hours and let you know if it works, maybe this is useful to someone else.

 

Thanks again to all!!

Link to comment
Share on other sites

Thanks in advance for the help.

 

enigma1 - I can do that fine, the problem is that... how do I tell the code to know which image to use? that's my problem.

 

Jack_mcs - great idea! I am checking the code and it seems to solve my problem just fine. I'll do the tests in the next hours and let you know if it works, maybe this is useful to someone else.

 

Thanks again to all!!

 

you know because your array fetches the categories_image2.

 

The hard-coded solution means you have to maintain an array of images now with hard-coded categories ids. So every time you add/remove categories you have modify the code too.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...