Jump to content

Choose images before generate attribute combinations


aktk

Recommended Posts

Hello!

I'm happy with prestashop, but only one thing is really annoying.

With 30 enclosures, 4 attributes with 4 variations each, we got....
7680 attribute combinations.

So, if I wanna to link each combination to one of the 30 images of enclosures, I'll get a real pain.........

Is there any way to choose the 30 images BEFORE generate the attribute combinations?

Maybe a new option in the next version like this:

"assign a image to this attribute" or something.

Link to comment
Share on other sites

  • 8 months later...
  • 1 month later...
  • 2 weeks later...
  • 8 months later...

Hmm - that's not quite what I need as I want to apply a different image to each colour combination - basically the same as the ipod sample product. It's such a shame there isn't a quicker way to do it as it turns a really useful feature into an unusable one.

Link to comment
Share on other sites

  • 5 months later...

I think I've figured it out because I also need this functionality:)

Requirement:
First you need to assign images to every single attribute that can have it's own images.
At this stage do not combine any attributes! You need to create a list of single attributes with assigned image(s) to each.

Open {ps_root_folder}/classes/Product.php
Replace function addAttributeCombinationMultiple with this one:

   public function addAttributeCombinationMultiple($id_attributes, $combinations)
   {
       $attributesList = '';
       $imagesList = '';
       foreach ($id_attributes AS $nb => $id_product_attribute)
           if (isset($combinations[$nb]))
               foreach ($combinations[$nb] AS $id_attribute){
                   $attributesList .= '('.intval($id_product_attribute).','.intval($id_attribute).'),';

                   $result = Db::getInstance()->ExecuteS('SELECT id_image FROM '._DB_PREFIX_.'product_attribute_image AS i RIGHT JOIN '._DB_PREFIX_.'product_attribute_combination c ON (i.id_product_attribute = c.id_product_attribute) WHERE c.id_attribute = '.intval($id_attribute).' AND i.id_product_attribute IN (SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.intval($this->id).')');
                   foreach($result AS $row)
                       $imagesList .= '('.intval($id_product_attribute).','.intval($row['id_image']).'),';
               }

       $attributesList = rtrim($attributesList, ',');
       $imagesList = rtrim($imagesList, ',');
       $result = Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'product_attribute_image` (`id_product_attribute`, `id_image`) VALUES '.$imagesList);
       return Db::getInstance()->Execute('INSERT INTO `'._DB_PREFIX_.'product_attribute_combination` (`id_product_attribute`, `id_attribute`) VALUES '.$attributesList);

   }



After assigning all images to each attribute you can now generate combinations. Do it as usual:)
Each generated combination containing any of attribute(s) with previously assaigned image(s) to it will also have assigned those images to itself.

Link to comment
Share on other sites

  • 7 months later...

Hello, I have this problem, if I select the images that correspond to each combination of product, when regenerating combinations give me deselect the images previously selected and individually, this is crazy, as if to create theproduct combinations for instance gives a total of 2500 combinations, as you may have to go one to one by replacing the image that you have? I do not find a solution, and I think it's a prestashop serious mistake, let's crazy! See if someoneshares it has the solution because I do not find it.

 

As you can do to keep me deselect the images individually selected before using creative combinations of attributes? If not make myself clear, but it's a prestashop failure from my point of view, because once generated combinations, you will usually leave a lot of combinations, and then having to go one by one and place it corresponding image, uffff, total madness!

 

I've tried all sorts of code and has not produced any results, once the generator is used combinations of attributes, you lose all the selected images individually.

 

Thank you very much, best regards.

Link to comment
Share on other sites

  • 1 month later...

Hello, I have this problem, if I select the images that correspond to each combination of product, when regenerating combinations give me deselect the images previously selected and individually, this is crazy, as if to create theproduct combinations for instance gives a total of 2500 combinations, as you may have to go one to one by replacing the image that you have? I do not find a solution, and I think it's a prestashop serious mistake, let's crazy! See if someoneshares it has the solution because I do not find it.

 

As you can do to keep me deselect the images individually selected before using creative combinations of attributes? If not make myself clear, but it's a prestashop failure from my point of view, because once generated combinations, you will usually leave a lot of combinations, and then having to go one by one and place it corresponding image, uffff, total madness!

 

I've tried all sorts of code and has not produced any results, once the generator is used combinations of attributes, you lose all the selected images individually.

 

Thank you very much, best regards.

 

Really true. I am making an online computer configuration and order placement store. Each of my system can have 4 types of LCD, 4 types of keyboard mouse combo. I want to attach about 7 pictures to each of LCD and Keyboard mouse combo so that when user changes LCD or KB-Mouse Combo, all images of respective selected attribute are shown on screen. User shall navigate the image viewer to view all images of the attribute. This would help user to have a fine look at the selected LCD or combo through different images. I could not find a way to achieve this.

 

Also, there are two processors with only one image for each. How can I achieve this functionality where on change of processor, respective image of selected processor is shown on image viewer to user ?

 

There should be a way to attach a set of images to attributes.

 

Any suggestions?

Link to comment
Share on other sites

  • 4 years later...

I really can not understand the western programmer's thoughts and the way they think when developing an software like prestashop making setting attribution combination a real headache that i will switch to other software when I found one. The truth is in china the combination issue is really a piece of cake when you operate in taobao.com backend, or aliexpress backend, you just assign a photo to each product color, the color thumb will show the photo you assigned to it, and you choose by clicking on the photo, and about the material, size, style, any other attribute, you do not have to think about that, the software just do it for you.

 

With the time assigning photos for one item in prestashop, I already finish with 30 more products at aliexpress backoffice, and the productivity differ further much when you have more attrubute group with much more value.

 

One of my Chinese friend really can not understand what a stupid attribute combination generations it is with prestashop which has been developed for so many years still this urgent and must-be-eased function is far far away from your can imagine.

 

I am done with this.

Link to comment
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
×
×
  • Create New...