| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
#1
|
|||||||||
|
|||||||||
lists in .tpl
I am having a hard time understanding the list structure here.
so we have main.header.tpl and inside there we have <list name="layout.header" /> Now I would just like to comment out the minicart in the header, or is it a module I can deactivate?
__________________
xcart 5.1.2 |
|||||||||
#2
|
|||||||||
|
|||||||||
Re: lists in .tpl
You have two ways to achieve it:
1) Via template - Enable Custom Skin module or create your own one (I believe, you already created one) that registers skins - Create the template main.header.tpl that will replace default one, so its code will be as follows: Code:
This template will sit in the skins/custom_skin/default/en/layout/ folder if you are using Custom Skin module. If you are using your own module, it will sit in the <PATH-TO-YOUR-CUSTOMER-SKIN>/en/layout/main.header.tpl Finally, the whole process is described here: http://kb.x-cart.com/pages/viewpage.action?pageId=7504837#Webinar2-10Apr2014-DesignchangesinX-Cart5(Custom...stomSkinmodule http://kb.x-cart.com/pages/viewpage.action?pageId=7504837#Webinar2-10Apr2014-DesignchangesinX-Cart5(Custom...ridingtemplate 2) Via PHP code This process is described here: http://kb.x-cart.com/pages/viewpage.action?pageId=7504837#Webinar2-10Apr2014-DesignchangesinX-Cart5(Custom...-2.2.ByPHPcode In this case, you need to create runBuildCacheHandler() method in your Main.php file and call there something like: PHP Code:
Please, let me know if it helps.
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
#3
|
|||||||||
|
|||||||||
Re: lists in .tpl
Honestly Tony it didn't help one bit.
I want to create a custom skin, and write some HTMl /CSS like I have done for 15 years. I'm a front end developer. I was ok with understanding $smarty.foreach and some basics like that, but from what I have experienced thus far... well x-cart has completely changed. I can't even find any HTML to edit, every file I find has a list.blah.blah... I don't get it.
__________________
xcart 5.1.2 |
|||||||||
#4
|
|||||||||
|
|||||||||
Re: lists in .tpl
Hi!
Think of lists as named placeholders where widgets and templates can insert themselves - this is how modules can insert custom data into existing templates without modifying them. Let's say you want to see what is actually displayed in the "layout.header" list. You search through all files for list="layout.header.right" string and find several scripts and templates having @ListChild (list="layout.header.right" ...optional extra parameters go there...) directive in them. Some of the files would be .tpl templates. Some of them would be PHP classes. PHP classes are easy to extend from your custom module, so you can change their behavior without modifying core files. One of the files would be the \XLite\View\Minicart class (classes/XLite/View/Minicart.php). This is the widget that renders the minicart. What is a widget: in most cases it is a pair of a PHP class retrieving data and a .tpl template wrapping the data into HTML. Like in Smary, you may use "variables" in your templates. However, in Smary you "push" data to templates from your PHP scripts (with the "assign" function), whilst in X-Cart 5 templates "pull" data by executing methods of the associated widget class. This allows other modules to extend widget classes and customize the way how data is being retrieved without even touching original templates. Now back to the Minicart widget. If you check the widget class, you'll find this method: Code:
This is the method that X-Cart 5 executes to determine whether the widget should be displayed on the page. So, to hide the minicart forever you should create a custom module that "decorates" the Minicart widget class and overrides the isVisible() method to make it always return "false". As you see most of the changes (since X-Cart 4) were made with the "easy upgrades" goal in mind: you can customize your website without changing core files. And you don't have to repatch core files every time you upgrade the store to a new XC5 version. There may be changes incompatible with your custom modules, but locating the places and fixing them is much easier than in XC4. There are other ways to hide the minicart: - find the template file rendered by the Minicart widget class (usually the path to the template is combined from the getDir() and getDefaultTemplate() methods of the widget class), create a module with a custom skin and let the custom skin replace the minicart template with an empty one - find the template that inserts the Minicart widget, create a module with a custom skin and let the custom skin replace the "parent" template with a new one that would not insert the widget; in your case this would be removing the <list> tag (but this will remove all widgets in the list, not just the minicart widget) - this is the (1) point in the Tony's message - create a custom module that postprocesses view lists after widgets inserted themselves into the lists, finds the minicart widget and removes it from the layout.header list - this is the (2) point in the Tony's post Last edited by xplorer : 08-20-2014 at 12:21 AM. |
|||||||||
|
#5
|
|||||||||
|
|||||||||
Re: lists in .tpl
Quote:
OK, in this case the first method I described (via template) should work for you. Did you manage to apply it? Let me try to explain how view lists work. We have this code Code:
This code means that this HTML part will be rendered like this Code:
There are two typical questions:
Please, let me know if it helps. Of course, if there are any questions, please let me know. I am very interested in communication with storefront developers, so it would allow me to write proper docs for such type of developers + we will be able to improve software for you. Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker! Know how to make X-Cart better? Suggest an idea! |
|||||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|