Tas Posted May 25, 2010 Share Posted May 25, 2010 Hi guys,Looking for some assistance here. I am currently building my own theme for a customer. As a part of the theme, the customer wishes to use fancyzoom for displaying the images, rather than thickbox.I realise I can quite easily modify the product.php file in the root directory of prestashop, however I don't see this as a good solution, incase of upgrades in the future, this change will be lost.My question is, is there a way to override the product.php file from the theme, so I can make a copy of it and place it in the theme folder, and therefore not change the original source code. This way only this particular theme will use fancyzoom, and all others will be unaffected, still using the thickbox css.Is this possible? I know with modules you can override the php by creating a modules folder within the theme folder, and copying the files across. I assume this same logic would apply to the core php files?Thanks, Tas Link to comment Share on other sites More sharing options...
rocky Posted May 26, 2010 Share Posted May 26, 2010 I'm not aware of any way to override the files in the root directory of PrestaShop. You can only override module TPL files in the theme directory. I think it is possible to do what you want in your theme without modifying any of PrestaShop's core files. I suggest that you add code in header.tpl to ignore the thickbox includes and replace them with fancybox includes in your theme, then change the thickbox code in product.tpl and order.tpl from thickbox to fancybox. For example, change lines 16-20 of header.tpl in your theme's directory from: {if isset($css_files)} {foreach from=$css_files key=css_uri item=media} <link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" /> {/foreach} {/if} to: {if isset($css_files)} {foreach from=$css_files key=css_uri item=media} {if $css_uri|strrpos:'thickbox.css' == true} <link href="{$css_dir}fancybox.css" rel="stylesheet" type="text/css" media="{$media}" /> {else} <link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" /> {/if} {/foreach} {/if} and change lines 32-36 from: {if isset($js_files)} {foreach from=$js_files item=js_uri} <script type="text/javascript" src="{$js_uri}"></script> {/foreach} {/if} to: {if isset($js_files)} {foreach from=$js_files item=js_uri} {if $js_uri|strrpos:'thickbox-modified.js' == true} <script type="text/javascript" src="{$js_dir}fancy-box.js"></script> {else} <script type="text/javascript" src="{$js_uri}"></script> {/if} {/foreach} {/if} Link to comment Share on other sites More sharing options...
Tas Posted May 29, 2010 Author Share Posted May 29, 2010 Fantastic reply, thank you so much. Link to comment Share on other sites More sharing options...
uddhava Posted June 3, 2010 Share Posted June 3, 2010 @rocky,There is a module for sale in the prestastore that "replaces" the default htmleditor TinyMCE for CKeditor.I dont know how they do it, but it seems that tinyMCE is getting overrided. At least 2 core Admin files need to be changed to enable this.What are your thoughts about that ? Link to comment Share on other sites More sharing options...
rocky Posted June 4, 2010 Share Posted June 4, 2010 I'm not sure how they are doing it. Perhaps they are using one of the Back Office hooks. I've written a list of hooks here and started writing explanations for each of them. Link to comment Share on other sites More sharing options...
uddhava Posted June 4, 2010 Share Posted June 4, 2010 Thats awsome. There are already some list floating around, but this seems to be the most conscise. Link to comment Share on other sites More sharing options...
uddhava Posted June 4, 2010 Share Posted June 4, 2010 Maybe it is possible that when installing a module you can backup some core files and install your own files...This still makes it hard to be version-independent, but at least it can be installed easily. Link to comment Share on other sites More sharing options...
rocky Posted June 4, 2010 Share Posted June 4, 2010 That's how I would do it. I'd create separate class and tab files and then change the database to point to the module's tab instead of the default PrestaShop tab. You'd need to create a separate version of the module for each PrestaShop version though. Link to comment Share on other sites More sharing options...
uddhava Posted June 4, 2010 Share Posted June 4, 2010 Indeed...Now i have to start learning how to create a seperate class and tabs ;-) Link to comment Share on other sites More sharing options...
uddhava Posted November 19, 2010 Share Posted November 19, 2010 And in the latest 1.4 we can override the core files !! Hooray !!! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now