Display image of Default Combination Prestashop

Hi there! Last week one of my clients asked me to display images of the default combination in Prestashop, instead of displaying all them.

It is true that you can add this feature to your theme using an addon from Prestashop, but why do you have to pay if you can get it for free? Let’s take a look how to implement it.

Free method

Prestashop 1.6

Navigate via FTP to /themes/yourtheme/js/produt.js and find this code around line 459:

  if (firstTime)
  {
     refreshProductImages(0);
     firstTime = false;
  }
  else
     refreshProductImages(combinations[combination]['idCombination']);
  //leave the function because combination has been found
  return;

Then, simply comment these lines:

  //if (firstTime)
  //{
  //   refreshProductImages(0);
  //   firstTime = false;
  //}
  //else
     refreshProductImages(combinations[combination]['idCombination']);
  //leave the function because combination has been found
  return;

 

Prestashop 1.4.7

Navigate via FTP to /themes/yourtheme/js/produt.js and find this code:

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

Then, comment some lines:

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

 

Buying an Addon

I don’t recommend to buy an addon. The reason why I don’t like this platform is due to prices and quality of the code they sell.

The point of buying an addon is that you can change the theme whenever you want and the feature to display images of default combination will be always able. Changing the product.js means that you will always have to change it if you change your theme.

Here is the addon.

 

Comments will be appreciated.

Bye!

Marcos Banner

¡Hola, soy Marcos!

👨🏻‍💻 Nómada digital y emprendedor desde 2013.

🚀 Conozco y comparto todos los trucos sobre Instagram.

⭐️⭐️⭐️⭐️⭐️

Mi truco estrella para conseguir seguidores en automático

Ha llegado la hora de que te cuente cómo genero seguidores en automático cada mes, sin apenas publicar en mi cuenta.

⭐️⭐️⭐️⭐️⭐️