News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Bug causes template load to fail

Started by anthrobote, December 13, 2011, 13:25:19 PM

Previous topic - Next topic

anthrobote

Description:
If the extension name of a template (inside the <name> element in templateDetails.xml) differs from the directory name in which the template is stored (e.g. /templates/template-directory-name/), the template load process will fail due to the bug in .../helpers/shopfunctions.php (currently at line 516).  In the current state, $template->value variable (which is later accessed in the view) equals $template->name which contains the extension name, not the directory name. Afterwards, $template->value is used in a select box in .../config/tmpl/default_templates.php (currently at line 38) as the value attribute of <option> elements (the 5th parameter of JHTML::_(..)) and later stored in the database when selected and confirmed in VMM administration by user . The stored value is fetched during the template load process and used to construct the template path in .../helpers/shopfunctionsf.php (currently at line 451) inside the is_dir() check for template existence – failing to succeed and raising the warning "The choosen template couldnt found on the filesystem".

VirtueMart Version:
1.9.8M

Joomla/Mambo Version:
1.7.3

Proposed fix(es):
Replace:

$template->value = $template->name;

in .../helpers/shopfunctions.php (currently at line 516) with:

$template->value = $template->directory;

so it can be used correctly in .../config/tmpl/default_templates.php (currently at line 38), or change the JHTML::_('Select.genericlist',..) call so it uses 'directory' member variable as the 'value' attribute for the generated <option> elements like this:

echo JHTML::_('Select.genericlist', $this->jTemplateList, 'vmtemplate', 'size=1 width=200', 'directory', 'name', $this->config->get('vmtemplate'));

Then the templates successfully load irrespective of their "extension" name specified in templateDetails.xml.

Bugtracker task #:
Not submitted yet.

Milbo

Hmm we have this in line 518:

foreach ($jtemplates as $key => $template) {
$template->value = $template->name;
if (!$isJ15) {
if ($template->client_id == '0') {
$template->directory = $template->element;
} else {
unset($jtemplates[$key]);
}
}
}

So it is related to j1.5 and j1.7 differences. Did you test the K version? and how is this handled in j1.5? Is it actually valid to have a different path than element name?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

anthrobote

I didn't get so far, I have installed and tested just 1.7.3, can somebody do the tests?

It seems it's partly valid - Joomla recognizes the template only if the names matches except the case of the letters. For example Artisteer editor generates templates with names being the same except the case, but it still may cause a problem on a case-sensitive filesystem. So I think the path would be safer here. I have not found any documentation on this.