[ 
https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541695
 ] 

Jacopo Cappellato commented on OFBIZ-1393:
------------------------------------------

The Data Model Resource Book will not help you to take a decision on this 
subject because 'configurable' items are not covered (maybe too specific for a 
book like that).
I agree with you that this can be improved: even if you have the ability to 
specify the order of the options when you define them in the configuration (in 
the Catalog application) and so you can put the default one at the top of the 
list, I agree that there are situations where you would want to define a 
default option that is not the first of the list.
The best option is probably to add a new field:
ProductConfigOption.isDefault (Y/N)
and then use this flag in the ProductConfigWrapper.



> Need a better way to specify the default item configuration
> -----------------------------------------------------------
>
>                 Key: OFBIZ-1393
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-1393
>             Project: OFBiz
>          Issue Type: Improvement
>          Components: product
>    Affects Versions: SVN trunk, Release Branch 4.0
>            Reporter: Chris Lombardi
>            Priority: Minor
>
> Currently, setDefaultConfig in ProductConfigWrapper assumes the default is 
> the first ProductConfigOption.  I would like to be able to set up different 
> products that shared a set of ProductConfigOptions yet allow for a different 
> default ProductConfigOption.
> I don't yet have an opinion on how I can best implement this and my Data 
> Model Resource Book is in the mail.  Does anyone have any thoughts or 
> preferences?
> Here's how it's currently implemented:
>     public void setDefaultConfig() {
>         resetConfig();
>         for (int i = 0; i < questions.size(); i++) {
>             ConfigItem ci = (ConfigItem)questions.get(i);
>             if (ci.isMandatory()) {
>                 if (ci.getOptions().size() > 0) {
>                     ConfigOption co = (ConfigOption)ci.getOptions().get(0);  
> // default is first option
>                     co.setSelected(true);
>                 }
>             }
>         }
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to