Jump to content

Solving Cache problems.


Recommended Posts

Hi,

(I'm from Spain, sorry about my bad English)

As you now, there is many problems with the cache system on prestahop, which makes it slow. You can modify the file: smarty.config.inc.php like this:

$smarty->caching         = false;
$smarty->force_compile    = false;



This makes that force compile is off, so the page is not regenerated every time. Doing this I get load times of 0.8-1.2 secs, and if I put it true I get 4-6 secs loading, so it's very important to put it off when you use your shop online.

the other var: $smarty->caching = false if you put it to true, you activate your cache, and on my test site I get loadings of 0.2 secs, which are very good. The problem is that it actually doesn't work:

As prestashop doesn't pass the ID to the smarty cache, the first category you visit, you will get the same page for every category page, and a similar thing with products and so on...

You can solve it doing this: On category.php look for (line 81 on my file):

$smarty->display(_PS_THEME_DIR_.'category.tpl');



And change to this:

$smarty->display(_PS_THEME_DIR_.'category.tpl',$category->id);



And the same with products.php and others...


The problem is that as I'm not an expert, I can't know the possible errors of doing this, and the real advantages.

That's why I would like other people to help me doing this test and giving your opinion.


Thanks for all

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...
  • 4 weeks later...
  • 2 weeks later...

Hi,
There is also a need to check if the template is cached, otherwise prestashop does all the normal data transformations, including database queries and finally pulls data from cache. We only save time for generating html. We have to edit all the php scripts that display data and add something like this befere any actions happen:

product.php

if(!$smarty->is_cached(_PS_THEME_DIR_.'product.tpl',$id_product)) {
  $product = new Product($id_product, true, intval($cookie->id_lang));
  ...
  ...
}

...
$smarty->display(_PS_THEME_DIR_.'product.tpl',$id_product);

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 2 months later...
  • 10 months later...
  • 1 year later...

This issue seeems to be fixed in 1.4.4.

I disagree - I am on 1.4.8.2 and this is still the problem.

 

Very frustrating that I cannot find an answer. What I really don't understand, though, is why the PrestaShop team is releasing a product (smarty caching) that is obviously malfunctioning .. WHY release a broken product??

 

No one should have to make hacks to core code to force smarty cache to get the most recent page data. Core code hacking on a fresh install is absurd.

 

I AGREE!

It is absurd to correct fundamental core functions in order for cache to work!

I am very disappointed in presta cache to date. It is not caching anything. Category pages take 8 seconds to load!

 

ANd all this happens with something as fundamental as performance.

There is a few Prestas out there with brilliant performance. Did they all have to hack core ?

Link to comment
Share on other sites

×
×
  • Create New...