Jump to content
Sign in to follow this  
tobz

[Contribution] Additional Images for MS2

Recommended Posts

Hi there

 

Just wanna say thanx for this great contrib, installed on MS2 and worked first time. :)

 

Just a question though. Instead of the additional images being horizontal as htey are now, how would one get them to display verticlly under the main image ?

 

Thanx heaps :)

Share this post


Link to post
Share on other sites

Hi again,

I got it to go verticlly

 

change this in additional_images.php

$col ++;

   if ($col > 2) {

     $col = 0;

     $row ++;

to this

 

 $row ++;

   if ($row > 2) {

     $col ++;

     $row = 0;

 

After that its just a matter of changng the alignment by changng the "center" to what ever side you want it on, EG "right"

 

Thanx heaps

 

and it will display verticlly

Share this post


Link to post
Share on other sites

Hi tiz me again

 

Ignore that last comment "After that its just a matter of changng the alignment by changng the "center" to what ever side you want it on, EG "right" "

 

To do the alignment you need to move this line around to where you want it.

 

<?php require(DIR_WS_MODULES . FILENAME_ADDITIONAL_IMAGES); ?>

 

i placed it like this in my product_info.php around line 150

 

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

document.write('<?php echo '<a href="javascript: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']), DISPLAY_IMAGE_WIDTH, DISPLAY_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'], DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>

</noscript><BR>

<?php require(DIR_WS_MODULES . FILENAME_ADDITIONAL_IMAGES); ?>

</td> 

</tr>

</table>

 

Hope i havent confused anyone

Share this post


Link to post
Share on other sites

Good to hear a few people are using this.

 

Just to let you know, I have finally got around to updating the install instructions to remove the duplicate instructions it contained previously. I have just run through it step by step on a fresh MS2 install and it works perfectly :wink:

 

Pixxi - nice little hack to show the description under the image :)


tobz

 

osCommerce Links

osCommerce Templates

osCommerce UK <-- This site is for sale!

Share this post


Link to post
Share on other sites

Base on last previous works, I make change to catalog/admin/categories.php

(also .../english/categories.php). This main change apply due to "upload class"

provided by MS2. It's also will check is "medium_images" field is empty or not.

 

So, if you have last version of Toby works installed on your OsC and want to

use "upload class", you only need modify catalog/admin/categories.php and adding

some languages define to admin/includes/languages/english/categories.php; Otherwise,

please disregards this update.

 

I also add "KEY products_id (products_id)" to table "additional_images"

Share this post


Link to post
Share on other sites

Here the changes:

 

case 'add_images':

 $products_id = $HTTP_GET_VARS['pID'];

 $add_images_error = true;

 if ($medium_images = new upload('medium_images', DIR_FS_CATALOG_IMAGES)) {

   $add_images_error = false;

   $sql_data_array = array('products_id' => tep_db_prepare_input($products_id),

                           'images_description' => tep_db_prepare_input($HTTP_POST_VARS['images_description']),

                           'medium_images' => tep_db_prepare_input($medium_images->filename));

   if ($popup_images = new upload('popup_images', DIR_FS_CATALOG_IMAGES)) {

     $add_data_array = array('popup_images' => tep_db_prepare_input($popup_images->filename));

   } else {

     $add_data_array = array('popup_images' => tep_db_prepare_input($medium_images->filename));          

   }

   $sql_data_array = array_merge($sql_data_array, $add_data_array);

 }



 if ($add_images_error == false) {

   tep_db_perform(TABLE_ADDITIONAL_IMAGES, $sql_data_array);

 } else {

   $messageStack->add_session(ERROR_ADDITIONAL_IMAGE_IS_EMPTY, 'error');

 }

 tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

 break;

 

case 'del_images':

 $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

 if ( ($HTTP_GET_VARS['pID']) && (is_array($HTTP_POST_VARS['additional_images_id'])) ) {                       

   $additional_images_id[] = tep_db_prepare_input($HTTP_POST_VARS['additional_images_id']);

   for ($i=0; $i<sizeof($additional_images_id); $i++) {

     tep_db_query("delete from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . tep_db_input($additional_images_id[$i]) . "'");

   }

 }

 tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

 break;

 

case 'new_images': 

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



 $contents = array('form' => tep_draw_form('new_images', FILENAME_CATEGORIES, 'action=add_images&cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID'], 'post', 'enctype="multipart/form-data"')); 

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

 $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_IMAGES_DESC . '<br>' . tep_draw_input_field('images_description')); 

 $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_IMAGES_NEW . '<br>' . tep_draw_file_field('medium_images')); 

 $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_IMAGES_NEWPOP . '<br>' . tep_draw_file_field('popup_images')); 

 $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_save.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');    

 break;

 

