News:

Looking for documentation? Take a look on our wiki

Main Menu

3.2.4 bug in Products module

Started by fro.reie@gmail.com, November 11, 2017, 20:40:39 PM

Previous topic - Next topic

fro.reie@gmail.com

Products module, Layout field. The drop-down box gives three options, but when trying to save with the first option "No override", we get the message "Warning. Field required: Layout", and nothing is saved. The field is also marked with an asterisk (required). This seems like a moot point since the field cannot be left blank in any way.

This used to be ok before (not sure which version, we seldom need to edit this module).

Tested with VM 3.2.2 and 3.2.4, and various versions of Joomla, including 3.8.2.

aftertaf


fro.reie@gmail.com

Thanks for testing.

True, it looks like it's saving. But if you exit the module and re-enter you will see that whatever your changes are, they have not been saved, as long as "No override" is set. You may also check the frontend as well and you will see nothing changes.

aftertaf

ah, i dont use the product module anywhere (yet) so cant test on frontend.
seemed like it saved for me though. sorry if i muddied the waters...

fro.reie@gmail.com

Not at all, you helped clarify the case by pointing out that it may look like the configuration is saved.

If you can try once more in the backend and then possibly confirm the bug.

Create a module and save with Layout=Default. Everything is saved ok. Then set Layout=No override, and maybe change a few other fields as well, and save. You will get the warning. Exit the module and re-enter and what do you see? Has anything been saved?

Studio 42

I can reproduce the bug.
This is because the XML require à value, but using "No override" set it to nothing.
A solution is in /modules/mod_virtuemart_product/mod_virtuemart_product.xml to remove required="true" from line
        <field
          name="layout"
          type="vmlayout"
          label="MOD_VIRTUEMART_PRODUCT_LAYOUT"
          required="true"
          extension="com_virtuemart"
          view="mod_virtuemart_product"
          description="MOD_VIRTUEMART_PRODUCT_LAYOUT_DESC"
        />

In all case, this is not required, Joomla fallback to default if the layout file is not found.

fro.reie@gmail.com

Thanks, that removes the "required part".
But "No override" isn't what's displayed in the front end even if it's set in the backend, so this needs more fixing.

Studio 42

This fix the bug. as i said, in all case "no overidde" is == to default, because it fallback to default.php layout.
So to say "no overidde" is a stupid for a module layout setting that should not display in the list at all because the logic of joomla is :
"no overidde"  = empty value, this get never found because .php is not valid and display default.php. so no override need an extra step to get same result as using default

fro.reie@gmail.com

Sorry for the late reply, I've been busy.

No this does not fix the bug, and "no override" is not the same as default. We have several copies of this module that uses no override, and they work fine as long as we don't edit any of them with the present version.

If I change

params "layout":""

to

params "layout":"0"

in the modules table then it's working ok.
So the missing "0" is the culprit.

Studio 42

If you set module to "default", does this change something in your case?
default is always fallback in Joomla. So i really dont understand why you need "no override" ???
If you check in all other modules using Joomla core layout setting, "no overide" does not exist.

fro.reie@gmail.com

We're using Olympian Themes Horme 3 Pro template, and yes, it does change. I've tried to upload a small jpg-file to show, but that doesn't seem to be working.

Besides, if "no override" is the same as default (which it isn't), why would the option be there in the first place?

Studio 42

It's same in all Joomla modules because in all module layout is set using this way :
$layout = $params->get('layout','default');
require(JModuleHelper::getLayoutPath('mod_virtuemart_product',$layout));
And if empty, no layout are found and us set to default
This is the case for 99% of the modules and for all Virtuemart core modules.
SO using empty value, mean loading default layout, because this is the case in Joomla since 10 years or more.

fro.reie@gmail.com

Studio 42, you're obviously trying to convince me that the bug is not a bug, so no point in discussing this any further. It's like talking to a wall.

Studio 42

I think you dont understand.
I dont said it's not a bug, but that the "no override" is only in Virtuemart, because the VM core team do not use Joomla layout, but have done own way to check layouts using VirtueMartModelConfig::getLayoutList
If you have for eg. a layout in the non default template, Virtuemart do not find it, because the  code is :
$q = 'SELECT `template` FROM `#__template_styles` WHERE `client_id` ="0" AND `home`="1" ';

$db = JFactory::getDBO();
$db->setQuery($q);

$tplnames = $db->loadResult();

And only load 1 template, the default.
And add a "no overidde' option.

Check any other modules that is not from VM team.
You get always all templates and never "no overides", because "no overides" is a logical error for  joomla modules.

So yes, its bugged and yes it's limited, but this bug and option should not exist.
You understand better ?