Jump to content
Sign in to follow this  
tobz

[Contribution] Additional Images for MS2

Recommended Posts

Download from: http://www.oscommerce.com/community/contributions,1032

 

This is an update to the original contribution with the following changes:

 

- Install instructions re-written for MS2

- Update of code to work with MS2

- Added display of thumbnails in admin so you know what images you have added or are about to delete

- Various bits of tweaking and tidying

 

DEMO HERE (Click the light blue thumbnail to see how you can have a different popup image).

 

Admin Screenshots:

 

Pic 1

Pic 2

Pic 3

 

Enjoy :D


tobz

 

osCommerce Links

osCommerce Templates

osCommerce UK <-- This site is for sale!

Share this post


Link to post
Share on other sites

I am getting stuck on the section of your instructions where is refers to editing catalog/admin/categories.php

 

If I follow these instructions to the letter (and I have tried twice). When I do a search within the file for the code below, which I am meant to replace, dreamweaver says that it cannot find the code. But, if I just open a fresh file without following the instructions and just search on this code, it does actually find it. So somewhere it must be getting changed prior to that section of the instructions. :(

 

default:

if ($rows > 0) {

if (isset($cInfo) && is_object($cInfo)) { // category info box contents

$heading[] = array('text' => '<b>' . $cInfo->categories_name . '</b>');

 

$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=edit_category') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=delete_category') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $cInfo->categories_id . '&action=move_category') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a>');

$contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($cInfo->date_added));

if (tep_not_null($cInfo->last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($cInfo->last_modified));

$contents[] = array('text' => '<br>' . tep_info_image($cInfo->categories_image, $cInfo->categories_name, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT) . '<br>' . $cInfo->categories_image);

$contents[] = array('text' => '<br>' . TEXT_SUBCATEGORIES . ' ' . $cInfo->childs_count . '<br>' . TEXT_PRODUCTS . ' ' . $cInfo->products_count);

} elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents

$heading[] = array('text' => '<b>' . tep_get_products_name($pInfo->products_id, $languages_id) . '</b>');

 

$contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=new_product') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=delete_product') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=move_product') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $pInfo->products_id . '&action=copy_to') . '">' . tep_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '</a>');

$contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($pInfo->products_date_added));

if (tep_not_null($pInfo->products_last_modified)) $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($pInfo->products_last_modified));

if (date('Y-m-d') < $pInfo->products_date_available) $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . tep_date_short($pInfo->products_date_available));

$contents[] = array('text' => '<br>' . tep_info_image($pInfo->products_image, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $pInfo->products_image);

$contents[] = array('text' => '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br>' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity);

$contents[] = array('text' => '<br>' . TEXT_PRODUCTS_AVERAGE_RATING . ' ' . number_format($pInfo->average_rating, 2) . '%');

}

} else { // create category/product info

$heading[] = array('text' => '<b>' . EMPTY_CATEGORY . '</b>');

 

$contents[] = array('text' => TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS);

}

break;

Share this post


Link to post
Share on other sites

Toby: I used your download to install this but something must have gone wrong, I don't see any of the screen shots in my Admin section.

 

It is the basic screen for adding a new product.

 

I just double checked all the files and images and they are where they are supposed to be.

 

I am thinking it must be in the add_images.sql, which I wasn't 100% about. Do I just copy and paste that whole file into myPHP admin as a query?

Share this post


Link to post
Share on other sites

this text is in README file in two places, the same, so just ignore the second place where the author wants you to replace

default:

if ($rows > 0) {

[.....]

 

with something else

That's why you couldn't find it. You've just changed it before :wink:

 

Regards,

Piotr

Share this post


Link to post
Share on other sites

I checked the demo, clicked on the blue image. The same image pops up but is smaller not enlarged and your original image is distorted as it's dimensioins are probably bigger than the image itself.

Share this post


Link to post
Share on other sites

Great, it works :D

 

As macki was saying, within the readme which relates to catalog/admin/categories.php the replacement code is repeated at the end (apart from the first lot including a } character at the end). Just the instructions that need changing.

 

Many thanks to the author anyway.

 