case 'delete_images': 

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

 $contents = array('form' => tep_draw_form('delete_images', FILENAME_CATEGORIES, 'action=del_images&cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID'])); 

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

     

 $images_product = tep_db_query("SELECT additional_images_id, images_description, medium_images FROM " . TABLE_ADDITIONAL_IMAGES . " where products_id = '" . $HTTP_GET_VARS['pID'] . "'"); 

 if (!tep_db_num_rows($images_product)) {

  $contents[] = array('align' => 'center', 'text' => '<br><font color="red">No Additional Images!</font>');   

   $contents[] = array('align' => 'center', 'text' => '<br><a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');  



 } else {

   while ($new_images = tep_db_fetch_array($images_product)) { 

     $contents[] = array('text' => ' ' . tep_draw_checkbox_field('additional_images_id[]', $new_images['additional_images_id'], true) . $new_images['images_description'] . ' (' . $new_images['medium_images'] . ')');    

   } 

   $contents[] = array('align' => 'center', 'text' => '<br>' . tep_image_submit('button_delete.gif', IMAGE_SAVE) . ' <a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>');  

 } 

 break;

 

 

May this helpful,

Share this post


Link to post
Share on other sites

I think it would be very helpful to have a combination of this contribution and image resize http://www.oscommerce.com/community/contributions,350. At the moment it's beyond my skills to make it work but I am willing to help test and debug.

 

Image resize is wonderful for clients who add their own products and don't have any experience with graphics. It also has the option of automatically copying the resized pic onto a base image of fixed size and color, keeping things uniform without distortion. Additional images is really necessary for many products that need more than one pic to truly display them. I think a combination would be outstanding. Anybody else?

 

David

Share this post


Link to post
Share on other sites

You need to have GD LIB 2.0 or higher to use that contribution

 

Unfortunatly my hosting co. only has 1.6x installed.

 

Before attempting that contribution - check out what version your machine is using in 'Server Info' in the admin panel. (It's under the results heading 'GD')

 

I wish the authors would have put mentioned this important bit of information - It could have saved me a few hours!

Share this post


Link to post
Share on other sites

Never mind what I just said - the author does say all this.

AND you can change the GD Lib version used in the control panel

 

I'm getting off topic... Back to: Additional Images for MS2

Share this post


Link to post
Share on other sites

I hope some of you folks are still subscribed to this thread. I installed the contribution, and the admin works great. However, when I look at the product_info.php page, all I get are the additional images. No product title, no price, and no text. It's odd. The product photo and title appear in the what's new infobox, but not on the product info page. Any suggestions?

 

TIA,

 

Jason

Share this post


Link to post
Share on other sites

Ok finally go it working howerver the images are distorted and I have two sets of display image width and height and 2 sets if popup image width and height. I uninstall the first attempt and re-installed the mod. Why are these duplicating and where and how do I remove them. They don't seem to cause any errors but I don't think they should be there. Please help if you can.

 

Small Image Width 100

Small Image Height 80

Heading Image Width 57

Heading Image Height 40

Subcategory Image Width 100

Subcategory Image Height 57

Calculate Image Size true

Image Required true

Display Image Width 150

Display Image Width 150

Display Image Height 120

Display Image Height 120

Popup Image Width

Popup Image Width

Popup Image Height

Popup Image Height

 

 

M.Dsouza


Sinbad

"Mine is not the only way, mine is just another way

Share this post


Link to post
Share on other sites

That's cool conrubution!

How can i keep the mult images to right side??

I think it will more artistic.

Who can give me fruitful help? :)

Share this post


Link to post
Share on other sites

I don't get the database installation part of the README:

 

1. Run the "additional_images.sql" file to make the database changes.

2. The "extra_width_images.sql" is to add new images width and height

