Jump to content

[SOLVED] product images problem


Recommended Posts

Hi,

I am having some issues with my product pictures.

Most of my products come in different colors. So I upload all the images when i create the products. But on my website, once i click on the product, once i select a color with the attribute dropdown list, all the images disappear except one, but not the one that i selected.

i also tried to insert an image such as a page of all the color attributes thumbnails (on PDF) when i create the product with the product description, but i don't know how, because it asks for an image url, instead of giving me a "browse" and select option...

I have over hundreds of products. Is there a faster way to attach the products attribute images to the products? How can i setup so that when the customer select an attribute, the picture for that attribute will show up?

Thank you

Link to comment
Share on other sites

You need to log in to your cPanel, choose "phpMyAdmin" in the "Databases" section, then click the SQL button in the left column or the SQL tab in the right column, then enter the SQL query and click "Go".

24852_bapyePyJPqZowVn1ZmYt_t

Link to comment
Share on other sites

No. Weird, I can't see any PrestaShop database in there. Are you sure you selected the right website and database? There must be a PrestaShop database somewhere, otherwise your site wouldn't work.

EDIT: Actually, I see there are quite a few databases there, but I'm not sure which is your PrestaShop database. Check config/settings.inc.php to find out which database PrestaShop is using.

Link to comment
Share on other sites

Yes, that's it. It looks like your database prefix is "ps_". You should now be able to click the SQL button and execute an SQL query on that database, but you should click on the "ps_product_attribute_images" table, then click the Export tab export the table, so that you can restore it later if something goes wrong.

Link to comment
Share on other sites

Ok. so I exported the table... i think... in sql format and saved it on my computer...

now, i click on SQL tab, and copy paste this:

TRUNCATE `ps_product_attribute_image`;
INSERT INTO `ps_product_attribute_image` SELECT `id_product_attribute`, `id_image` FROM `ps_product_attribute` pa LEFT JOIN `ps_image` i ON (pa.`id_product` = i.`id_product`);

right?

Link to comment
Share on other sites

  • 2 months later...

Think I've figured this one out as it was completely unsustainable to keep linking everything. The edits below leave the feature still working to show the correct image if you have linked them, but without hiding the rest.

In yourtheme/js/product.js, just comment out the bit that hides the thumb list, and in place of "i", put the maximum number of images you expect to have (I put 10), otherwise the thumbs list will only be wide enough for the number of images that are linked to the attribute. Affected lines for me are 309 and 318. Result looks like:

// Change the current product images regarding the combination selected
function refreshProductImages(id_product_attribute)
{
   $('#thumbs_list_frame').scrollTo('li:eq(0)', 700, {axis:'x'});
   /*$('#thumbs_list li').hide();*/
   id_product_attribute = parseInt(id_product_attribute);

   if (typeof(combinationImages) != 'undefined' && typeof(combinationImages[id_product_attribute]) != 'undefined')
   {
       for (var i = 0; i < combinationImages[id_product_attribute].length; i++)
           $('#thumbnail_' + parseInt(combinationImages[id_product_attribute][i])).show();
   }
   if (i > 0)
       $('#thumbs_list_frame').width((parseInt(($('#thumbs_list_frame >li').width())* 10) + 3) + 'px'); //  Bug IE6, needs 3 pixels more ?
   $('#thumbs_list').trigger('goto', 0);
   serialScrollFixLock('', '', '', '', 0);// SerialScroll Bug on goto 0 ?
}

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...