Enhance configurable (AGGREGATED) products

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Enhance configurable (AGGREGATED) products

Bilgin Ibryam

Currently, when an order is created in ofbiz, a production run is generated for every AGGREGATED product (through "createProductionRunFromConfiguration" service) and the product configuration (kept by ProductConfigWrapper) is lost.

So, orders that contains configurable products cannot be edited(canceling, updating, appending items)!
The problem occurs in loadCartFromOrder service called while editing existing orders. The configuration cannot be reproduced from order item, product cannot be configured properly and cannot be added to cart.

My initial idea was to reproduce configuration from the production run. After checking the code, it looks like not possible to me...
Also in createProductionRunFromConfiguration method  is saw this comment:
        if (config == null && configId != null) {
                // TODO: load the configuration
                return ServiceUtil.returnError("Operation not yet implemented");
        }

Probably is needed a new entity to save the configuration before creating the production run and loosing ProductConfigWrapper?
What should contain this new entity? Is there any similar example/pattern in ofbiz?
Do you have any different ideas or suggestions to implement this?

I'd love to get your feedback and implement this in ofbiz.

Thanks,
Bilgin Ibryam
Reply | Threaded
Open this post in threaded view
|

Re: Enhance configurable (AGGREGATED) products

Jacopo Cappellato
Bilgin,

the original plan was to write services to persist/load a
ProductConfigWrapper object from the db. There is already an entity for
this (never used, so chances are that it will need small cleanups):
ProductConfigConfig

The idea was to have one configId for the configuration and many
ProductConfigConfig records for each one of the option selected.

The problem is that there is no way to link a configurationId to
production run (WorkEffort), order (OrderItem), inventory
(InventoryItem) etc...

An alternative solution (not necessarily a substitute for
ProductConfigConfig, but instead a complementary model): when the order
is created, you create a new Product (of a special type and associated
to the original template, e.g. PC001) and add to it a set of
ProductFeatures (as STANDARD features) each one describing a
configuration option... or just one feature directly associated to a
configuration (thru a new field ProductFeature.configurationId -->
ProductConfigConfig)

Then you can write a service to load a ProductConfigWrapper out of this
new product and then you can call the code to create the production run
whenever you want.

Just my 2 cents

Jacopo


Bilgin Ibryam wrote:

>
> Currently, when an order is created in ofbiz, a production run is generated
> for every AGGREGATED product (through "createProductionRunFromConfiguration"
> service) and the product configuration (kept by ProductConfigWrapper) is
> lost.
>
> So, orders that contains configurable products cannot be edited(canceling,
> updating, appending items)!
> The problem occurs in loadCartFromOrder service called while editing
> existing orders. The configuration cannot be reproduced from order item,
> product cannot be configured properly and cannot be added to cart.
>
> My initial idea was to reproduce configuration from the production run.
> After checking the code, it looks like not possible to me...
> Also in createProductionRunFromConfiguration method  is saw this comment:
> if (config == null && configId != null) {
>        // TODO: load the configuration
>        return ServiceUtil.returnError("Operation not yet implemented");
> }
>
> Probably is needed a new entity to save the configuration before creating
> the production run and loosing ProductConfigWrapper?
> What should contain this new entity? Is there any similar example/pattern in
> ofbiz?
> Do you have any different ideas or suggestions to implement this?
>
> I'd love to get your feedback and implement this in ofbiz.
>
> Thanks,
> Bilgin Ibryam

Reply | Threaded
Open this post in threaded view
|

Re: Enhance configurable (AGGREGATED) products

Jacopo Cappellato
In reply to this post by Bilgin Ibryam
Bilgin,

you may find other, rather old, but relevant, information about this
subject if you perform a search on old posts (try with
"ProductConfigConfig")

I know it is not an easy task, but good luck!!!

Jacopo


Bilgin Ibryam wrote:

>
> Currently, when an order is created in ofbiz, a production run is generated
> for every AGGREGATED product (through "createProductionRunFromConfiguration"
> service) and the product configuration (kept by ProductConfigWrapper) is
> lost.
>
> So, orders that contains configurable products cannot be edited(canceling,
> updating, appending items)!
> The problem occurs in loadCartFromOrder service called while editing
> existing orders. The configuration cannot be reproduced from order item,
> product cannot be configured properly and cannot be added to cart.
>
> My initial idea was to reproduce configuration from the production run.
> After checking the code, it looks like not possible to me...
> Also in createProductionRunFromConfiguration method  is saw this comment:
> if (config == null && configId != null) {
>        // TODO: load the configuration
>        return ServiceUtil.returnError("Operation not yet implemented");
> }
>
> Probably is needed a new entity to save the configuration before creating
> the production run and loosing ProductConfigWrapper?
> What should contain this new entity? Is there any similar example/pattern in
> ofbiz?
> Do you have any different ideas or suggestions to implement this?
>
> I'd love to get your feedback and implement this in ofbiz.
>
> Thanks,
> Bilgin Ibryam

Reply | Threaded
Open this post in threaded view
|

Re: Enhance configurable (AGGREGATED) products

Bilgin Ibryam
Jacopo, Thank You for answering/helping me .

I searched the old ML and found your posts. Here a short combined snipped:

"the best way to go is to probably implement the part of the configurable
stuff that was originally planned but then never completed: add support
for storing the configurations

The original idea, if I'm not wrong was this:

a) add a "store" method to the ProductConfigWrapper (or Worker) to store
the configuration in the ProductConfigConfig entity (by assigning a new
configId)

b) add a new constructor to the ProductConfigWrapper to load a wrapper
from a stored configId

Then the config id could be added to the quote (but we should discuss a
bit more about this, I guess, because is a pretty major change),
request, order items etc...
Or (probably better) we could use the configId to create a new special
type of variant product (something like "variant configuration",
associated to the configurable product template and to the given
configId) and then use the new productId in quotes, requests, order
items etc..."

I created an jira issue(OFBIZ-1453) and attached the first draft for a) and b)
It works as expected, but reviews, tests and comments are greatly appreciated.

Now i like to know where to add the configId field.
I think that we should add it to OrderItem, CustRequestItem, QuoteItem, ShoppingListItem.
Then we can easily get it (together with productId) and configure product, before adding to cart.

May be the other solution you propose is better, but it looks to me a bit tricky/more_complicated way, thats why i donot like it. (i will give one more try to understand it).

Any opinions where to save this configId for configurable products?
Would interested commiters comment on this also.
What could be the accepted way for ofbiz ?

Bilgin