(display/medium height-width and popup/large height-width). If you

have this configured in your database, you don't have to execute

this "extra_width_images.sql".

 

How would i do this? do i upload these files onto my server first? im sorry.. even tho i can do web design to a far extent, im fairly to the SQL database part of it. pls advise someone. thx in advance for this contribution!

Share this post


Link to post
Share on other sites

Hi dimports:

 

Those two files are the database commands to create the modifications. You will need to add the modifications to your catalog database. There are two ways to do this. The easiest is to use something like myPHPadmin (many web hosts offer this because it is free) to install the files from the command line (the SQL tab in myPHPadmin). An alternative is to open each .sql file in a text editor and copy the commands. Then you can paste them in the command line of whatever you are using to manage your database.

 

So, if you are using osCommerce, then you must have a database set up somewhere. Use the same tool that you used to create the new database when you installed osCommerce.

 

Good luck.

 

Jason

Share this post


Link to post
Share on other sites

I'm having a problem. When I add a new product and I'm browsing them in admin I get:

 

1146 - Table 'digxworld.TABLE_ADDITIONAL_IMAGES' doesn't exist

 

SELECT additional_images_id, images_description, medium_images FROM TABLE_ADDITIONAL_IMAGES where products_id = '29'

 

[TEP STOP]

 

Please help! Thanks.


digx55

Such a simple signature, yet original

Share this post


Link to post
Share on other sites

Never mind, fixed it.

 

It seems I had to add the table definition ( define('TABLE_ADDITIONAL_IMAGES', 'additional_images'); //additional images ) to the /catalog/admin/includes/database_tables.php also instead of just the /catalog/includes/database_tables.php file.

 

Thanks for the help anyways, and hope the info I just provided helps anybody that needs it!


digx55

Such a simple signature, yet original

Share this post


Link to post
Share on other sites

sigh@!! i followed and added, replaced, etc etc all the files but i keep getting an error when trying to add a new product:

 

Warning: Cannot modify header information - headers already sent by (output started at /home/designi/public_html/catalog/admin/includes/languages/english/categories.php:108) in /home/designi/public_html/catalog/admin/includes/functions/general.php on line 18

 

what am i doing wrong?

Edited by dimports

Share this post


Link to post
Share on other sites

nevermind guys, i got it working!!.. 4th time doing it was a charm. awesome contribuition dude. genuis.

 

i was wondering if i can take out the section in the admin to upload the popup picture just to make it easier for other people here. it confusing to them and they just ignore that the 2nd upload section is for the pop up. anyone know where i can make these changes? thx a mil to all you wonderful contributers.

Share this post


Link to post
Share on other sites

Im getting these errors:

 

Parse error: parse error in /usr/local/psa/home/vhosts/tord.no/httpdocs/shop3/includes/classes/boxes.php on line 101

 

That one was in the header

 

this one was in the body

Fatal error: Cannot instantiate non-existent class: infoboxheading in /usr/local/psa/home/vhosts/tord.no/httpdocs/shop3/includes/boxes/categories.php on line 68

 

Need answers as soon as possible.

Share this post


Link to post
Share on other sites

Fatal error: Call to undefined function: tep_array_merge() in /osc/catalog/admin/categories.php on line 711

 

What is my problem?

 

Lars

Share this post


Link to post
Share on other sites

There are many updates for this contribution.....

The system is completely new, which contribution I need?

Share this post


Link to post
Share on other sites

tordeman:

 

I use osCommerce 2.2-MS2

 

I use a fresh Shop and install the contribution from 9 Sep 2003

 

After this installation the Admintool gives me this out:

 

Fatal error: Call to undefined function: tep_array_merge() in /4gb/wwwtrans/tmp/lhe_php/osc/catalog/admin/categories.php on line 726

 

--> have you for me a categories.php??

 

Greeting Lars

Share this post


Link to post
Share on other sites

I've just installed Additional Images on OS2.2MS2

The site is working fine, not a single error message

 

However I cannot find the place where to add extra pics.

 

 

 

Please help :ph34r:

Edited by cilliers

Share this post


Link to post
Share on other sites

is there a way i can change the path of where the additional images go? because all my images go into subfolders of images/

 

i.e.- images/items/

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  

×