Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding code for more images...


Guest

Recommended Posts

I am modifying the code in admin/product_attributes.php so that I can have a image associated with an option. However, I am having a brain melt down on getting it to save the image...

 

Here is what I have done so far:

- in the produt_attributes_values table I have added a field called options_image (varchar64) which will act the same as all of the other images fields.

- I have modiifed the imput page to show the image select drowse button (and that all works) using

                 <td align="center" class="smallText"> <?php echo tep_draw_file_field('options_image'); ?> </td>

- I have then added the following code to the

case 'add_product_option_values':

 

        $options_image = new upload($HTTP_POST_VARS['options_image']);
       $options_image->set_destination(DIR_FS_CATALOG_IMAGES);
       if ($options_image->parse() && $options_image->save()) {
         $options_image_name = $options_image->filename;
       } else {
         $options_image_name = 'error';
       }

 

I get no files saved and no errors or anything... Can anyone point me in the right direction?

 

thanks in advance

Link to comment
Share on other sites

Rob,

 

There's an Options as Images contrib.  If it's not exactly what you want, it may still give you pointers on coding yours.

 

ed

 

Ed,

 

Not quite what I am looking for.. I still have the names of the options and then I display a full pict if the option... Imagine choosing a golf club and selecting the shaft as an option, the pict of the shaft will be displayed too...

 

Rob

Link to comment
Share on other sites

Ed,

 

Not quite what I am looking for.. I still have the names of the options and then I display a full pict if the option... Imagine choosing a golf club and selecting the shaft as an option, the pict of the shaft will be displayed too...

 

Rob

 

 

I am looking for this too. I have one product with multiple colors [option] and I want the user to select a color form the drop down and be able to see the image change to that color when they sleect different colors.

Link to comment
Share on other sites

Maybe a easier way of posting this question would be :

 

How do I add another image field? I know how to add it in the database, but what is needed in the php code...

Link to comment
Share on other sites

Rob,

 

The easiest way to hack code is to copy and paste whatever is already there. So, if there is an image already referenced in the code, simply copy that code, paste it and rename it to image2 (or whatever).

 

Anywhere a SQL statement selects image, add image2 after it.

Anywhere a php line manipulates image, copy that line, paste it and rename image to image2 so the same manipulation occurs.

Anywhere html displays image, copy it, paste it, and change it to image2 so that image2 is displayed as well.

Anywhere image is passed to javascript... you get the picture.

 

If that doesn't address your question, then we are talking past each other and we're not quite connecting. Sorry about that.

 

ed

Link to comment
Share on other sites

Rob,

 

There's an Options as Images contrib.  If it's not exactly what you want, it may still give you pointers on coding yours.

 

ed

 

 

I am going the route of the Options as image Contrib Link.

 

I am getting a SQL error when I import the included SQL file:

#1064 - You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Insert into configuration set configuration_title='Large Option

 

This is the syntax output:

SQL-query: 
INSERT INTO configuration_group
SET configuration_group_title = 'Product Attribute Images',
configuration_group_description = 'Use Images for Product Options/Attributes instead of drop lists.',
sort_order =5,
visible =1 INSERT INTO configuration
SET configuration_title = 'Large Option Images',
configuration_key = 'OPTIONS_IMAGES_LARGE',
configuration_value = 'true',
configuration_description = 'Include larger image in pop-up window on product info page',
configuration_group_id = '14',
sort_order =2

 

if anyone is really good with MySql and can help, feel free....

 

 

I cant get this to work. I am going to go the JavaScript route.....thank you!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...