Stephen2

Sitefinity - add product with varying price

May 12th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.89 KB | None | 0 0
  1. //Price is good, use it!
  2. OrdersManager manager = OrdersManager.GetManager();
  3. CatalogManager cmanager = CatalogManager.GetManager();
  4.  
  5. if (CustomConfig.candleProductId == Guid.Empty) {
  6.     ShowErrorMessage("A system error has occurred, please try again later.");
  7.     return;
  8. }
  9.  
  10. Product product = cmanager.GetProduct(CustomConfig.candleProductId);
  11. if (product == null) {
  12.     ShowErrorMessage("A system error has occurred, please try again later.");
  13.     return;
  14. }
  15.  
  16. int quantity = 1;
  17. product.Price = amount;
  18.  
  19. CartOrder order = DeleteCartForUser(manager);
  20. OptionsDetails optionsDetails = new OptionsDetails();
  21.  
  22. //Add the Carols message
  23. product.Sku = txtMessage.Text;
  24.  
  25. manager.AddToCart(order, product, optionsDetails, quantity);
  26.  
  27. var checkoutPageUrl = SitefinityFunctions.GetPageUrl(WebsilkConfig.SitemapConfig.GetPageId("CheckoutPage"));
  28. HttpContext.Current.Response.Redirect(checkoutPageUrl);
Advertisement
Add Comment
Please, Sign In to add comment