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. |
This is left up to programmer using the widgets.
See patch in https://issues.apache.org/jira/browse/OFBIZ-1392 Chris Lombardi (JIRA) sent the following on 11/9/2007 10:28 AM: > 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); > } > } > } > } > > |
I'm not sure I follow. Widgets are part of the presentation layer. I would
say that the default configuration of each item is business logic and specified elsewhere. Currently, it uses a somewhat random method of the default being the first choice available. Has this just not been an issue for anyone yet? -----Original Message----- From: BJ Freeman [mailto:[hidden email]] Sent: Friday, November 09, 2007 1:49 PM To: [hidden email] Subject: Re: [jira] Created: (OFBIZ-1393) Need a better way to specify the default item configuration This is left up to programmer using the widgets. See patch in https://issues.apache.org/jira/browse/OFBIZ-1392 Chris Lombardi (JIRA) sent the following on 11/9/2007 10:28 AM: > 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 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 = > co.setSelected(true); > } > } > } > } > > |
In reply to this post by Nicolas Malin (Jira)
[ 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chris Lombardi updated OFBIZ-1393: ---------------------------------- Attachment: ofbiz-1393.patch Update to store default product configuration in database. Code reviews are welcome. I have only tested this patch on trunk. > 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 > Attachments: ofbiz-1393.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543277 ] Bilgin Ibryam commented on OFBIZ-1393: -------------------------------------- Hi Cris, This is an improvement (should go only to trunk) and i think testing on trunk should be enough. The patch is fine and working as expected. There is only an extra space in the patch. But i have two design question: 1. Why you decided to add this new field to ProductConfig entity but not to ProductConfigOption as Jacopo sugested ? May be there is a reason that i cannot see ? For me, at first look, this new field belongs to ProductConfigOption or ProductConfigItem. 2. The name of the field you added "defaultConfigItemId" confused me, I thought that it is pointing to a configItemId, but actually this field points to a configOptionId. May be the name (ok, it should be less than 20) should be something like defaultConfOptionId, telling that this is an default option Id. Just my 2 cents. Regards, Bilgin Ibryam > 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 > Attachments: ofbiz-1393.patch > > > 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. |
Agreed that this should not go to release4.0, I just wanted to be clear that
I hadn't tested it on release4.0. 1. The way I did it allows for multiple products using the same set of ProductConfigOptions but allows for different defaults. For example, using the example configurable product pc001, it uses the same ProductConfigOption twice for the first and second HDD. Had I done it the suggested way, the default would have to be the same for both questions, or I would have to recreate the same ProductConfigOptions, but with a different default in the ProductConfigOptions table. productId configItemId description configTypeId defaultConfigItemId PC001 IT0001 1st Hard Disk drive QUESTION OP003 PC001 IT0001 2nd Hard Disk drive QUESTION This shows that the 1st HDD defaults to OP003, but has no default for the 2nd HDD. 2. Oops, good catch. I'll fix that. Thanks for the code review. Chris -----Original Message----- From: Bilgin Ibryam (JIRA) [mailto:[hidden email]] Sent: Saturday, November 17, 2007 5:40 AM To: [hidden email] Subject: [jira] Commented: (OFBIZ-1393) Need a better way to specify the default item configuration [ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plu gin.system.issuetabpanels:comment-tabpanel#action_12543277 ] Bilgin Ibryam commented on OFBIZ-1393: -------------------------------------- Hi Cris, This is an improvement (should go only to trunk) and i think testing on trunk should be enough. The patch is fine and working as expected. There is only an extra space in the patch. But i have two design question: 1. Why you decided to add this new field to ProductConfig entity but not to ProductConfigOption as Jacopo sugested ? May be there is a reason that i cannot see ? For me, at first look, this new field belongs to ProductConfigOption or ProductConfigItem. 2. The name of the field you added "defaultConfigItemId" confused me, I thought that it is pointing to a configItemId, but actually this field points to a configOptionId. May be the name (ok, it should be less than 20) should be something like defaultConfOptionId, telling that this is an default option Id. Just my 2 cents. Regards, Bilgin Ibryam > 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 > Attachments: ofbiz-1393.patch > > > Currently, setDefaultConfig in ProductConfigWrapper assumes the default is 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543294 ] Chris Lombardi commented on OFBIZ-1393: --------------------------------------- (Adding to jira, sorry about the double post. An edit is included below.) Agreed that this should not go to release4.0, I just wanted to be clear that I hadn't tested it on release4.0. 1. The way I did it allows for multiple products using the same set of ProductConfigOptions but allows for different defaults. For example, using the example configurable product pc001, it uses the same ProductConfigOption twice for the first and second HDD. Had I done it the suggested way, the default would have to be the same for both questions, or I would have to recreate the same ProductConfigOptions, but with a different default in the ProductConfigOptions table. productId configItemId description configTypeId defaultConfigItemId PC001 IT0001 1st Hard Disk drive QUESTION OP003 PC001 IT0001 2nd Hard Disk drive QUESTION This shows that the 1st HDD defaults to OP003, but has no default for the 2nd HDD. Edit: Putting the default in the ProductConfigItem (PCI) also causes extra PCI to be created for products that share the same PCI. I just thought that the default configuration of a product is most closely associated to the product itself, instead of the question or the potential answers. 2. Oops, good catch. I'll fix that. Thanks for the code review. Chris > 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 > Attachments: ofbiz-1393.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543304 ] Bilgin Ibryam commented on OFBIZ-1393: -------------------------------------- Now i see the reason and agreed with you. This patch is a good addition, and i will be the first using it. Bilgin > 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 > Attachments: ofbiz-1393.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chris Lombardi updated OFBIZ-1393: ---------------------------------- Attachment: ofbiz-1393-2.patch New patch with fixes suggested by BI. > 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 > Attachments: ofbiz-1393-2.patch, ofbiz-1393.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chris Lombardi updated OFBIZ-1393: ---------------------------------- Attachment: (was: ofbiz-1393.patch) > 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 > Attachments: ofbiz-1393-2.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacopo Cappellato reassigned OFBIZ-1393: ---------------------------------------- Assignee: Jacopo Cappellato > 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 > Assignee: Jacopo Cappellato > Priority: Minor > Attachments: ofbiz-1393-2.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549741 ] Jacques Le Roux commented on OFBIZ-1393: ---------------------------------------- No tested just reviewed, simple and clear : sounds good to me. > 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 > Assignee: Jacopo Cappellato > Priority: Minor > Attachments: ofbiz-1393-2.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549743 ] Jacques Le Roux commented on OFBIZ-1393: ---------------------------------------- I would just change if((defaultConfigOptionId != null) && (defaultConfigOptionId.length() > 1)) for if (UtilValidate.isNotEmpty(defaultConfigOptionId)) and please put space around operators, like in if (defaultConfigOptionId.compareToIgnoreCase(currentConfigOptionId)==0 ){ also a tab in + <field name="defaultConfigOptionId" type="id"></field> should replaced by 4 spaces Else everything looks good ;o) > 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 > Assignee: Jacopo Cappellato > Priority: Minor > Attachments: ofbiz-1393-2.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Chris Lombardi updated OFBIZ-1393: ---------------------------------- Attachment: ofbiz-1393-3.patch Patch including JLR's suggestions. > 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 > Assignee: Jacopo Cappellato > Priority: Minor > Attachments: ofbiz-1393-2.patch, ofbiz-1393-3.patch > > > 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. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-1393?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jacques Le Roux closed OFBIZ-1393. ---------------------------------- Resolution: Fixed Fix Version/s: SVN trunk Assignee: Jacques Le Roux (was: Jacopo Cappellato) Thanks Chris, Your patch is in trunk revision: 603164 > 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 > Assignee: Jacques Le Roux > Priority: Minor > Fix For: SVN trunk > > Attachments: ofbiz-1393-2.patch, ofbiz-1393-3.patch > > > 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. |
Free forum by Nabble | Edit this page |