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.

  • Ole Mansfeld 29 posts 43 karma points
    Jun 29, 2012 @ 11:05
    Ole Mansfeld
    0

    SiteContext.Current.CatalogContext.CurrentCatalogName is null

    Having trouble adding products to my basket.
    I need to provide product catalog when calling AddProduct on the PurchaseOrder

    Should this SiteContext.Current.CatalogContext.CurrentCatalogName set itself or is it up to me as dev to maintain this on each server roundtrip?

    If yes i would appriciate some c# inspiration on how you maintain this var.

    If no what am i missing?

    Thanks in advance
    Ole

  • John Walker 41 posts 136 karma points
    Jun 29, 2012 @ 14:29
    John Walker
    0

    Hello,

    For a site I developed the catalog name was paased on the querystring so when the user posted back the product they wanted to add to their basket I used the following code. Taking the fields form the request:

    var addToBasketResult = UCommerce.Xslt.Library.AddToBasket(catalogName, int.Parse(postedQuantity), postedSku, postedVariant);
    var pipelineResult = UCommerce.Xslt.Library.ExecuteBasketPipeline();
  • Søren Spelling Lund 1797 posts 2786 karma points
    Jul 05, 2012 @ 11:10
    Søren Spelling Lund
    0

    @Ole: If you're working with a single catalog you could override the default catalog context implementation in /umbraco/ucommerce/components.config and hardcode the catalog.

    Alternatively you can bake the catalog name into the rewrite rules, against assuming you just have the one catalog.

    Or you can just maintain the catalog querystring parameter in the URL - uCommerce will handle this for you if you generate catalog URL using the default UrlService.

  • Ole Mansfeld 29 posts 43 karma points
    Jul 05, 2012 @ 20:54
    Ole Mansfeld
    0

    Hello John and Søren

    Thanks for the feedback!

    I will take a look at the UrlService

Please Sign in or register to post replies

Write your reply to:

Draft