zippen Posted October 14, 2011 Share Posted October 14, 2011 I'm new to prestashop and just installed the version 1.4. I am having problems figuring out how to add a piece of php code to the header. I need to insert <?php include('skin/shop-head.php'); ?> right before </head>. But can't figure out where and how to do that, as I'm not familiar with programming. From reading the forum I can see I might have to add it by using the header hook and a custom module. The problem is I don't have a clue how to do this or how to make the module. I have tried to duplicate a module and look into the php file, but still haven't figured out how i should include the path to the shop-head.php file. The file is in the root of the shop. Can anybody help me out with this. I'm sure its something simple, but when you don't know programming it's not that straight forward. Thanks in advance Link to comment Share on other sites More sharing options...
zippen Posted October 14, 2011 Author Share Posted October 14, 2011 I have now created and installed a new module with a simple echo "Hello World!"; in it and added it to the header (hookHeader). When i load the shop I can see the Hello World appear on top of my shop. But when i look at the source code it appears before the doctype. What am I doing wrong?: Hello World <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> I really need to get this working or else I will have to find a different shop. The purpose for including a php file in the header is because I need to wrap the shop in a companys website design using this tool: http://www.studio-ow...skin-helper.htm The neat thing about using this tool, is I can get the menu and design from the ordinary website to show on the shop so it appears the shop is a part of the website. This way I dont have to style Prestashop to fit the company layout, and I can easy update menu and design both places. I have had it working with osCommerse, Opencart, and Zen before without problmes. All it requires is to have: <?php include('shopskin/shop-head.php'); ?> inserted right before the the </head> tag <?php include('shopskin/shop-top.php'); ?> inserted right after <body> tag <?php include('shopskin/shop-bottom.php'); ?> inserted right before the </body> tag I really like using this tool as its pretty awesome. So any help on how to do this will be highly appreciated. Installing it used to be a pretty simple task in other shop systems. Thanks! Oh - and I don't know if i put this thread on the right part of the forum... Link to comment Share on other sites More sharing options...
studio-owens Posted November 15, 2011 Share Posted November 15, 2011 Follow the steps in the About.pdf that was included with the Shop Skin Helper. On step 4 you will need to do these steps for PrestaShop. All the other steps will remain the same. You can use Smarty includes in the PrestaShop theme's template files (.TPL). As an example, using the default prestashop theme, in the default directory structure. 1. You will modify three files in the PrestaCart default template directory: prestashop/themes/prestashop/header.tpl prestashop/themes/prestashop/footer.tpl 2. In the header.tpl file find: <head> Directly AFTER it add this code: {include file="$base_dir./shopskin/shop-head.php"} 3. In the header.tpl file find: <body {if $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if}> Directly AFTER it add this code: {include file="$base_dir./shopskin/shop-top.php"} 4. Near the bottom of footer.tpl find: </body> Directly BEFORE it add this line of code: {include file="$base_dir./shopskin/shop-bottom.php"} 5. Upload the two template files you just modified to the correct directory on your web server. The two files are: prestashop/themes/prestashop/header.tpl prestashop/themes/prestashop/footer.tpl If you need more assistance, then I code for money. $60 / hr is my standard rate. Best of luck. Link to comment Share on other sites More sharing options...
zippen Posted November 18, 2011 Author Share Posted November 18, 2011 Thank you so much Awesome script you made there! I just tried it out but it doesnt work in the newest version 1.4.5.1 sadly. So back to square one again Link to comment Share on other sites More sharing options...
zippen Posted November 18, 2011 Author Share Posted November 18, 2011 I tried to make a module and got it to insert the code i wanted into the head section. The problem now is it inserts the code before <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> My module looks like this: <?php if ( !defined( '_CAN_LOAD_FILES_' ) ) exit; class primanetskintop extends Module { function __construct() { $this->name = "tskintop"; $this->tab = 'front_office_features'; $this->version = '0.1.0'; parent::__construct(); $this->displayName = $this->l('Insert skin top'); $this->description = $this->l('skin - ikke slettes'); } function install() { if (!parent::install() OR !$this->registerHook('header')) return false; return true; } function uninstal() { if (!parent::uninstall()) return false; return true; } public function hookHeader($params) { return include('shopskin/shop-head.php'); } } What am i doing wrong? I don't get it Link to comment Share on other sites More sharing options...
Recommended Posts