Developer forum

Forum » Development » setting UnitPrice on CartCmd=AddMulti

setting UnitPrice on CartCmd=AddMulti

Mikkel Hammer
Mikkel Hammer
Reply

Hi DW,

Is it possible to set a fixed UnitPrice when using CartCmd=AddMulti?
One of our solutions have a feature where the customers can copy/paste from Excel into a textarea with productId and quantity, and then we "transform" the input into a AddMulti call.
We wan't to extend on that feature so if a user has impersonation rights, they should be allowed to set the UnitPrice aswell.

We have a feature to update the UnitPrice on an orderline with the cart command UpdateOrderlines&UnitPriceOrderline, but we we're looking to add the products with the price in a single call.

We tried to just add UnitPrice in the AddMulti call, but it doesn't seem to have an effect.


We can't find anything about setting the price on the docs in the AddMulti section, but we can't see anything about the UpdateOrderlines&UnitPriceOrderline in the UpdateOrderlines section.
So we wanted to hear it if's possible, and if not then add it as a feature request:

Best regards,
Mikkel 


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Mikkel.

They cannot be combined as it is now. It would be possible though to refactor the code to something like cartcmd=command1,command2 but that is a serious change that we will not just do. And it would be rather advanced to use and understand :-).

You might be able to call CartService.UpdateOrderLines() in a notification - after Standard.Page.Loaded has fired and before the rendering takes place. I.e. using Standard.Page.PageTitle (weird, I know). Or use Standard.Page.Loaded and then add the addinsort attribute with a vlue of 10000

A regular cartcmd=addmulti will do a redirect, so you also have to combine it with a redirect=false and then in your notification subscriber do the redirect back.

That is a hack, maybe it works... And now thinking of it, cartcmd=AddMulti,UpdateOrderlines would make it all fail... so the above will probably not work.

Maybe you can chain the commands?

  1. cartcmd=addmulti&redirect={UrlEncode(Default.aspx?ID=123&UpdateOrderlines=xyz&UnitPriceOrderline=123)}
  2. The above would redirect to cartcmd=UpdateOrderlines&.... after the product has been added
  3. Then get back to the page you came from...?

BR Nicolai

Votes for this answer: 1

 

You must be logged in to post in the forum