PrestaShop Forum

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum

Jump to content

 

Solving Cache problems.

10 replies to this topic
#1
superisc

    PrestaShop Newbie

  • Members
  • Pip
  • 6 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

#2
max1960

    PrestaShop Apprentice

  • Members
  • PipPip
  • 133 posts
very interesting, but I can not help you, if anyone has suggestions
face forward, then we test.
Sorry for my english, I have used Google translate.
Thanks

#3
chow

    PrestaShop Newbie

  • Members
  • Pip
  • 6 posts
Interesting finding. I came to this thread in search of cache knowledge in PS. I didn't know the smarty.config.inc.php file has so much funs. Have you encountered any problem so far?

#4
anson.c

    PrestaShop Apprentice

  • Members
  • PipPip
  • 132 posts
I too hope someone can help this problem since it's not a good idea to edit each of the php files.
Turning the smarty cache on does improve the speed alot!!!

#5
gemmo

    PrestaShop Newbie

  • Members
  • Pip
  • 15 posts
Really good advise. Is there any instructions in the packages downloaded that one should put "force_compile" to false when into production mode? Its an amazing difference now. Thx.

#6
aopon

    PrestaShop Newbie

  • Members
  • Pip
  • 4 posts
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);


#7
summer

    PrestaShop Apprentice

  • Members
  • PipPip
  • 62 posts
I turned off the force compile and the result is okay but some features are miss function, like thick box and product tooltips

#8
vincents

    PrestaShop Newbie

  • Members
  • Pip
  • 2 posts
I have exactly the same problem, the website shows only the first cached item, for category and product page, is there anyone has a good solutions to this?

#9
Jero

    PrestaShop Newbie

  • Members
  • Pip
  • 5 posts
Same problem on my webpage. I realy need this feature because my webpage is runing realy slow.

#10
finlander

    PrestaShop Apprentice

  • Members
  • PipPip
  • 181 posts
I also have this problem with Smarty caching causing my prestashop site to display an old 'view' of a page, because the new, actual version/content/settings of the page seems to be ignored. I had to turn Smarty caching off just so that I could control which category names appeared in the sidebox on home page -- with Smarty caching on, my changes to the sidebox were ignored.

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.

#11
Jero

    PrestaShop Newbie

  • Members
  • Pip
  • 5 posts
This issue seeems to be fixed in 1.4.4.