Jump to content



Photo
- - - - -

Large image in PRODUCT_INFO.PHP


This topic has been archived. This means that you cannot reply to this topic.
51 replies to this topic

#1   john peter

john peter
  • Members
  • 12 posts

Posted 28 October 2003 - 12:55

Hi iam newbi, so forgive me if this is not a news flash! : /unsure.gif' class='bbc_emoticon' alt=':unsure:' />

If u would like the product info to display a large image, but u do not want the whats new and the spacials to disolay a large image u cant change it in the PRODUCT_INFO.PHP file.

In about line 110 replace this line :
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>'; ?>');

with:
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*/150, /*SMALL_IMAGE_HEIGHT*/220, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

Look for ( /*SMALL_IMAGE_WIDTH*/150, /*SMALL_IMAGE_HEIGHT*/220) that is all I have change u can change the value 150 and 220 as u desire until u have the image size u want-

hope u can use this and sry if this is allready postet.

J :-)

#2   JenRed

JenRed
  • Members
  • 249 posts

Posted 08 November 2003 - 09:25

Nice idea - I took this a little further and decided that since the big images obviously show the product a lot better than the small ones (and who knows if people click to see the more detailed pic anyway) I thought why not just show the large image on the product_info page, while keeping the small images (thumbnails) everywhere else.

So at the very top of the product_info.php file find this:

