Jump to content

GabrielMota

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by GabrielMota

  1. You would need to try, never touched in prestashop again, it was a one time intern work, I don't even remember ever programming in php.
  2. In a php to pass the smarty to the tpl. Eg: by adding in blockuserinfo.php module in HookDisplayTop function you coud then use the var $tax in blockuserinfo.tpl to switch the text. Don't assign the smarty in Group.php For Homepage featured modules need to either disable the cache to those modules(via code) or duplicate the caches (with/without tax) by duplicating the tpl in module folder and adding in module php the code with the duplicated tpl if (!$this->isCached('homefeatured.tpl', $this->getCacheId('homefeatured.tpl')) || !$this->isCached('homefeatured.tpl', $this->getCacheId('homefeaturedtax.tpl'))) { ..... module code updating cache } if($_COOKIE['taxDisplay'] == 0) return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId('homefeatured.tpl')); else return $this->display(__FILE__, 'homefeatured.tpl', $this->getCacheId('homefeaturedtax.tpl'));
  3. http://www.delikatessen.pt/ Top Left Button, you can see the price changing except for homefeatured/frontpage tabs that stays in cache.
  4. I added in a tpl of module "blockuserinfo" so the button appear at the top. By replacing "public static function getPriceDisplayMethod($id_group)" function code in Group.php with if($_COOKIE['taxDisplay'] == 0) return 1; else return 0; Will make the product display the price with/without tax.
  5. I think i made it In TPL <script> {literal} function setTaxExclude() { var expire = new Date(); expire.setMonth(expire.getMonth() + 12); document.cookie = 'taxDisplay'+ "=" + 'include' + ";path=/;" + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())) } function setTaxInclude() { var expire = new Date(); expire.setMonth(expire.getMonth() + 12); document.cookie = 'taxDisplay' + "=" + 'exclude' + ";path=/;" + ((expire == null) ? "" : ("; expires=" + expire.toGMTString())) } {/literal} </script> {if $tax == 'include'} <div class="TaxDisplay"> <a href="" onclick="setTaxExclude()" <span> Tax included</span></a> </div> {else} <div class="TaxDisplay"> <a href="" onclick="setTaxInclude()" <span> Tax excluded</span></a> </div> {/if} in php $this->smarty->assign(array('tax' => $_COOKIE['tax'])); This is a button to change the var (include/exclude). Then just use {if $tax == 'include'} show price with tax in products.tpl and others... It worked for me but as I am newbie idk about performance...
  6. Anyone could help on this? How to save and change a session cookie? {if $includeTax} <div class="tax"> <a href="" onclick="changeTax()" <span> Tax included</span></a> </div> {else} <div class="tax"> <a href="" onclick="changeTax()" <span> Tax excluded </span></a> </div> {/if}
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More