Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Image Buttons


timmle

Recommended Posts

However much i try to search the forums i can't find anything that helps me with this query so here goes,

 

I would like buttons down the left hand side that link to pages, or accross the top im not quite sure yet.

How do i place images i have created in Photoshop into the left column and link those images to pages so they display

in the main content area as normal in oscommerce.

 

 

How do i do this?

Please Help.

Link to comment
Share on other sites

In your /includes/column_left.php at the end the code looks like this:

 

  require(DIR_WS_BOXES . 'information.php');
?>

Alter it to something like this:

 

  require(DIR_WS_BOXES . 'information.php');

// beginning of added code

 $page1 = 'page1.php';
 $button1 = 'button1.gif';
 $alt1 = 'Click to go to page 1';
 echo '<tr><td align="center"><a href="' . tep_href_link($page1) . '">' . tep_image(DIR_WS_IMAGES . $button1, $alt1) . '</a></td></tr>';

 $page2 = 'page2.php';
 $button2 = 'button2.gif';
 $alt2 = 'Click to go to page 2';
 echo '<tr><td align="center"><a href="' . tep_href_link($page2) . '">' . tep_image(DIR_WS_IMAGES . $button2, $alt2) . '</a></td></tr>';

 $page3 = 'page3.php';
 $button3 = 'button3.gif';
 $alt3 = 'Click to go to page 3';
 echo '<tr><td align="center"><a href="' . tep_href_link($page3) . '">' . tep_image(DIR_WS_IMAGES . $button3, $alt3) . '</a></td></tr>';

// end of added code

?>

In that code:

 

$pagex = the name of your PHP page

$buttonx = the name of the image button

$altx = the text to display on a mouseover of the button

 

The x changes with each page.

 

This code relies on these premises:

 

1. The images for the buttons are in the images folder with all your other osC images

2. The code pages you've added also reside in the same folder as your other osC catalog pages.

 

I've only shown code for three extra pages but following this example you can add more.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Absoultely amazing, thankyou very much, couldn't have been any more simple than that.

 

Just one more thing that you might be able to help me with, how do i do a standard image rollover in that same area? So the image changes on rollover only before clicking on the link.

 

 

Thankyou.

Link to comment
Share on other sites

OOOH also...

 

 

 

1) How do i link to pages inside other folders such as catogories.php in includes/boxes/? As instead of having a drop down section for each catogorie on the left column i would just like an image to link straight to the images of the catogories.

 

Thankyou once again.

Link to comment
Share on other sites

You can't link directly to catogories.php in includes/boxes because it's not coded to be a "standalone" page.

 

To link to pages inside other folders:

 

1. If the folder is inside your osC catalog, attach the folder name to the page name like:

 

 $page1 = 'folder_name/page1.php';

 

2. If the folder is outside the catalog folder, you'll need to use HTML.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Ah right, that may explain the reason i am getting errors when trying to link to it then.

 

How about my image rollover issue, how would i modify that code so that the image changes on rollover.

 

Thankyou.

 

You can't link directly to catogories.php in includes/boxes because it's not coded to be a "standalone" page.

 

To link to pages inside other folders:

 

1. If the folder is inside your osC catalog, attach the folder name to the page name like:

 

 $page1 = 'folder_name/page1.php';

 

2. If the folder is outside the catalog folder, you'll need to use HTML.

Link to comment
Share on other sites

Chances are the paths to the rollover images aren't correct.

 

Without your URL to look at the source code, it's a *carp* shoot...

:huh:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Well i haven't started that yet, i was just wondering what the code would be to use the rollover function. Any ideas?

 

 

Chances are the paths to the rollover images aren't correct.

 

Without your URL to look at the source code, it's a *carp* shoot...

:huh:

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...