At the risk of being told, "You can't have everything" I was dissapointed to find that I cannot have an alternative popup image for the 1st image (the the default one that appears to the right). This is all I really needed. The additional images are of course a bonus for me, and useful to everbody else. Just assumed that I could have an alternative to the 1st thumbnail.

 

Is this something that could be added perhaps ? :D

Share this post


Link to post
Share on other sites

Hi all

 

Re: the readme file, I have indeed repeated some instructions :oops: sorry about that! I will update this later on today and check it again before I upload it.

 

For anyone who has downloaded already, it is the second place where I say replace default:.... that you should use as this contains a number of changes to make things look neater! Ignore the first change to default:

 

MurrayM - i mean the first light blue/turquoise whatever colour you want to call it image. The others don't have alternative popup images specified and therefore the popup contains the thumbnail. Yes, the images are distorted as they are smaller than the specified dimensions (as they are with the standard ms2 installation).

 

cindyd - in admin > configuration > images you should leave the values for popup image width and height blank if you want the popup image to be its natural size.

 

dsmcphee - this contribution is overkill if you just wanted thumbnails for the standard images. You should take a look at the 3 images contribution for doing that.


tobz

 

osCommerce Links

osCommerce Templates

osCommerce UK <-- This site is for sale!

Share this post


Link to post
Share on other sites

Toby: I am receiving this error:

 

Fatal error: Cannot redeclare tep_set_banner_status() (previously declared in /home/jelegant/public_html/catalog/includes/functions/general.php:694) in /home/jelegant/public_html/catalog/includes/functions/banner.php on line 15

 

On line 15 is this:

 

// Sets the status of a banner  

