Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Kelsee Ishmael 71 posts 158 karma points
    Mar 27, 2015 @ 01:00
    Kelsee Ishmael
    0

    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

    PriceGroup priceGroup = ProductCatalog.All().Single(x => x.Name == SiteContext.Current.CatalogContext.CurrentCatalog.Name).PriceGroup;
    

    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!

  • Martin 181 posts 740 karma points
    Mar 29, 2015 @ 17:01
    Martin
    0

    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

  • Kelsee Ishmael 71 posts 158 karma points
    Mar 29, 2015 @ 17:16
    Kelsee Ishmael
    0

    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!

  • Martin 181 posts 740 karma points
    Mar 29, 2015 @ 18:53
    Martin
    0

    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.

    Best regards Martin

Please Sign in or register to post replies

Write your reply to:

Draft