Page 1 of 1

CustomerState.getCustomer problem

Posted: Wed Jul 03, 2013 4:20 am
by Paulius
Hi, I'm trying to extend Customer entity by adding one more column. I followed the tutorial in your documentation and everything seems to be working for anonymous customers, but when customer signs in my new column remains the same as it was before signing in and cannot be changed.
My controller which is responsible for changeing the column looks like this:

Code: Select all

@RequestMapping(value="/remove/{itemId}", method = RequestMethod.GET)
   public String remove(HttpServletRequest request, Model model, @PathVariable("itemId") String itemId){
      CCustomer customer = (CCustomer) CustomerState.getCustomer();
      customer.removeFromCompare(Long.parseLong(itemId));
       return COMPARE_REDIRECT;
   }

I'm using BLF 3.0.0-GA .

Re: CustomerState.getCustomer problem

Posted: Wed Jul 03, 2013 7:55 am
by Paulius
I solved my problem by changing my controller to

Code: Select all

@RequestMapping(value="/remove/{itemId}", method = RequestMethod.GET)
   public String remove(HttpServletRequest request, Model model, @PathVariable("itemId") String itemId){
      CCustomer customer = (CCustomer) CustomerState.getCustomer();
      customer.removeFromCompare(Long.parseLong(itemId));
      if(!customer.isAnonymous()){
          customer = (CCustomer) customerService.saveCustomer(customer);
          CustomerState.setCustomer(customer);
       }
       return COMPARE_REDIRECT;
   }