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.

  • TaoistTotty 246 posts 314 karma points
    Mar 26, 2012 @ 17:56
    TaoistTotty
    0

    Price for product using Razor

    I have spent a wasted day trying to workout how to get the price for a product using Razor.

    Anyone have any suggestions?

    The code I have at the moment is:

    @inherits umbraco.MacroEngines.DynamicNodeContext
    @using UCommerce.EntitiesV2
    @{var myCategory = Category.All().Single(x => x.CategoryId == 69);}
    @foreach (var product in Product.GetForCategory(myCategory))
    {
    <h1>
    @product.GetDescription("en-us").DisplayName
    </h1>
    <p>
       @product.GetDescription("en-us").ShortDescription
    </p>
    <img src='@Library.MediaById(product.ThumbnailImageMediaId).umbracoFile' alt='@product.GetDescription("en-us").DisplayName Image'/>
    <p>
      PRICE TO GO HERE
    </p>
    }

    Thanks

    TT

  • Grant Thomas 291 posts 324 karma points
    Mar 26, 2012 @ 18:01
    Grant Thomas
    0

    Did you look at the documentation for uCommerce? (I just Google this, so I don't know it inside out):

    http://www.ucommerce.dk/docs/html/M_UCommerce_EntitiesV2_Product_GetPrice.htm

    That means you should be able to do:

    var price = produce.GetPrice(priceGroup);

    However, how 'PriceGroup' works I have no idea.

    There is a 'PriceGroupPrices' property which exposes a collection of 'PriceGroupPrice' instances, of which has a 'PriceGroup' - which one of those you will want, or if that is the proper way to get the price group is anybody's guess. And if you can figure that out, you shouldn't even need to call 'GetPrice'. No wonder you're having trouble.

    Sorry I can't give you an absolute, working answer, though hopefully this will help move you forward some.

  • TaoistTotty 246 posts 314 karma points
    Mar 26, 2012 @ 18:27
    TaoistTotty
    0

    Grant,

    Thank you for this.

    I have tried this, and the various suggestions for getting priceGroup, all of which are either blank or throw an error.

    Hence the wated day.

    The only reason I am using Razor is I want the single catalog I have to appear on the single shop page, and to to have to select the shop and then the catalog just to see the products, and for the URL not to be hard coded.

    TT 

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Mar 29, 2012 @ 15:07
Please Sign in or register to post replies

Write your reply to:

Draft