Extending OrderItem
Posted: Sun Jan 26, 2014 9:51 am
Hello,
I have scenario where my products have multiple suppliers. Currently I am able to relate products to suppliers and show suppliers in product.html
After user selects supplier on product.html i have to store it on OrderItem.
Steps i have done so far:
1) I have reimplemented addItem method of OrderServiceImpl to include supplier id selected on product.html and provided this supplier id to addItemWorkflow.doActivities
2) Extended DiscreteOrderItem class, added field Supplier
3) Created new New Activity workflow to be executed after AddOrderItemActivity
4) In this activity i perform a lookup to supplier table and retrieve Supplier entitty.
5) Loop over DiscreteOrderItems and cast it to my extended version of DiscreteOrderItem , set supplier and save OrderItem.
I am having class cast error in this step.
java.lang.ClassCastException: org.broadleafcommerce.core.order.domain.DiscreteOrderItemImpl cannot be cast to ...
I am extending DiscreteOrderItem as i have done with Customer.java and Product.java
Any helps would be highly appreciated.
Thansk & Regards,
I have scenario where my products have multiple suppliers. Currently I am able to relate products to suppliers and show suppliers in product.html
After user selects supplier on product.html i have to store it on OrderItem.
Steps i have done so far:
1) I have reimplemented addItem method of OrderServiceImpl to include supplier id selected on product.html and provided this supplier id to addItemWorkflow.doActivities
2) Extended DiscreteOrderItem class, added field Supplier
3) Created new New Activity workflow to be executed after AddOrderItemActivity
4) In this activity i perform a lookup to supplier table and retrieve Supplier entitty.
5) Loop over DiscreteOrderItems and cast it to my extended version of DiscreteOrderItem , set supplier and save OrderItem.
I am having class cast error in this step.
java.lang.ClassCastException: org.broadleafcommerce.core.order.domain.DiscreteOrderItemImpl cannot be cast to ...
I am extending DiscreteOrderItem as i have done with Customer.java and Product.java
Any helps would be highly appreciated.
Thansk & Regards,