Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Additional Images Module


Parikesit

Recommended Posts

Additional Images Module (Version 1.0)

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

 

Features:

- A real image module

- 'Unlimited' additional images for each product

- Popup image for each additionals

- Add/Delete additional images from Admin panel

- 3 sizes image

 

Send your comment to this forum

 

 

Enjoy,

Parikesit

 

:D

Link to comment
Share on other sites

I just tried this out and I ran into a couple of problems.

 

- the table is called additional_images, but is defined as products_images

- the boxes.php modifications file is empty. I'm guessing there should be a class in there called imagesbox?

 

i think that's all

Link to comment
Share on other sites

Thanks a lot to Lorene.

 

I have upload the patch for this bug, see:

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

 

Anyway here the missing files/configuration:

 

#Admin

- admin/includes/application_top.php

define('TABLE_ADDITIONAL_IMAGES', 'additional_images');

 

 

#Catalog

- catalog/includes/application_top.php

//filename

   define('FILENAME_ADDITIONAL_IMAGES', 'additional_images.php');

   define('FILENAME_POPUP_ADD_IMAGE', 'popup_add_image.php');

   

//table    

   define('TABLE_ADDITIONAL_IMAGES', 'additional_images');

 

- catalog/includes/classes/boxes.php (add to boxes.php)

class imagesBox extends tableBox {      

     function imagesBox($contents) {        

       $info_box_contents = array();        

       $info_box_contents[] = array('text' => $this->imagesBoxContents($contents));        

       $this->table_cellpadding = '1';        

       $this->tableBox($info_box_contents, true);      

   }

     function imagesBoxContents($contents) {

       $this->table_cellpadding = '4';

       $this->table_parameters = 'class="imagesBoxContents"';

       return $this->tableBox($contents);

     }

   }

Link to comment
Share on other sites

I just downloaded the contribution for closer examination of code. Looks nice.

 

I noticed that there are no language fields even though desciption is given. Are you planning to add them ?

 

I personally do not want anything more to the product_info.php, but would still like to give addional images for vieving. The gallery mod was a bit hard to use with different directories and naming rules for images.

 

Could this mod be modified so that instead of showing preview images in product_info.php, it would show link to Product_gallery.php (if there are any additional images for the product ). Product_gallery.php would be sligthly modified product_info.php with additional images included.

 

Do you think this can be done ?

"Use no way as way, have no limitation as limitation." - Bruce Lee

Link to comment
Share on other sites

I noticed that there are no language fields even though desciption is given. Are you planning to add them ?

 

"Image Description" value just show as ToolTip (on mouse over images) in Catalog, and as ImageName in Admin. Maybe we do not really need to add languages functionality to them.

 

...

Could this mod be modified so that instead of showing preview images in product_info.php, it would show link to Product_gallery.php (if there are any additional images for the product ). Product_gallery.php would be sligthly modified product_info.php with additional images included.  

 

Do you think this can be done ?

 

Yes! that would be great. I'll try do it.

 

Thank's

Link to comment
Share on other sites

Could this mod be modified so that instead of showing preview images in product_info.php' date=' it would show link to Product_gallery.php (if there are any additional images for the product ). Product_gallery.php would be sligthly modified product_info.php with additional images included.

 

