Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Little help with images?


WireAudio

Recommended Posts

Hi.

I have to add about 20000 products to the database and i have small, medium and large pictures for all of them.

Here is the directory structure:

 

/images/90/ - the small images

/images/l/ - the medium images

/images/el/ - the large images

 

Only for the product images, not for the category images, i am trying to do the following:

 

When a ist of products gets displayed, either by searching or by clicking on category link, the image here should be from the /images/90/ directory and to have the same name as the model number +.gif at the end. (ex: model is xse2, the image would be xse2.gif)

 

When clicked on the product the image on the details page should be exactly the same as the list, except from the /images/l/ directory and with the name model number +.jpg.

 

Anf dinally when clicked on the image there a new window opens up with the image /images/el/product_number.jpg

 

Can anyone help with this?

I really appreciate any kind of help. Thanks.

Link to comment
Share on other sites

There's lots of ways you could do this. The easiest to explain is this:

 

You don't need a contribution for this either.

 

In popup_image.php, Change (near the bottom)

 

echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'])

 

to

 

echo tep_image(DIR_WS_IMAGES . 'el/' . $products['products_image'], $products['products_name'])

 

in product_info.php change line 108ish

 

<script language="javascript"><!--

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>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

 

to

 

<script language="javascript"><!--

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. 'l/' . $product_info['products_image'], addslashes($product_info['products_name']), MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

//--></script>

<noscript>

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . 'l/' . $product_info['products_image'], $product_info['products_name'], MEDIUM_IMAGE_WIDTH, MEDIUM_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript>

 

It should take the image name from the default image info in the database and the DIR_WS_IMAGES . 'el/' bit will do the rest without adding a 'small,meg,large' images contribution.

 

Obviously, I've not tested so there may be some teething troubles!!!

Link to comment
Share on other sites

http://www.oscommerce.com/community/contri...ll+medium+large

 

may do the trick for you

 

if not do a search on 3 images or small medium large pics in the contribution area

 

I'm presuming the point is that with 20000 products, having three different image paths in the database is a pain in the butt??? If I'm wrong then ignore me, I'm a donkey!

Link to comment
Share on other sites

That's the whole deal, i am not storing image names in database, i just want to use the database field named product_model and add an extention to it (as in xwqe21 would be /images/90/xwqe21.gif, /images/l/xwqe21.jpg, /images/el/xwqe21.jpg )

 

Do you get what i am saying?

 

Btw thanks for the linx guys! B)

Link to comment
Share on other sites

That's the whole deal, i am not storing image names in database, i just want to use the database field named product_model and add an extention to it (as in xwqe21 would be /images/90/xwqe21.gif,  /images/l/xwqe21.jpg,  /images/el/xwqe21.jpg )

 

Do you get what i am saying?

 

Btw thanks for the linx guys!  B)

 

Slight mod of the code I posted should do.

 

DIR_WS_IMAGES . 'el/' . $products['products_image'], $products['products_name'])

 

to

 

DIR_WS_IMAGES . 'el/' . $products['products_name'] . '.gif', $products['products_name'])

 

 

in all the relevant places!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...