function tep_set_banner_status($banners_id, $status) {-------->line 15  

if ($status == '1') {  

return tep_db_query("update " . TABLE_BANNERS . " set status = '1', date_status_change = now(),

 

I asked in support about this and they said this:

 

you have installed a contribution that is causing the problem.... from what I can see, your general.php has been replaced by an earlier version that is not compatible.... it has a function that now resides in banner.php and is missing a function that should be there in the version of osCommerce you are running

 

The general.php file was the same version I had downloaded as a clean install of 2.2

 

Do you know what I can do to fix this? Thanks

Share this post


Link to post
Share on other sites

I had to reupload the original files and redo that 1 mod and got it working again.

 

I am still having trouble with pictures, your suggestion that I leave the pop-up image blank was already in place.

 

Please look here at the image:

 

http://www.elegantdepressionglass.com/cata...&products_id=41

 

That was previously OK in its smaller size, but now it is distorted. I don't know what I have to change to get these right again. Please help. Thanks

Share this post


Link to post
Share on other sites

Howdy,

 

First off, Thankyou for all the support for a great mod!

 

Second, I realize that tobz had mentioned that it would be somewhat an overkill to utilize Additional Images when one might only need to use the 3_Sizes_of_product_image mod. I for example already installed the Additional Images mod successfully(finally), but realize that I would really primarily need to utilize the 3 Sizes mod (thumbnails, product image, detailed popup), but then I would want to have the Additional Images mod to augment certain products that would benefit having additional images.

 

Anyways, in short I was wondering if there might be an already existing or better combination of mods to perform this feat. I'm going to look into it more tomorrow.

 

Thanx again, signing out for the day.

Wheat

Share this post


Link to post
Share on other sites

Wheat said:

Second, I realize that tobz had mentioned that it would be somewhat an overkill to utilize Additional Images when one might only need to use the 3_Sizes_of_product_image mod.

 

Does this really exist ---->3_Sizes_of_product_image mod ?? I have searched for it but it comes up no matches found. That is exactly what I am looking for!

Share this post


Link to post
Share on other sites

Hi Wheat: thanks for the link. Can you tell me if the resize is done by percentage? I have found just inputting width or height just doesn't cut it for my application.

 

I would like so say for example: Large image at 100% Medium at 50% and small at 25%.

 

The other way doesn't take into account proportions. If you get this working would you send me a link to your store so I can take a look?

 

I also have the additional images mod in place.

Share this post


Link to post
Share on other sites

Hi,

 

I have a small problem with this ...

 

Everything is working fine (additional images are showing and working, admin works Ok too..) except I now don't get any of the original (MS2) images showing on the product info page - none of the original images at all - although they show up on the home page in the 'What's New' , 'Reviews', 'Specials', and 'New Products' boxes. New (main) images I put in don't show up either.

 

I'm guessing it's something in the products_info file, but I've checked the edits and can't see anything wrong - even did it again with a fresh copy of products_info.

 

One thing I've noticed (which may not have anything to do with it at all, but is puzzling) is that the edit changes SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT to DISPLAY_IMAGE_WIDTH and DISPLAY_IMAGE_HEIGHT, but a search with BBEdit shows only 2 places in additional_images.php and 4 places in product_info.php where the new terms occur in the whole of catalog and admin (searching after all the additional images mods have been done), and none of those places seems to define them...?

 

On a separate note, does anyone know how you can get the product name to show up under the image instead of (or as well as...) the 'Click to Enlarge' text?

 

Thankyou

 

:(

 

(P.S. I'm modifying a new copy of MS2 with no other mods in)

Share this post


Link to post
Share on other sites

Hmmm ... cancel last post ... :D

 

Found it... :P - like looking for the baked beans in the supermarket ... as soon as you ask someone you see it ... :shock:

 

But a remaining problem: ....

 

I'm doing a t-shirts site, so there's always a front image ... and usually a back image ... and (occasionally) a close-up of a sleeve image. So I will have 2, and (occasionally) 3 images.

 

I've edited and changed things so that I have my text on the left, and then I get my first (main) image right-aligned,

followed underneath by the one/two additional images.

 

eg.:

 

 

<product description text> .... space... < main image>

 

<1st Add. image> <2nd Add. Image>

 

 

 

But this looks daft if you only have 2 images: <main image>

 

<1st Add. image>

 

What I would like is:

 

<product description text> .... <space> .... (main image> < 1st Add image> ... (2nd add. image> (ie. all on same line)

 

 

Sooo... does anyone know what needs to be removed in products.info.php or additional_images.php to remove the line break that forces the additional images onto the next line? - I've been looking and trying changes for almost three hours and I can't see anything ... :?

 

Tia

 

 

 

 

:?

Share this post


Link to post
Share on other sites

Ooops ... the text formatting on that post didn't turn out anything like it looked when I was making it ... hope you still get the gist ...

 

 

 

:(

Share this post


Link to post
Share on other sites
Hi Wheat: thanks for the link. Can you tell me if the resize is done by percentage?

 

I got both mods installed. Percentages does very weird things to the images in the 3 image size mod, I'm afraid you'll have to save out new images at the new dimensions. I do recolect some sort of mod that can resize an image though, that may be the solution.

 

-wheat

Share this post


Link to post
Share on other sites
On a separate note, does anyone know how you can get the product name to show up under the image instead of (or as well as...) the 'Click to Enlarge' text?

 

This is something that i'm wanting, as well. were you able to get that working, Pixxi? does anyone know how to do this?

Share this post


Link to post
Share on other sites
On a separate note, does anyone know how you can get the product name to show up under the image instead of (or as well as...) the 'Click to Enlarge' text?  

 

Ok. Just go into your catalog/product_info.php file and bung this in at the end of the relevant bits:

 

...... 'hspace="5" vspace="5"') . '<br>' . $product_info['products_name'] . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');

 

then go into your catalog/includes/modules/additional_images.php file and change the relevant bit at the end of the line to look like this:

 

...... DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . $new_products['images_description'] . '<br>' .TEXT_CLICK_TO_ENLARGE . '</a>'

 

This uses the (main) product name for the first image, and the names you've entered in the 'additional images' bit of the admin for the additional images... (note: it doesn't display the 'xxx.jpg' name, just the name you've typed into the admin for the image).

 

Don't forget the dots ... they concatenate (join) all the text bits. The <br> bit makes the 'Click to enlarge' text go onto the line below the product name (= 'line break').

 

... I think .....

 

 

:)

 

 

 

 

 

:) :) :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×