Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Common images for a SubCategory of Products...


Guest

Recommended Posts

Hi all...

 

I would like to be able to display a few small thumbnail images on the Product Info page, besides the Product Image thats already there, based on the Category or subcategory. Read on for a better explanation...

 

I sell Tshirts, amongst other things. For women, I have up to 5 different styles of womens tshirts to choose from... crop tops, tank tops, halter tops, etc..., as well as a multitude of colors. I have each style defined as an attribute, as well as color and size.

 

I would like to display a small thumnail image with a silouette of the different styles of shirts, no bigger than 50x50 or so, for a particular category. That way, the customer has an idea of the tshirt style type looks like. I would also like to display a listing of the colors that are available in a color chart, just much smaller, like 25x15 per color.

 

I can create or procure the silouette and color images, but how would I get them to show up ONLY within a particular category or subcategory? I'm sure that there is a way to code an "IF" statement that would check the current category and display the appropriate image(s). I'm just not sure how to do it.

 

Your help would be appreciated.

 

Thanks in advance!

 

-R

Link to comment
Share on other sites

I've been playing around with this idea, but can't get the image to show up. Here's what I have tried so far...

 

I created a new field in categories table in the MYSQL database called "categories_image_2". It sits right beneath the already existing "categories_image" field. For one of the SubCategories, I have input the name of the image file i want to use.

 

Here's the code that I added to product_info.php that doesn't seem to work...

<?php

   if ($categories_values['categories_image_2']) {

?>

     <tr>

<td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'categories_image_2'); ?></td>

     </tr>

<?php

}

?>

The "if" statement asks if there is a value in the "categories" table called "categories_image_2", which will then display "categories_image_2"

if there is a value present. At least, thats the logic I'm using.

 

Is this right? Am I on the right track? Any ideas?

 

Thanks.

 

-R

Link to comment
Share on other sites

Here's another way I thought of to do this. But unfortunately, it doesn't work either...

<?php

   $image_common = tep_db_query("select categories_image_2 from " . TABLE_CATEGORIES . " where categories_id = '" . $current_current_id . "'");

   $image_common = tep_db_fetch_array($image_common);

   $image_common = $image_common['categories_image_2'];



   if ($categories_values['categories_image_2']) {

?>

     <tr>

<td class="main"><?php echo tep_image(DIR_WS_IMAGES . $image_common); ?></td>

     </tr>

<?php

}

?>

What am I missing here???

 

-R

Link to comment
Share on other sites

Somebody??? Anybody???? Please???

 

My plan is to release this mod as a contrib once its done, so that everyone can enjoy. But I'm not sure if the code logic I am using is correct. (obviously its not because its not working.)

 

Could someone please take a look at the code listed above and let me know where I am going wrong... or at least steer me in the right direction.

 

Thanks.

 

-R

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...