Assigning a template that is a variant of home (Same template. different Style) for disupaing category the standard display is displayed
The problem is in file cmtemplate.php around line 216
I'll dig in this a little bit
Hi all
I digged a little bit inside this problem
The problem is in logic of file
/components/com_virtuemart/helpers/vmtemplate.php
Today we have template's styles so it is unsifficent to check if the name of the template cahenged, we need to check the unique id of the template for change.
Then in J4 it didn't work for different template object construction.
So this is my fix
In function setTemplate around line 186:
static function setTemplate ($template = 0) {
....
line 205 on:
$registry = null;
if($res){
$registry = new JRegistry;
$registry->loadString($res['params']);
$template = $res['template'];
$newTemplate = new stdClass;
$newTemplate->template = $template;
$newTemplate->params = $registry;
}
if(is_dir( VMPATH_ROOT .'/templates/'.$template )) {
$app = JFactory::getApplication();
if(VmConfig::isSiteByApp()) {
$currentTemplate = $app->getTemplate(true);
if ($currentTemplate->id != $res['id']) {
if (JVM_VERSION >= 4) {
$app->setTemplate($newTemplate);
$currentTemplateObj = $app->getTemplate(true);
$currentTemplateObj->id = $res['id'];
}
else {
$app->setTemplate($template, $registry);
}
}
}
} else {
vmError( 'The chosen template couldnt be found on the filesystem: '.VMPATH_ROOT.'/templates/'.$template );
}
Now it works
I still have problems using gantry 5 that if set by default prevents template change (even non gantry templates assigned it J menu itmes don't work), but this is a completely different story