When creating a template in a non master style, if you have debug mode enabled and have the $config['development']['default_addon'] variable set to an addon, the template will be incorrectly assigned to the default addon.
In the helper_addon_unit admin template if the $addonOptions is empty it'll place the hidden input with the $addOnSelected variable. In the _getTemplateAddEditResponse there is this code:
Which needs to check for whether it's a master style or not. I took a look at other areas and the style property controller response does a check for that:
So I guess the same thing needs to be done for the template response... I noticed this issue when using the TMS addon, which uses the same code, I guess they will need to update it too...
In the helper_addon_unit admin template if the $addonOptions is empty it'll place the hidden input with the $addOnSelected variable. In the _getTemplateAddEditResponse there is this code:
PHP:
'addOnSelected' => (isset($template['addon_id']) ? $template['addon_id'] : $addOnModel->getDefaultAddOnId()),
Which needs to check for whether it's a master style or not. I took a look at other areas and the style property controller response does a check for that:
PHP:
'addOnSelected' => (isset($definition['addon_id'])
? $definition['addon_id']
: ($definition['definition_style_id'] <= 0 ? $addOnModel->getDefaultAddOnId() : '')
),