Guest Posted October 30, 2013 Share Posted October 30, 2013 hi all, i have problem. iam normal user not programer. i must add one php code into header (or footer) - this me write from company. so i opent header.tpl what is in my template folder and copy this php but this isnt for :,( so i look on google and i found that when i write {PHP}{/PHP} and write php code betwen this so work. so i test but when i write php code into this {PHP}here is my php code{/PHP} so still not work. please anyone help me / give me tip how add normal php code into template header please. this is my php code what i must add into header: ?php if(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && preg_match('/affiliatecompanywebsiteishere\.com/',$_SERVER['HTTP_REFERER'])) setcookie('referrer','affiliatecompanywebsiteishere',time()+3600*24*60); ?> Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2013 Share Posted October 30, 2013 yes and info my prestashop is version 1.3.4.0 i dont know is it need as information is i write here. Link to comment Share on other sites More sharing options...
vekia Posted October 30, 2013 Share Posted October 30, 2013 hello you said, that you use 1.3.x version so i think that in this case you can try with: {php} if(isset($_SERVER['HTTP_REFERER']) && !empty($_SERVER['HTTP_REFERER']) && preg_match('/affiliatecompanywebsiteishere\.com/',$_SERVER['HTTP_REFERER'])) setcookie('referrer','affiliatecompanywebsiteishere',time()+3600*24*60); {/php} Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2013 Share Posted October 30, 2013 (edited) hi vekia, ok today night i test it. so maybe i made mistake when i write: {php}?phpif(isset($_SERVER['HTTP_REFERER']) &&!empty($_SERVER['HTTP_REFERER']) &&preg_match('/affiliatecompanywebsiteishere\.com/',$_SERVER['HTTP_REFERER']))setcookie('referrer','affiliatecompanywebsiteishere',time()+3600*24*60);?>{/php} right? ok i test night your version. very thanks vekia Edited October 30, 2013 by MPart (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted October 30, 2013 Share Posted October 30, 2013 no, you don't have to use <?PHP ?> markups only {php}{/php} remember that this works only with old smarty ps version, in 1.5 it will not work anymore Link to comment Share on other sites More sharing options...
Guest Posted October 30, 2013 Share Posted October 30, 2013 (edited) ok thanks vekia. yes i have old presta 1.3 so today night i test.only please I could ask - it does not matter if I will put the code into header or footer? right?there is no difference when i will put php code into header or footer right? or yes exist difference? Edited October 30, 2013 by MPart (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted October 31, 2013 Share Posted October 31, 2013 you can't override config files, it mean that after each upgrade you will need to change it once again. Using php code in tpl file is the denial of the idea of MVC. Link to comment Share on other sites More sharing options...
Guest Posted October 31, 2013 Share Posted October 31, 2013 Vekia yes your version works very thanks please my last question now is affiliate okay and now i only add into produt page into product description one small javascript but when i open this product in backend and click on html view and i copy this javascript and save so on front end ison product page in description tab still only text and javascript not. what ii must do for add one javascript into product description please? (prestashop 1.3.4.0) i find in prestashop forum and i found one thread where is wrote that for this is must mce. please give me tip how add javascript into product description in frontend on tab product detail tahnks Link to comment Share on other sites More sharing options...
vekia Posted October 31, 2013 Share Posted October 31, 2013 hello when you save product edit page with included javascript to description field, after refresh - it still appears there? Link to comment Share on other sites More sharing options...
Guest Posted October 31, 2013 Share Posted October 31, 2013 Hi vekia, i write what i need: this affiliate is in cookie and after buy now i have on my prestashop 1.3,4,0 ok -> cookie, and confirmation (cookie is in header, and confirmation after buy is in orderconfirmation.php). this is okay and now three step - this affiliate have option add button on product page, and then user click on product so this product show on affiliate website after user login. this button give me affiliate company in javascript BUT now is problem -> when i edit product in my prestashop and click mouse into long description and click on "html" and here i add javascript on top and afteri save, so when i look on frontend on this product so in product description isnt this button :/ so my question is -> in prestashop into product description not work javascript? its strange because example when i add into description code from youtube so this work but when i add this javascript what my give affiliate company so button isnt this is javascript what give me affiliate company and they say me add this button on product page. so i was try add in one product into product description but after save changes when i look on frontend so this isnt in product description :,( <script type="text/javascript" src="http://www.affiliatecompanywebsite.com/wishButton.php?ean=123456789&firm_id=hereismyidnumberwhatprovidemyaffiliatecompany"> </script> Link to comment Share on other sites More sharing options...
Guest Posted October 31, 2013 Share Posted October 31, 2013 yes, when i edit product description in backend, click on html add javascript, and save. so when i look on frontend so in frontend isnt nothink, and when i back into backend and look again on same product on product description and again click on html so here is javasript but on frontend not appears Link to comment Share on other sites More sharing options...
Recommended Posts