on 2016 Apr 25 8:13 AM
Hi,
I want to delete a product from cnd please help me how can we achieve this?
Thank you. Regards, .M
Request clarification before answering.
Hello ,
If the gift wrapper exists in the cart, and you are able to get it in the order, you could try to create a removalCronJob, which would delete this entry from the cart when you choose, you don't want a gift wrapper.
Here you can find how to create a Cronjob, and Here is a technical guide to it.
If this won't help, tell me if the gift wrapper, which you are adding to the cart is actually a Product, or have you implemented this on another way, and it pretend to be a product?
I hope this will help you,
Best Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sebastian Rulk,
Could you please help me in calling the cronjob from Controller.
I am trying with below code but getting the exception.
" CronJobModel hellocronjob = modelService.create(HelloWorldCronJobModel.class); hellocronjob.setSessionUser(userService.getCurrentUser()); modelService.save(hellocronjob); cronJobService.performCronJob(hellocronjob, true); "
But with this I am unable to run the cronjob. Could you please let me know the code what i coded is correct to start Cronjob . If it is not correct please suggest me the correct code.
Many Thanks. Regards, .M
Hi ,
I tried the approach what you suggested. In CartModel am setting product code and in second parameter am passing the List which contains "0" as Long value. Below is the code snippet,
" CartModel model=cartService.getSessionCart();
model.setCode(order.getProduct().getCode());
List<Long> list1=new ArrayList();
list1.add(new Long(0));
cartService.updateQuantities(model1, list1); "
With this code I am getting the exception, Please help me how to resolve this exception and the approach what I used correct one or not?
Many Thanks. Regards, .M
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sebastian Rulk,
We created cart with few products. We implemented Gift Wrapper functionality for my store and when the end user choose the Gift Wrapper then am adding Gift Wrapper as a product to cart. I implemented this Gift Wrapper functionality at Check out page steps. We implemented this GiftWrapper functionality for Order.
Scenario :
In the first iteration of check out steps if the end user chooses Gift Wrapper, then Gift Wrapper product will get add to cart. And the end user wants to add some more products to cart so he went back to product page and choose some more products. After this the end user will come to check out steps(Second Iteration) and This time the end user is not interested in Gift Wrapper so he will choose "no" option for Gift Wrapper. Now In the first iteration we added Gift Wrapper Product to Cnd we need to delete this product as end user selects no option in second iteration.
I tried this to done by updateQuantities() by passing 0,0 as parameters. Same approach is using to remove the product from cart in cart page. but this method is behaving differently, instead of removing the Gift Wrapper product the other products getting remove.
Now I want to delete the single product from the cart. Could you please help me on this Rulik.
Here I am attaching the screen shot how the Gift Wrapper is implemented in my store.
Thank you. Regards, .Mlink text
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
you can use the updateQuantities method of the CartService to delete items. If you set the quantity to null or a value <1 the item will be removed.
/**
* Updates multiple cart entry quantities at once. Entries that receive a quantity <1 will be removed as well as
* entries that receive NULL as quantity value. Refreshes a given cart instance after that.
*
* Entries with entry numbers that do not occur in the parameter map are not touched.
*
* @param cart
* the cart to update cart entry quantities at
* @param quantities
* the entry specific quantities as map of { entry number -> quantity }
*/
void updateQuantities(CartModel cart, Map<Integer, Long> quantities);
regards Tobias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
19 | |
17 | |
3 | |
2 | |
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.