Page 1 of 1

Adding Customer Attribute Tutorial-Compile Error

Posted: Wed Apr 29, 2015 9:45 pm
by Swamy K
Hi Team,

I am exploring "Adding Customer Attribute Tutorial" @ http://www.broadleafcommerce.com/docs/c ... e-tutorial.

I have notice that the below line of code having compilation error.
// Update our customer object
newCustomer.getCustomerAttributes().add(referralCodeAttr);

Issue1 : Seems newCustomer.getCustomerAttributes() return type is Map and Map dont have add() method.
Issue2 : Seems newCustomer.getCustomerAttributes() return type is Map and expecting the KEY,VALUE pair.


Please have look and update the code snippet accordingly.

Thanks in advance.

Re: Adding Customer Attribute Tutorial-Compile Error

Posted: Thu Apr 30, 2015 1:48 am
by phillipuniverse
Yeah looks like this doc is out of date. I opened an issue for it at https://github.com/BroadleafCommerce/docs/issues/59. The corrected code is:

Code: Select all

newCustomer.getCustomerAttributes().put("referralCode", referralCodeAttr);


Thanks for the report.

Re: Adding Customer Attribute Tutorial-Compile Error

Posted: Thu Apr 30, 2015 2:21 am
by Swamy K
Thanks .

newCustomer.getCustomerAttributes().put("referralCode", referralCodeAttr);

Is "referralCode" can be any name or Formbean property?

Re: Adding Customer Attribute Tutorial-Compile Error

Posted: Thu Apr 30, 2015 9:08 am
by phillipuniverse
I don't know what you mean by "Formbean property".

Yes, that string can be anything. However, I would recommend that you make that key the same as the name property on the attribute.

Re: Adding Customer Attribute Tutorial-Compile Error

Posted: Sat May 16, 2015 3:56 am
by Swamy K
Hi Philip,

I am following the demo on http://www.broadleafcommerce.com/docs/c ... c-tutorial . Followed all the steps. But,when I try to register, I am getting the exception
Property or field 'averageHeatRatingBought' cannot be found on object of type 'org.broadleafcommerce.profile.core.domain.CustomerImpl' - maybe not public?

For some reason, it is not identifying the new HCCusomerImpl. It is going to the basic implementation. Can any of you please help me with this?

Already i have posted a query on the below URL.Please help me.
viewtopic.php?f=14&t=2943