Page 1 of 2

Adding a new feild to Detail Section in Customer Care Tab

Posted: Thu Aug 09, 2012 1:23 pm
by godson2006
Hello,
My name is Stevens Michel and I am currently working at Pep Boys. I am attempting to add a field for total fees in the Order Detail section once the user clicks the customer tab. The total fees field will go right after the field "Order Total Tax". How do i go about making this change?

Thanks
Stevens Michel
Sr. Web Developer
The Pep Boys

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Thu Aug 09, 2012 2:47 pm
by Valdus
Where are you wanting this field at? In the admin or on the front end?

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Thu Aug 09, 2012 3:40 pm
by godson2006
The Admin section.

Steps :
Log into broadleaf.
Click the customer care tab.
Click the details tab.
Scroll down to the order section. And insert field.

Thanks

SM

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Thu Aug 09, 2012 3:43 pm
by Valdus
That is actually quite a task, you have to actually extend the order class if you are looking to implement a feature that already doesn't exist within order. What version of Broadleaf are you running?

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Fri Aug 10, 2012 9:19 am
by godson2006
Actually we already have a class extending the order class. There are few overrides in the subclass and there is a method in there called get total fees. I want to read the return value from that method. What do i have to add to my subclass to have this field appear in broadleaf. Below is an example of a property currently being displayed in broadleaf from my subclass.

@Column (name= "STORE_ID")
@AdminPresenation(group= "Appointment", friendlyName = "Pricing Store ID", order = 3, groupOrder =3)
protected Long pricingStoreId;

Looking at the above does the total fees field have to exist in a database table? What steps do i have to take here. thanks for your help.

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Fri Aug 10, 2012 9:22 am
by Valdus
Yes you have to have the total fees existing in the database with the

@AdminPresentation similar to what you have or it won't display in the admin panel.

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Fri Aug 10, 2012 10:11 am
by godson2006
ok cool. but the value will not be coming from the database it will be coming from the method, is that ok?

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Fri Aug 10, 2012 10:17 am
by Valdus
Well the method will actually put it in the database if when you declare that variable in the extension class you give it

@Column(name="column_name_here")
@AdminPresentation(admin presentation info here)
protected String foo

foo would be stored in the database and that is where it would pull for the admin panel. As far as I know there is no way to have real time updating on the Admin panel.

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Fri Aug 10, 2012 10:34 am
by godson2006
Awesome!! So just a quick recap here.... If i do the below then the value will display in admin


@Table(name = "PBY_BLC_ORDER") // Our own custom table
@Column(name="TOTAL_FEES") // New column I will add
@AdminPresentation(group= "Order", friendlyName = "Order Total Fees", order = 3)
protected Money totalFees

@Override
public Money getTotalFees(){
//Do something...
return fees;
}

3 More Questions to go. :)
1)One thing i notice is that the method getTotalFees() does not have a setter for total fees in my sub class currently. is it needed?
2)The method is returning a money object, what datatype should i use for the column i will create in PBY_BLC_ORDER?
3) Does the order attribute in the AdminPresentation annotation sort the fields on the admin panel?

Thanks so much for this Valdus!! Without your help i would be lost at sea, I am getting close to the beach :).

Re: Adding a new feild to Detail Section in Customer Care Tab

Posted: Fri Aug 10, 2012 10:40 am
by Valdus
To answer your questions
1) Typically it is good form to have a setter if you a getter but as to the necessity I honestly can't say just try it and see
2) Hibernate should take care of putting it in the correct form that will be compatible with your database
3) when you give it the order yes that is where it will put it, you will also want to make sure you include the name of the group that the it will display under in the admin form. The final piece of advice I can give you is take a look at the broadleaf orderImpl class to see how they display the @AdminPresentation setup and make sure that the one you have match.