Search results

  1. V

    How to pass a parameter to a block?

    I think I was very clear. It's really simple. I am in a category page which displays products. So in the tpl file, there is a loop for showing products, this is my code working correctly (without Litespeed) {foreach from=$produits_categories key="i" item="product"} <div class="product_block">...
  2. V

    How to pass a parameter to a block?

    For now, I leave the subject aside because I had short time to test it. I have to master the subject to avoid surprises between different user contexts (employees, clients, not logged in users, ...). Litespeed has wonderful caching possibilities but it can be very dangerous if we don't use it...
  3. V

    How to pass a parameter to a block?

    That is exactly my point. Once the page is cached I cannot test $smarty.cookies.my_cookie_admin or my variable $isAdmin. As the admin visits a page, the cache is cleared for this page as set in the htaccess but it caches the page and any user will see the same content as the admin. That's why I...
  4. V

    How to pass a parameter to a block?

    I outputted the content of '$smarty.cookies' ( with {$smarty.cookies|@var_dump}) and it is exactly the same between all browsers. It seems that if the admin goes to the category page then all users have the same html content and exactly the same content for '$smarty.cookies'. Even the...
  5. V

    How to pass a parameter to a block?

    In the CategoryController.php, I assign a variable $this->context->smarty->assign('isAdmin', $isAdmin); I want to show this code <p class="launchJS" productid="1">Do something</p> only if I am admin so basically in my products.tpl I have {if $isAdmin}<p class="launchJS"...
  6. V

    How to pass a parameter to a block?

    Hello, I display a category with products. The display of products is done in a products.tpl file. For each product, I need to display a special block. For this I created a module with ESI block. This is a sample of the products.tpl file {foreach from=$produits_categories key="i"...
  7. V

    Possible to ignore some parts of pages from cache?

    Finally, I tried it but it's acting weird. I added the code in suggested in .htaccess file after the Litespeed generated code. <IfModule LiteSpeed> CacheLookup on RewriteEngine on RewriteCond %{HTTP_COOKIE} !PrestaShop- RewriteRule .* - [E=Cache-Control:vary=guest] </IfModule> ###...
  8. V

    Possible to ignore some parts of pages from cache?

    I will set the cookie in the admin controller. Thank you for your help!
  9. V

    Possible to ignore some parts of pages from cache?

    I created a module myadminblocks. It is very simple. I have a php file for the module (Below it's only an extract) class MyAdminBlocks extends Module implements WidgetInterface { private $templateFile = "module:myadminblocks/myadminblocks.tpl"; //... public function...
  10. V

    Possible to ignore some parts of pages from cache?

    Thank you so the best solution would be to create a simple module to show a block of text only visible for admins. I would have something like that {hook h="litespeedEsiBegin" m="ps_blockforadmin" field="widget_block" tpl="module:ps_blockforadmin/ps_blockforadmin-text.tpl"} {widget_block...
  11. V

    Possible to ignore some parts of pages from cache?

    Thank you for your reply but I see that the LiteSpeed module generates a specific code in apache conf <IfModule Litespeed> CacheLookup on RewriteEngine on RewriteCond %{HTTP_COOKIE} !PrestaShop- RewriteRule .* - [E=Cache-Control:vary=guest] </IfModule> I guess 'PrestaShop-' is a cookie used for...
  12. V

    Possible to ignore some parts of pages from cache?

    Hello, Actually, I display some content in frontend only when admins are logged in for example in category page. In a CategoryController.php, I test a cookie admin $cookie = new Cookie('psAdmin'); if this cookie is an admin cookie, I assign a variable to smarty...
Top