<?php
  $product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, m.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_DESCRIPTION . " pd where m.manufacturers_id=p.manufacturers_id and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");

  if (!tep_db_num_rows($product_info)) { // product not found in database
?>

and replace with this:

<?php
  $product_info = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p_products_bimage, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, m.manufacturers_id, m.manufacturers_name from " . TABLE_PRODUCTS . " p, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_DESCRIPTION . " pd where m.manufacturers_id=p.manufacturers_id and p.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.products_id = '" . $HTTP_GET_VARS['products_id'] . "' and pd.language_id = '" . $languages_id . "'");

  if (!tep_db_num_rows($product_info)) { // product not found in database
?>

(we just added p.products_bimage right after p_products_image that's all)

then replace this (around line 110) of product_info.php:

<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info_values['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info_values['products_image'], addslashes($product_info_values['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_values['products_image']) . '">' . tep_image(DIR_WS_IMAGES . $product_info_values['products_image'], $product_info_values['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>

with this new bit of code:

<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info_values['products_bimage']) . '">' . tep_image(DIR_WS_IMAGES . $product_info_values['products_bimage'], $product_info_values['products_name'], /*SMALL_IMAGE_WIDTH*/220, /*SMALL_IMAGE_HEIGHT*/220, 'hspace="5" vspace="5"')
 . '</a>'; ?>

again, replace the 220 with whatever size your larger image is set to.

Voila! You can see an example here


Jen

ps not a coder but it works for me /smile.gif' class='bbc_emoticon' alt=':)' />
I haven't lost my mind - I have it backed up on disk somewhere.

#3   JenRed

JenRed
  • Members
  • 249 posts

Posted 09 November 2003 - 23:42

Oops I made a mistake above - I accidentally kept the image still clickable.

For the last "replace with" above use this:


<?php echo tep_image(DIR_WS_IMAGES . $product_info_values['products_bimage'], $product_info_values['products_name'], /*SMALL_IMAGE_WIDTH*/220, /*SMALL_IMAGE_HEIGHT*/220, 'hspace="5" vspace="5"'); ?>


Jen
I haven't lost my mind - I have it backed up on disk somewhere.

#4   TLC

TLC
  • Members
  • 5 posts

Posted 24 November 2003 - 03:51

I may be missing something here, but does this method require adding a bimage field to your products table in the database? If not, how does this code know where to find the larger image. And what are all those sub_images and where can they be set?

Yes, I am new to this php stuff too. I used to be a programmer, but I stopped for lunch one day and have been playing catch-up ever since.


Thanks,
TLC

Edited by TLC, 24 November 2003 - 03:52.

I realize this may sound like a dumb question, but consider the source.

#5   kelantan

kelantan
  • Members
  • 13 posts

Posted 24 November 2003 - 08:10

I,ve done like that and it works fine, but how am I gonna cofigure the to be in the original ratio instead of width 150, height 220...
Maybe I want to make the bigger image smaller by keeping the ration respectedly, let say width 150 and height in 100% for ratio but I don't know how to command the scripts.

Please someone help!

#6   schmodi

schmodi
  • Members
  • 89 posts

Posted 29 January 2004 - 14:13

Did anyone ever get this to work with just one length (either width or height) for the pictures so they would scale in proportion?

#7   blueline

blueline
  • Members
  • 994 posts

Posted 30 January 2004 - 00:41

http://www.soundspaces.com/catalog

I think you guys want something like this right?

-Chris
Chris Sullivan

#8   schmodi

schmodi
  • Members
  • 89 posts

Posted 30 January 2004 - 04:34

Oooh! Beautiful store!

Yeah, that's what we want! I hadn't had a chance to repost until now but I used the code in this thread and just put in the width measurement and then '' (two single quotes) for the height measurement and it worked for me.

What worked for you?

#9   schmodi

schmodi
  • Members
  • 89 posts

Posted 30 January 2004 - 04:39

Oh, and then I wanted to make it not clickable so the image call that I ended up with was this:

<?php echo tep_image(DIR_WS_IMAGES . $product_info['products_bimage'], $product_info['products_name'], BIG_IMAGE_WIDTH, BIG_IMAGE_HEIGHT, 'hspace="5" vspace="5" class="ProductInfoImage"'); ?>

#10   blueline

blueline
  • Members
  • 994 posts

Posted 30 January 2004 - 05:40

Thanks. That store was actually a pretty easy one.

Well, I'll tell you that if your images aren't already pretty big....making them that size from a smaller image can AND WILL create much distortion.

The easiest way to accomplish this is to just edit the code in the product_info.php page directly. You will end up removing the ability to edit the size from the admin....but once you set this up then you should be all set.

HTH.
-Chris
Chris Sullivan

#11   schmodi

schmodi
  • Members
  • 89 posts

Posted 31 January 2004 - 14:18

Yeah, I made a small image and a big image. I call the small image for the thumbnails and such and then target the big image here. Seems to work OK for me thank goodness!

#12   davinci

davinci
  • Members
  • 64 posts

Posted 31 January 2004 - 14:23

I am INSPIRED!

mASTER!
I am a confessed computer abuser...I do it often and as much as I can. Sometimes...occasionally it fights back! I just reach down and pull the plug. SHUTUP!

#13   davinci

davinci
  • Members
  • 64 posts

Posted 31 January 2004 - 14:24

my junk looks dirty!

need site scrubber...get all the fuzz off...

oh my...ive got a ways to go..

just hope the cheerios hold up...i got little starz circling round my head and its not earthlink
I am a confessed computer abuser...I do it often and as much as I can. Sometimes...occasionally it fights back! I just reach down and pull the plug. SHUTUP!

#14   edgore

edgore
  • Members
  • 17 posts

Posted 01 February 2004 - 19:57

I'm looking to do something like this as well, but I am just starting out with os-commerce.

I looked at the product_info.php file, but it doesn't look anything like the file described earlier in this thread - in fact taking a fragment from the earlier post and using it to search the file in my installation frequently comes up finding nothing.

Any ideas?

#15   edgore

edgore
  • Members
  • 17 posts

Posted 01 February 2004 - 20:14

I may be missing something here, but does this method require adding a bimage field to your products table in the database? If not, how does this code know where to find the larger image. And what are all those sub_images and where can they be set?

I am wondering about this too. When I tried the code above, I get the following error:

1054 - Unknown column 'p.products_bimage' in 'field list'

select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_bimage, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from products p, products_description pd where p.products_status = '1' and p.products_id = '28' and pd.products_id = p.products_id and pd.language_id = '1'

[TEP STOP]

so I assume I have to add it. But I am unsure how to go about that, or what I would have to alter in order to populate it when a new product is added.

I am also very curious about the sub_images - I have a need to display more that on product image per product.

Thanks!

#16   Clarity

Clarity
  • Members
  • 182 posts

Posted 02 February 2004 - 03:29

Like this? http://www.handpoure...&products_id=31

#17   sunshine-x

sunshine-x
  • Members
  • 29 posts

Posted 02 February 2004 - 19:28

Thanks. That store was actually a pretty easy one.

Well, I'll tell you that if your images aren't already pretty big....making them that size from a smaller image can AND WILL create much distortion.

The easiest way to accomplish this is to just edit the code in the product_info.php page directly. You will end up removing the ability to edit the size from the admin....but once you set this up then you should be all set.

HTH.
-Chris

Sorry but I'm a php newbie. Could you give a few details about how you've done this?

Thanks

#18   edgore

edgore
  • Members
  • 17 posts

Posted 03 February 2004 - 15:19

I am wondering about this too. When I tried the code above, I get the following error:

1054 - Unknown column 'p.products_bimage' in 'field list'

[TEP STOP]

so I assume I have to add it. But I am unsure how to go about that, or what I would have to alter in order to populate it when a new product is added.

I am also very curious about the sub_images - I have a need to display more that on product image per product.

Okay - so I figured out how to do the larger picture - I installed big image, and it's working great.

Now, I am very interested in the sub pictures and how that was done. I am starting to look through the contributions that deal with images/multiple images/etc. does anyone have any recommendations?

#19   Rochdalemark

Rochdalemark
  • Members
  • 468 posts

Posted 24 March 2004 - 13:05

I may be doing something stupid here (I usually am) but the file I'm supposed to be editing is catalogue/includes/product_info.php right???? well when I edit that and view the site there is no difference. Description images are still coming up small and the link to popup is still there. On a note I'm also using the Keep Image Proportions 1.3 contribution.

#20   Rochdalemark

Rochdalemark
  • Members
  • 468 posts

Posted 24 March 2004 - 13:28

Yep, Stupid me, I was editing the wrong file, I should have checked for it in the catalogue folder not catalogue/includes, you mentioned the BigImage contribution, which one is this and is is for the latest version of OsCommerce??