Jump to content

Combinations - Only images of default combination displayed by default


Recommended Posts

  • 8 months later...

you must go into the product.js of your theme folder and find the following code:

  if(typeof(firstTime) != 'undefined' && firstTime)
   refreshProductImages(0);
  else
   refreshProductImages(combinations[combination]['idCombination']);
  //leave the function because combination has been found
  return;

 

then comment or delete the following lines like here:

  //if(typeof(firstTime) != 'undefined' && firstTime)
  // refreshProductImages(0);
  //else
   refreshProductImages(combinations[combination]['idCombination']);
  //leave the function because combination has been found
  return;

 

Tested and working on version 1.4.7

 

Hope this helps

 

Alessandro

  • Like 1

Share this post


Link to post
Share on other sites

  • 3 months later...
  • 7 months later...
  • 3 weeks later...
  • 1 month later...
  • 1 year later...

Hi !

 

I just tried that solution on Prestashop 1.6.0.6 and it is not working, all product images are displayed when opening product page

 

Anyone has a solution ?

 

Many thanks !

 

 

you must go into the product.js of your theme folder and find the following code:

   if(typeof(firstTime) != 'undefined' && firstTime)
    refreshProductImages(0);
   else
    refreshProductImages(combinations[combination]['idCombination']);
   //leave the function because combination has been found
   return;
then comment or delete the following lines like here:
   //if(typeof(firstTime) != 'undefined' && firstTime)
   // refreshProductImages(0);
   //else
    refreshProductImages(combinations[combination]['idCombination']);
   //leave the function because combination has been found
   return;
Tested and working on version 1.4.7

Hope this helps

Alessandro

 

Share this post


Link to post
Share on other sites

  • 4 months later...
  • 7 months later...
  • 6 months later...
  • 4 weeks later...
  • 3 months later...

 

in 1.6 have to comment this lines in product.js of your theme:

	//if (firstTime)
		//	{
		//		refreshProductImages(0);
		//		firstTime = false;
		//	}
		//	else

It works for me. prestashop 1.6.1.3

Share this post


Link to post
Share on other sites

  • 2 months later...

Hello everyone,

 

Sorry to ask the same question again several months later but I bought a template and I believe my product.js is different from the ones you describe because when I comment the lines for the 1.6 version, it does not work for me (I implemented the 1.6.1.5 version).

 

My problems :

 

- when a combination is selected from the category page (color different from default), it displays a product with the good big image but with default thumbnails. I really need this default behavior not to happen.

 

- Worse, when I check my product pages on a mobile (using chrome) : when you are on a product combination, default thumbnails appear after sliding (after showing first the good thumbnails, which can be a good thing)

 

I had a try with the ones who created the template but I had 3 different people asking and asking again for what can be my problem...

 

I know guys here are willing to help so I have a try asking if someone have the kindness to look at my website (still not opened to public but online)

Edited by nethel (see edit history)

Share this post


Link to post
Share on other sites

  • 4 months later...
  • 3 months later...

I encountered this problem at version 1.6.1.11 when the combination has the product main image. In that case, when the combination is selected, the main image is applied.

I made this change to overcome the problem. This will use the first image of the combination instead of the main image, and if no combination is selected, it will use the main combination with the product main image.

 

At the product.js around line 482, I'd replaced this:

			if (combination['image'] && combination['image'] != -1)
				displayImage($('#thumb_' + combination['image']).parent());

with this:

			if (!combinationImages.indexOf(combination['idCombination']) || combinationImages[combination['idCombination']].length === 0) {
				if (combination['image'] && combination['image'] != -1)
					displayImage($('#thumb_' + combination['image']).parent());
			} else {
				displayImage($('#thumb_' + combinationImages[combination['idCombination']][0]).parent());
			}

hopefully, this afternoon I'll make a PR at github with this.

Edited by Lucardo (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More