Deliver Awesome UI with the most complete toolboxes for .NET, Web and Mobile development
Automate UI, load and performance testing for web, desktop and mobile
A complete cloud platform for an app or your entire digital business
Detect and predict anomalies by automating machine learning to achieve higher asset uptime and maximized yield
Automate decision processes with a no-code business rules engine
Optimize data integration with high-performance connectivity
Connect to any cloud or on-premises data source using a standard interface
Build engaging multi-channel web and digital experiences with intuitive web content management
Personalize and optimize the customer experience across digital touchpoints
Build, protect and deploy apps across any platform and mobile device
Rapidly develop, manage and deploy business apps, delivered as SaaS in the cloud
I have a section of my website that allows users to pay on their current statements. In order to allow this I have a "Statement" product in the eCommerce module that has its price set to 0 and does not track inventory. When a user checks out I modify the OptionDetails.TotalDeltaPrice to set the price of the statement product to the balance of their current statement. The code I am using I got from the assistance provided on a previous thread: www.sitefinity.com/.../change-product-price-during-checkout-
This code worked great on 6.3 but now I would like to move to 7 and in my testing this method of setting the price no longer works and my product is added to the cart with a cost of 0. Does anyone know how to accomplish this in sf 7?
I did a bunch of digging and managed to track down the root of the problem, but I haven't been able to come up with a solution. When I started looking at some of the changes made in 7.0 i noticed that there is a method in the OrdersManager class called UpdateProductInformationInCartDetails. This method is called by the shopping cart widget and the checkout widget and updates all of the product information for products in the cart. In sitefinity 6.3 it actually updated all of the information except the DeltaPrice, but in 7 a call to a new method UpdateCartDetailDeltaPrice is called which also updates the delta price or sets it to 0 if there are no product variations. So when i use the code i mentioned previously to pass in a custom price for the product this method wipes it out. It feels like this may be a bug fix in 7 and the code I was using previously was actually just exploiting the bug.
This section of my website is absolutely critical and I can not move to a new version of sitefinity if i can not maintain this functionality. So is there an appropriate way in sf 7 to set a custom price on a product when adding it to the cart? I am trying to avoid creating custom shopping cart and checkout widgets to bypass the problem.
I also need to add dynamic price to a "placeholder" ecom product thru code and plan to utilize the default cart and checkout widgets. I will also be creating detail and order custom fields to pass along if any of that logic has changed since 6.2.
This is the reply i got from Telerik
"The problem comes from the fact that in Sitefinity 7.0 was made significant code refactoring making not possible your case.
I have consulted also with our developers from Sitefinity eCommerce who explained that an internal method in OrdersManager (UpdateProductInformationInCartDetails) re-calculates all cart details and total price for the shopping cart. It is called in ShoppingCart widget, ShoppingCartSummary and CheckoutWorker on the first step of the checkout process. In other words the three widgets should be re-written to skip this call and call a custom one.
I am sorry for the inconvenience caused."
I ended up overriding the InitializeControls method in the ShoppingCart and Checkout wedgets. In those methods i called a helper method to extract any custom prices from the deltaprice on all items in the cart then called base.InitializeControls. Then I called a second helper method to reapply all the custom pricing and recalculate the cart total. Everything seems to work great. I also ended up having to modify the layout for the orders list as it was pulling the product price from the eCommerce product instead of the order.
Thanks for sharing that, i have voted for it. That is something I hadn't thought about. I could add an item to my Types of Products for custom pricing then in my overridden widgets only prevent the update of pricing on those product types. That would be cleaner than my current solution which still uses delta pricing and could cause issues if i started using product variations.
Turns out I wasn't registering my Widget correctly in the toolbox.
How would I go about overriding the InitializeControls method on shopping cart etc? I tried inheriting from the Telerik.Sitefinity.Modules.Ecommerce.Orders.Web.UI.ShoppingCart.ShoppingCart class, but then my widget said "not allowed here as it does not extend System.Web.UI.UserControl"
CustomShoppingCart : ShoppingCart