Do you think this can be done ?[/quote']

 

Yes! that would be great. I'll try do it.

 

Thank's

 

Something very very cood would be:

 

Once more than 1 image is uploaded for that product, the pop up window would open with 1 or as many as uploaded image ( as thumbnail ) with one larger image. clicking on the thumb, with bigger image would change with the one clicked....

 

Salvo

Link to comment
Share on other sites

Upon creating Tbl additional_images I get this error

 

Key column 'product_add_images_id' doesn't exist in table

 

i am using a shell to manually enter the add_images.sql file. I am uncertain of what syntax to use (if any) to 'execute' the add_images.sql file as a source file. :oops: If your syntax is correct in the file and there is a way to execute a *.sql from a shell, w/o phpmyadmin (<-- I dont have) I'd really like to know! Otherwise could you explain the structure of the table, or even better tell me what to change.

 

this is the syntax i used from your dl'd file

 

drop table if exists additional_images;

create table additional_images (

additional_images_id int(11) not null auto_increment,

products_id int(11) not null ,

images_description varchar(255) ,

medium_images varchar(64) ,

popup_images varchar(64) ,

PRIMARY KEY (product_add_images_id, products_id)

);

 

maybe I just need to change the product_add_images_id name

 

Besides not writing to mySql table the script is running fine so far.

 

Thanks

Ash

Link to comment
Share on other sites

From what i can tell is that it's not quite working perfectly yet, but the basic idea is to be able to have multiple images for one product in the form of popup windows. I dont know yet because I'm not sure how to design the new table. Once I get it up i can message you a link. I'm sceptical of posting it here because my site isnt running yet and I need to conserve precious bandwidth. Hopefully someone else has it running though! I'm curious myself :D

Link to comment
Share on other sites

when im in the admin area and i add a image everything is ok .

 

 

but if i try to delete the image

 

i get a Error :

 

 

Call To Undefined Function: si() in categories.php on line xxx

 

 

when i check that line it reads

 

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

 

 

what have i missed ?

 

 

there must be a function i dont have ......

Link to comment
Share on other sites

rewrite case 'del_images' to these one:

 

case 'del_images':

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

 

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

$product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

$additional_images_id = $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_db_query("delete from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . $HTTP_POST_VARS['additional_images_id'] . "'");

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

break;

Link to comment
Share on other sites

I add new file of this patch to the package:

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

 

Upon creating Tbl  additional_images I get this error  

 

drop table if exists additional_images;

create table additional_images (

 additional_images_id int(11) not null auto_increment,

 products_id int(11) not null ,

 images_description varchar(255) ,

 medium_images varchar(64) ,

 popup_images varchar(64) ,

 PRIMARY KEY (product_add_images_id, products_id)

);

 

IT HAS TO BE:

 

drop table if exists additional_images;

create table additional_images (

 additional_images_id int(11) not null auto_increment,

 products_id int(11) not null ,

 images_description varchar(255) ,

 medium_images varchar(64) ,

 popup_images varchar(64) ,

 PRIMARY KEY (additional_images_id, products_id)

);

 

Just change the "product_add_images_id" with "additional_images_id"

 

Thanks

Link to comment
Share on other sites

I'm having the same problem as Teksigns was having. I changed the code in popup_add_image.php as you suggested Teksigns, but it did not fix the error. The image is uploaded, and it appears at the bottom of the page resized, but when clicked to enlarge, i get the 404 error.

 

Any suggestions???

 

Otherwise the scipt is running fine, I think.

 

Thanks,

Ash

Link to comment
Share on other sites

I'm having the same problem as Teksigns was having. I changed the code in popup_add_image.php as you suggested Teksigns, but it did not fix the error. The image is uploaded, and it appears at the bottom of the page resized, but when clicked to enlarge, i get the 404 error.

 

Any suggestions???

 

Otherwise the scipt is running fine, I think.

 

Thanks,

Ash

 

I have installed the contribution properly. It is working great.

Thanks a lot for such a needed peace of code.

 

Ash,

I think you may get something if you try to look in to your catalog/includes/application_top.php file and find the follwing line:

#catalog/includes/application_top.php

 

 

define('FILENAME_POPUP_ADD_IMAGE', 'popup_add_image.php');

 

needs to be

define('FILENAME_POPUP_IMAGE_ADD', 'popup_add_image.php');

 

please note, one says IMAGE_ADD, the other ADD_IMAGE.

 

good luck!

 

thanks again for the contribution.

GALATASARAY RULES!

ultrAslan - ultrAslan - ultrAslan

Link to comment
Share on other sites

We got it working by not taking any notice of your updates, but changing the define table name additional_images to product_images

 

Also your SQL statement does not work!!!!!!

 

Otherwise, excellent script, just needs sorting out.......

Link to comment
Share on other sites

Excellent catch erisen!!!!! :D

 

Now at least im getting a real error instead of a 404 so the page has been called up properly. The error in the popup window is as follows:

 

require('includes/application_top.php'); $navigation->remove_current_page(); $products_query = tep_db_query("SELECT images_description, popup_images FROM " . TABLE_ADDITIONAL_IMAGES . " WHERE additional_images_id = '" . $HTTP_GET_VARS['imagesID'] . "'"); $products_values = tep_db_fetch_array($products_query); ?>

Fatal error: Call to undefined function: tep_image() in /catalog/popup_add_image.php on line 37

 

 

Line 37 looks like this:

echo tep_image(DIR_WS_IMAGES . $products_values['popup_images'], $products_values['images_description'], POPUP_IMAGE_WIDTH, POPUP_IMAGE_HEIGHT); ?>

 

Any ideas?

 

Thanks,

Ash

Link to comment
Share on other sites

There are some different configuration in OLD 2.2 CVS and the later CVS like MS1.

 

Example:

In the header of the popup_images.php CVS#20020620 we find:

 

  require('includes/application_top.php');

 

 

 

But in the MS1 there is a line "$navigation->remove_current_page();"

  require('includes/application_top.php');



 $navigation->remove_current_page();

 

 

For save configuration, take a look to popup_images.php from your CVS version. Than replace the some changing lines and save as "popup_add_image.php"

 

 

Regards

Parikesit

Link to comment
Share on other sites

Find the similliar lines in "popup_images.php" and replace. Than save as "popup_add_image.php":

 

  $products_query = tep_db_query("SELECT images_description, popup_images FROM " . TABLE_ADDITIONAL_IMAGES . " WHERE additional_images_id = '" . $HTTP_GET_VARS['imagesID'] . "'");

 $products_values = tep_db_fetch_array($products_query);

 

 

and

echo tep_image(DIR_WS_IMAGES . $products_values['popup_images'], $products_values['images_description'], POPUP_IMAGE_WIDTH, POPUP_IMAGE_HEIGHT);

 

 

Enjoy :)

Link to comment
Share on other sites

Hello,

 

i had the same prob, but i found the answer very easily. The only

thing you have to do is to write a forgotten "<?" above the "require...."

 

After that it works fine!

 

Greets

 

nomove

Link to comment
Share on other sites

Hello,

 

a forgotten "<?" above the "require...."

 

 

nomove

 

Thanks!

You are the bigest!!!! :P

 

(forgoted "<?php", but only in /catalog/admin/popup_ad_image.php and /catalog/popup_ad_image.php If you changes also in /catalog/admin/popup_image.php and /catalog/popup_image.php this produces an error in 'primary' popup imageproduct).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...