Jump to content

Learning to create themes for Prestashop 1.3


Recommended Posts

What do I need to learn enable to create themes for Prestashop 1.3?

I know moderate PHP & MySQL and I can code valid HTML/CSS, but when I looked at some of the template files on the default theme I can't understand how it works. What do I need to learn to be able to create themes without any problem at all? Is there any special tools to make this easy?

Need some advice please.

Thanks!

Link to comment
Share on other sites

How about offering some tips and tricks on creating a prestashop themes? Like a list of common variables that I should be familiar with?

Also if you know smarty, then automatically you'll be able to make your own prestashop themes? or is prestashop using a modified smarty engine?

Link to comment
Share on other sites

PrestaShop uses standard Smarty and some of Smarty's plugins. You can see a list of Smarty variables accessible to all TPL files at the bottom of init.php. The variables in the if block are available when "v1.1 theme compatibility" on the Preferences tab is turned off and the else block variables and available when "v1.1 theme compatibility" is turned on.

You should copy the default PrestaShop theme and then play around with the code. If you understand HTML and CSS, then it isn't very hard to figure out. One trick is that you can override module TPL files within a theme by mirroring the file inside the theme. For example, themes/yourtheme/modules/blockuserinfo/blockuserinfo.tpl overrides modules/blockuserinfo/blockuserinfo.tpl. This lets you customise the module code to a theme without actually modifying the module.

Link to comment
Share on other sites

  • 1 month later...

You can create a new file like AdminOrdersCustom.php that extends from AdminOrders.php to override the functions, then go to Tools > Tabs, edit the "Orders" tab, then change the "Class" to "AdminOrdersCustom" to use your file instead of the default one. You could put SQL queries in the install and uninstall functions of a module to automatically do this.

Link to comment
Share on other sites

Thanks for the answer. That sounds good!

And what about overriding php functions in core files located in root or Classes folders?

I'm thinking here of files like:
* /order-detail.php
* /classes/Address.php
* /classes/Cart.php
* ...

Would it be possible?

Link to comment
Share on other sites

I haven't found a way to override the root files or classes, which limits what you can do with modules. The problem is that the calls to the classes are hardcoded as Address or Cart, for example, in PrestaShop's core files rather than being a specified class like with the tabs. You are limited to using PrestaShop's hooks to add code in specific places. If you want to put code in a place where no hook exists, then you are out of luck. The only way I can think of to override a root file is to create a modified copy of it in your module and change all links to point to it instead of the one in the root directory. I suppose you could also write code thats backs up the current root file and then replaces it with the one in your module, but that's probably a bad way of doing things. Let us know if you find any better way to override code.

Link to comment
Share on other sites

  • 6 months later...
What do I need to learn enable to create themes for Prestashop 1.3?

I know moderate PHP & MySQL and I can code valid HTML/CSS, but when I looked at some of the template files on the default theme I can't understand how it works. What do I need to learn to be able to create themes without any problem at all? Is there any special tools to make this easy?

Need some advice please.

Thanks!


Hi

I have over 13 years of software development in Microsoft based software development technologies. But I am a newbie to PHP and especially to Prestashop framework. I am learning the framework and in the process, started to write a series of posts(Creating a Prestashop 1.4 theme from scratch) to outline the creation of a new Prestashop theme using Visual Studio and other tools. The posts primarily are targeted towards a PHP/Prestashop newbie.

Please visit Creating a Prestashop 1.4 theme from scratch and share my experiences through my learning phase. I hope active participation from other novice Prestashop programmers like me and advices from Prestashop experts to make the posts helpful for others who require it.
Link to comment
Share on other sites

  • 3 months later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...