Jump to content
thirty bees forum
  • 0

Creating a template - tutorial


Uzumymw

Question

Hello,
Is there any tutorial - how to create a custom template? Website docs.thirtybess.com is not complete.

I have not found anywhere any information how to fill config.xml file, how to decide which js or css files will work with foreach from=$css_files or foreach from=$js_files

I would be grateful for any information.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

If you don't want to handle it via code you can just put css and js files inside autoload folder (css & js) in the theme folder.

You can also add them manually to header.tpl file.

Or you can create a module and register displayHeader hook with all logic

  • Like 1
Link to comment
Share on other sites

  • 0
18 hours ago, Uzumymw said:

Hello,
Is there any tutorial - how to create a custom template? Website docs.thirtybess.com is not complete.

I have not found anywhere any information how to fill config.xml file, how to decide which js or css files will work with foreach from=$css_files or foreach from=$js_files

I would be grateful for any information.

Well, I can't help you exactly with the question because I'm no coder. 

If you want to create a new one theme, no idea. But if it is for your own store, you want to simplify work and have flexiblity on layout, design and functionallity options (almost infinite), I highly recommend you Panda from Snnytoo, is TB compatible and they give good support.

I've developed some stores for customers with that template.

Good luck!

Link to comment
Share on other sites

  • 0
19 hours ago, yaniv14 said:

it need to be inside themes/my_theme_name/css/autoload/

and all is clear 🙂 Somewhere should be these basic information. Not everyone worked on prestashop (e.g. I had a problem with such a simple thing).
 

5 hours ago, danwarrior said:

Well, I can't help you exactly with the question because I'm no coder. 

If you want to create a new one theme, no idea. But if it is for your own store, you want to simplify work and have flexiblity on layout, design and functionallity options (almost infinite), I highly recommend you Panda from Snnytoo, is TB compatible and they give good support.

I've developed some stores for customers with that template.

Good luck!

I've creating themes every day - I don't have to buy others. And I'm not a fan of modifying existing templates,
Unfortunately so far I did not work on PrestaShop (ThirtyBees), so I needed some basic information.
 

 

Edited by Uzumymw
  • Like 1
Link to comment
Share on other sites

  • 0

Is there a guide to finding a variable and making it available to a template like product.tpl?
I know there's not enough money in open source software for anyone to make a living and write instruction books at the same time, so maybe someone random knows!

The variable I need is anything to do with delivery rates; whatever can be found before a customer orders or registers. Something like that was discovered for Prestashop 1.5 here:
https://www.prestashop.com/forums/topic/424375-solved-shipping-price-on-product-page/
but I need to learn a bit more before I can apply it to Prestashop 1.6.1 / Thirtybees.

(There are work-arounds. It's possible to have a different template for different products so I can just write my own information freehand into the template and have another template for each unusual weight or size. That gets harder for exports - weight & dimensions effect most products rather than a few.)
(I read that writing {debug} at the top of a template on a copied site shows me what I can call-up and that I can write code to declare weight width depth and height if set for the shopping cart already. If I understood how the shopping cart calculates postage, maybe I could repeat that work on the product.tpl page.)

 


 

Link to comment
Share on other sites

  • 0

In general

class/controllers/FrontConroller.php

assign some global variables (inside init() function) that available to all templates.

other then that each front page Controller add relevant variables to its own template... for example

controllers/front/ProductController.php (inside initContent() function)

similar process goes to hooks from modules -> registered hooks and some global template hooks.

if you dont want to create a special module with custom hook and execute that hook inside your desire template, then you can and should override 

the desire front controller initContent function and add whatever variable you need.

for example:

<?php
	class ProductController extends ProductControllerCore {
		public function initContent() {
			$this->context->smarty->assign(
				[
					'my_custom_variable' => 'my custom value',
				]
			);
			parent::initContent();
		}
	}

now about you request for the shipping rates/zones and stuff, I cannot help much because I am not familiar with that part of the code and I dont have the time right now to dig inside.

usually all codes/functions related to what you need is inside the desire class inside "classes" folder. can't tell if you need to look inside Zone.php or Cart.php or something else.

Hopes it helps a bit and wish you good luck finding what you need.

btw: when doing an override you need to remember to delete the file "cache/class_index.php"

Edited by yaniv14
  • Like 3
Link to comment
Share on other sites

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...