on 09-12-2018 1:32 PM
Hi Experts I want to know the previous values of the cart model and do necessary logic on it. Is there a way to know abt the same.
Yes there is, try to get history value from ItemModelContext context
for e.g. getting old address value from CustomerModel, you can do like this.
final ItemModelContextImpl context = (ItemModelContextImpl) customerModel.getItemModelContext();
final ModelValueHistory history = context.getValueHistory();
final AddressModel oldPDA = (AddressModel) history.getOriginalValue(customerModel.PDA);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the changes are performed by a business user in the backoffice (or hmc), you could use Saved Values.
But quite frankly, don't use them, they will kill your database.
Another option would be the "Generic Audit" feature (available since 6.6) that snapshots every change to specific item types (configurable)
But again, this generates a lot of entries in you database, especially for such frequently changing items like Carts / CartEntries
Is there any way to implement your requirement / use case using interceptors? or maybe an After Save even? Or, IMHO the best option, add it to the business logic, e.g. CartFacade? This will save you from a lot of headaches in the mid- to long-term.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry I don't understand, wiki link for what? there are already some links to help.hybris.com in my answer
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.