hi. i wonder if there is any way to overwrite a single template?
i want to have a switch between an overview of products with images and without.
as far as i read so far it’s possible to switch the whole template (or better theme?) while i just want to switch a single html file. or is best practies to check for a var and then have a condition within the template?
Hi,
how about 2 categories and assign an adapted list.tpl to the certain category via admin?
Regards
Or you could add “?tpl=yourtemplate.tpl” to the url to switch to another template.
is the get var ‘tpl’ regular in the source code or do i have to add some custom line of oce? (sorry, first steps with oxid)
It’s in the regular code but not in all views. A short explanation:
SEO Urls are translated to something like: index.php?cl=alist&someotherparams
The “cl”-parameter is the view, so in this case (category articlelist) the view “alist” is called. Then the “render”-method of the view is called, and the return value defines the template to be used. If you look in the function render of alist, you’ll find:
return $this->getTemplateName();
OK now look in function getTemplateName() of alist:
public function getTemplateName()
{
// assign template name
if ( ( $sTplName = basename( oxConfig::getParameter( 'tpl' ) ) ) ) {
$this->_sThisTemplate = $sTplName;
} elseif ( ( $oCategory = $this->getActCategory() ) && $oCategory->oxcategories__oxtemplate->value ) {
$this->_sThisTemplate = $oCategory->oxcategories__oxtemplate->value;
}
return $this->_sThisTemplate;
}
So you see if “tpl”-Param exists (fetched by oxConfig::getParameter), it is returned as Templatename.
You might also check these ressources:
http://www.oxid-esales.com/en/resources/help-faq/eshop-manual/creating-additional-pages