Project:Ubercart Option Images
Version:6.x-1.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:pillarsdotnet
Status:closed (fixed)

Issue Summary

I think that this module needs to consider default images for the options so that when assigned, it will automatically assign the images properly to the product. The reason for this request is that brown is brown regardless of product, so I create on brown image, but with the way that it works now, I have to assign the same image to all the products that have a brown color option.

Having the ability to have different option images for different products, like in the shoe example, having a default would be great as well for those that don't have different product pictures of the same product but in different styles/colors.

Granville
granville@kirkhamsystems.com

Comments

#1

Assigned to:Anonymous» tjholowaychuk

Certainly could be a possibility. Although IMO it would seem a little silly from an end-user perspective to select say 'blue' for product 'a' and see just a simple blue swatch, and then choose 'blue' for product 'b' and see the exact same swatch, I would think the majority of sites would be utilizing it on a per-product basis. That being said I can defiantly understand that not everyone can obtain several images of the same product in different states

#2

Status:active» postponed

#3

Status:postponed» active

I would say that I would love to see the same thing... default images for options. I have a furniture store online, and we allow custom ordering on sofas. Because ordering a sofa in every fabric offered would be costly, I'd just like to have default images for ubercart attribute options for fabric swatches on sofas and throw pillows. Our drupal store address is: www.chapinfurniture.com

#4

I'd like this as well. I'm developing a site for an engraving store and there are many substrates that are can be used on more than one product. Having a default image would save on data entry time.

#5

Version:5.x-1.0» 6.x-1.x-dev
Assigned to:tjholowaychuk» pillarsdotnet

Option to be added in 6.x version. Once it's complete, I'd appreciate help in producing a backport.

#6

Perhaps an idea would be to have it so a default image can be assigned on a per option basis and over-ridden on a per node basis?

#7

It's not only about data entry in my case. I have a range of materials used over different products, and every time I add the image, it creates a new file with a different extension. As there are about 15-20 products, I don't think it is very organized to have 20 duplicate image files in my option images (times 12 different materials). I tried to add one, then delete it when I add the next, thinking that it would maybe see that there was no files with the original name, but it simply chose the next in line. Even when I cleared the whole folder to start over and removed all the files, it still starts off at 'beech_10' instead of going back to the start.

Any suggestions?

#8

I found the solution!

Time consuming, but it worked in my case of multiple images. First, get filefield_source and activate it. Next clear all caches and look for the (in my case) MAMP/tmp/php folder where there is uploaded an extra copy of the image. Every time I uploaded a particular image, I just deleted the consequent file in the tmp/php folder and do it all over again. Now the uploaded files have the right name, and don't keep making a new file as image_0.jpg etc.

Hope this helps someone.

#9

Very helpfull module. Very good idea. But the default image overrided at product level is a basic need, indeed.
Even while just uploading all attribute images at product level. This feature would considerably increase this module interest.

Any idea of when this functionality will be integrated ?

#10

Bumping this Feature Request as it does seem very important (would it be that hard to impliment) I check issue queue msgs for Option Image Module almost everyday hoping for some updates.

#11

It definitely make sense to upload the images into /admin/store/attributes/*aid*/options as default images. Then allow users to override them in node/*nid*/edit/options if need be.

That way store administrators don't need to upload the same images over and over for products that share similar or the same swatch / image / texture

#12

+1 for me I would also find this feature incredibly useful!

#13

Subscribing, greetings, Martijn

#14

+100 I ran into the same issue. I don't want to assign 5 pictures for 20 products with the same attribute.

#15

I have created a solution for this problem. Attached is a patch. If the patch doesn't work, then the change is pretty simple. Add this to uc_option_image_form_alter():

case 'uc_attribute_option_form':
  // We use 0 instead of the nid to define the default image for an option
  $attribute_same_image = variable_get('uc_option_image_same_image','');
      $aid = arg(3);  
  $oid = arg(5);
      $same = $attribute_same_image[$aid];  
      $file = uc_option_image_load(0, arg(3), $oid, $same);
             
      if (!empty($file))
      {
        $form['option_image_preview'] = array(
          '#type' => 'markup',                      
                  '#value' => theme('uc_option_image', $aid, $file, variable_get('uc_option_image_preview_size', '_original')),      
        );
        $form[uc_option_image_id(0, $aid, $oid)] = array(
          '#type' => 'file',
          '#title' => t('Image'),
          '#name' => 'files[' . uc_option_image_id(0, $aid, $oid) . ']',
          '#size' => 8,
          '#default_value' => $file->filename,      
        );
        if ($file->filename != 'option_image_0_0_0') {
           $form['remove'] = array(
             '#type' => 'checkbox',
'#title' => t('Remove')
           );
        }
      }
        
      $form['#submit'][] = 'uc_option_image_uc_attribute_option_form';
      $form['#attributes'] = array('enctype' => 'multipart/form-data');
     
  break;

and add elsewhere in the module the following:

function uc_option_image_uc_attribute_option_form($form, &$form_state) {
  if ($form_state['values']['remove']) {
    uc_option_image_delete(0, $form_state['values']['aid'], $form_state['values']['oid']);
  }
  else {
    uc_option_image_save(0, $form_state['values']['aid'], $form_state['values']['oid']);
  }
}

The module saves images with names like option_image_$nid_$aid_$oid. To create default images for each attribute / option combination using the new code we simply save with names like option_image_0_$aid_$oid, substituting 0 for $nid. The module already handles this default option without any changes required so it was part way there. The above completes the functionality.

AttachmentSize
uc_option_image_modified.patch 2.56 KB

#16

I have built a custom module that implements this functionality using the code from New Zeal. If anyone wants the module i will upload it here.

#17

Hi, Hopefully your module also takes into consideration more than one image per option?
Yes please upload your module!
greetings, Martijn

#18

Hi, @theamoeba. Is your module the original module with the above patch, or is there more functionality?

#19

Status:active» fixed

Patch from #15 applied to -dev.

#20

at the moment the module just implements the functionality of #15.

AttachmentSize
uc_option_images_default.zip 1.25 KB

#21

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#22

This module/patch is exactly what i need but the instructions are not clear to me. Do I still need uc option images enabled? Do I use both at once?

I also do not understand the image saving notes. If I had example.jpg what would I actually call it? All the $aid $oid stuff is confusing me.

If someone could please provide some basic info that would be of great help, thanks.