I'm trying to figure out how to display the variant price on the product page. I want to dynamically change the price when selecting a variant from the drop down. I don't have any issues figuring out how to do that with jquery, but what I am having issues with is getting the variant price to show up on the page:
I'm getting an error that ProductCatalog and SiteContext don't exist in the current context. I'm not a backend dev, so I'm sure I'm missing something simple like a including a service..
Can anybody tell me what I'm missing or if there is an easier way to do this now? Since that post is from 2013, there could be a better way.
Okay depending on how you have coded your product page this will give your price.
var priceGroup = SiteContext.Current.CatalogContext.CurrentPriceGroup;
var price = SiteContext.Current.CatalogContext.CurrentProduct.GetPrice(priceGroup);
But for this to work you have to use the UrlRewriting for uCommerce (url structure where p-{sku} is a part of it). But for this to work properly you have to redirect customers to each variant url.
To be more precisely I need to know a little bit more about your thoughts/code. If you want it work as AJAX I recommend you to look at the demo store.
Variant pricing on product page
I'm trying to figure out how to display the variant price on the product page. I want to dynamically change the price when selecting a variant from the drop down. I don't have any issues figuring out how to do that with jquery, but what I am having issues with is getting the variant price to show up on the page:
https://our.umbraco.org/projects/website-utilities/ucommerce/ucommerce-support/39739-Dynamic-Price-update
I tried looking at the post above, but I'm getting stuck at the part where this variable is added to GetProductVariations.cs
I'm getting an error that ProductCatalog and SiteContext don't exist in the current context. I'm not a backend dev, so I'm sure I'm missing something simple like a including a service..
Can anybody tell me what I'm missing or if there is an easier way to do this now? Since that post is from 2013, there could be a better way.
Thank you!
Hi Kelsee,
Are you trying to show variant prices from a webservice or do you use Razor?
Which version of uCommerce are you using? It can affect what is possible in the API :)
best regards Martin
Hi Martin,
I'm using uCommercer version: 6.0.3.14141 with Umbraco version: 7.1.8.
I was trying to use Razor to get the variant price, but if there is an example of the webservice, I would be open to using that as well.
Thank you so much!
Okay depending on how you have coded your product page this will give your price.
But for this to work you have to use the UrlRewriting for uCommerce (url structure where p-{sku} is a part of it). But for this to work properly you have to redirect customers to each variant url.
To be more precisely I need to know a little bit more about your thoughts/code. If you want it work as AJAX I recommend you to look at the demo store.
Best regards Martin
is working on a reply...