Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted (edited)

Hi everyone.

 

I was looking in the contributions but i couldn´t find what i need:

 

I have 2 different images, one .gif for product list and anothr .jpg for product info.

 

All i need is when product info opens to delete .gif (4 characters) and add .jpg

 

Please someone could help me with this?

 

thank you all

 

:thumbsup:

Edited by tngs
Posted

I found it!!

 

It is posted in this contribution

 

http://www.oscommerce.com/community/contri...h,images/page,2

 

thnks alexian B)

 

Hi Alexian,

 

I am new to OSC and php but managed to find this "trick" that might help.

 

By changing the image name within product_info.php, you can specify a different image to display.

 

F.ex. in catalog/images you have two images, identical except one is bigger that the other:

Image1A.jpg 100x100 pixels big.

Image1B.jpg 500x500 pixels big.

 

In your products display, you use Image1A.jpg as your thumbnail image. When people click on the link and enter the product info page, product_info.php changes the image it looks at by taking the image name (Image1A.jpg) removing the last 5 characters (A.jpg) and adding "B.jpg" instead, which makes the page display Image1B.jpg.

 

Here's how to do it:

 

1. BACKUP!

2. Open product_info.php and look for:

 

document.write('<?php

echo '<a href="java script:popupWindow('' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';

?>');

 

3. Replace this with:

 

document.write('<?php

$product_substr = $product_info['products_image'];

$product_substr = substr($product_substr,0, strlen($product_substr) - 5) . "B.jpg";

echo tep_image(DIR_WS_IMAGES . $product_substr, addslashes($product_info['products_name'])); ?>');

 

What this does is:

a) Displays ImageB.jpg

B) removes the link "click to enlarge"

c) Changes the image, so that it doesnt link to the pop up window.

 

REQUIREMENTS:

1. The naming convention of images is important so that the correct number of characters are removed and replaced by the right characters.

2. Images are stored in catalog/images (This can be changed, but I haven't had the chance to experiment with that)

 

I hope this helps.

Any questions e-mail me:

[email protected]

 

Note: the attachment is empty

  • 2 months later...
Posted
I found it!!

 

It is posted in this contribution

 

http://www.oscommerce.com/community/contri...h,images/page,2

 

thnks alexian B)

 

Hi Alexian,

 

I am new to OSC and php but managed to find this "trick" that might help.

 

By changing the image name within product_info.php, you can specify a different image to display.

 

F.ex. in catalog/images you have two images, identical except one is bigger that the other:

Image1A.jpg 100x100 pixels big.

Image1B.jpg 500x500 pixels big.

 

In your products display, you use Image1A.jpg as your thumbnail image. When people click on the link and enter the product info page, product_info.php changes the image it looks at by taking the image name (Image1A.jpg) removing the last 5 characters (A.jpg) and adding "B.jpg" instead, which makes the page display Image1B.jpg.

 

Here's how to do it:

 

1. BACKUP!

2. Open product_info.php and look for:

 

document.write('<?php

echo '<a href="java script:popupWindow('' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';

?>');

 

3. Replace this with:

 

document.write('<?php

$product_substr = $product_info['products_image'];

$product_substr = substr($product_substr,0, strlen($product_substr) - 5) . "B.jpg";

echo tep_image(DIR_WS_IMAGES . $product_substr, addslashes($product_info['products_name'])); ?>');

 

What this does is:

a) Displays ImageB.jpg

B) removes the link "click to enlarge"

c) Changes the image, so that it doesnt link to the pop up window.

 

REQUIREMENTS:

1. The naming convention of images is important so that the correct number of characters are removed and replaced by the right characters.

2. Images are stored in catalog/images (This can be changed, but I haven't had the chance to experiment with that)

 

I hope this helps.

Any questions e-mail me:

[email protected]

 

Note: the attachment is empty

Thankyou for this Noel. I bought a business with an OSCommerce website which has over 3000 products and images, without a facility to enlarge the images. This solution works BUT I only have a few enlarged images, not all. That means that images that do NOT have an enlarged version will not show in the product info. I am new to php and was wondering if an "If exists, use enlarged image, else use current image" type script is available. Thanks

 

Tu

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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...