Jump to content

Color Index Issue


wstar

Recommended Posts

  • We have a fresh install of Prestashop 1.6.1 and made a few products, giving them color options.  Some products have this error, others do not.  I can't find any relationship between the products that display the error and the ones that do not.
    • Notice: Undefined index: colors_list in C:\LGSRoot\prestaLGS01\web\cache\smarty\compile\8d\f8\d6\8df8d63f517dbbc10131b282caed982e6a9bc5a9.file.product-list-colors.tpl.cache.php on line 34
      
      Notice: Trying to get property of non-object in C:\LGSRoot\prestaLGS01\web\cache\smarty\compile\8d\f8\d6\8df8d63f517dbbc10131b282caed982e6a9bc5a9.file.product-list-colors.tpl.cache.php on line 34

I've tried to clear the cache as noted on these forums.  I've tried to remove the color attributes and remake.  Nothing seems to work.  When I clear the cache, the errors go away on a refresh.  Once I refresh a second time, the errors come back.

 

 

Link to comment
Share on other sites

I managed to solve that problem - I think it should be reported as bug.

I overwrote one line of  FrontControler->addColorsToProductList

FROM

$tpl = $this->context->smarty->createTemplate(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']));

TO

$tpl = $this->context->smarty->createTemplate(_PS_THEME_DIR_.'product-list-colors.tpl');

 

so it is as it was in version 1.6.0.9

and it works

Link to comment
Share on other sites

  • 1 month later...

I confirm that the changes + cache refresh does the trick. However, the problem surfaces again in a few hours.

 

LE: It seems the problem is somehow related to the client cache. Once the browser cache is emptied, the problem dissapears, only to come back again in a short time.

 

 

I managed to solve that problem - I think it should be reported as bug.

I overwrote one line of  FrontControler->addColorsToProductList

FROM

$tpl = $this->context->smarty->createTemplate(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']));

TO

$tpl = $this->context->smarty->createTemplate(_PS_THEME_DIR_.'product-list-colors.tpl');

 

so it is as it was in version 1.6.0.9

and it works

Edited by anconstantinescu (see edit history)
Link to comment
Share on other sites

  • 2 months later...
  • 7 months later...
  • 1 month later...

Hi Team,

 

I believe this may be the fix for this issue.

 

http://stackoverflow.com/questions/39408532/how-to-resolve-the-prestashop-notice

 

Open /themes/YOUR_THEME/product-list-colors.tpl

Search for

{foreach from=$colors_list item='color'}

and add a condition that will check if the '$colors_list' variable is set or not. The final code will be something like as follows:

{if isset($colors_list)}
//Current foreach loop code
{/if}

 

Lastly, don't forget to clear your cache!

Edited by kdmonk1 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

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