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.

  • Steven Sønderskov 30 posts 142 karma points
    Oct 03, 2012 @ 14:15
    Steven Sønderskov
    0

    Sending an order complete mail

    Hi

    Is there anyway to send an email to the customer, when an order has been completed in Umbraco. Atm I am sending a mail when I call CommerceLibrary:Checkout() in my xslt. But I would also like to send an email, when the order has been handled by the merchant.

    I have set up an email profile in Umbraco, and tried to connect it to "ToCompletedOrder.config" like so (but I am not sure I am doing it right, or at the right place):

    <configuration>
    <components>
    <!-- Pipeline Instance -->
    <component id="ToCompletedOrder"
      service="UCommerce.Pipelines.IPipeline`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
      type="UCommerce.Pipelines.OrderProcessing.OrderProcessingPipeline, UCommerce.Pipelines"
      lifestyle="Thread">
    <parameters>
    <tasks>
    <value>${ToCompletedOrder.SendPayedEmail}</value>
    <!-- 
    Payment processing vendors ussually require additional subscription fees for you to be able to access their API.
    Please consult your agreement to see if API access is supported for your particular plan.
    -->
    <!--<value>${ToCompletedOrder.AcquirePaymentTask}</value>-->
    </array>
    </tasks>
    </parameters>
    </component>
    <!-- Pipeline Tasks-->
    <component id="ToCompletedOrder.AcquirePaymentTask"
      service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
      type="UCommerce.Pipelines.OrderProcessing.AcquirePaymentTask, UCommerce.Pipelines"
      lifestyle="Thread" />    
    <component id="ToCompletedOrder.SendPayedEmail"
      service="UCommerce.Pipelines.IPipelineTask`1[[UCommerce.EntitiesV2.PurchaseOrder, UCommerce]], UCommerce"
      type="UCommerce.Pipelines.Common.SendEmailTask, UCommerce.Pipelines"
      lifestyle="Thread">
    <parameters>
    <emailTypeName>OrderPayedEmail</emailTypeName>
    </parameters>
    </component>
    </components>
    </configuration>
                       <array>                             

     

  • Steven Sønderskov 30 posts 142 karma points
    Oct 03, 2012 @ 14:18
    Steven Sønderskov
    0

    I get this error i Umbraco when I try to change the order status (Even though the order changes status)

     

    [InvalidOperationException: No product catalog group supporting the url "http://mywebsitet.com:80/umbraco/ucommerce/orders/changeorderstatus.aspx?id=352&rndo=13" found.]

       UCommerce.Runtime.CatalogContext.FindProductCatalogGroupForDomain() +1061

       UCommerce.Runtime.CatalogContext.get_CurrentCatalogSet() +16

       UCommerce.Pipelines.Common.SendEmailTask.Execute(PurchaseOrder purchaseOrder) +280

       UCommerce.Pipelines.Pipeline`1.Execute(T subject) +178

     

    [PipelineException: Exception occoured while processing pipeline 'UCommerce.Pipelines.OrderProcessing.OrderProcessingPipeline'. See inner exception for details.]

       UCommerce.Pipelines.Pipeline`1.Execute(T subject) +488

       UCommerce.Transactions.OrderService.ChangeOrderStatus(PurchaseOrder purchaseOrder, OrderStatus newOrderStatus, String userName) +196

       UCommerceWeb.Umbraco.UCommerce.Orders.ChangeOrderStatus.SaveOrderStatus() +355

       UCommerceWeb.Umbraco.UCommerce.Orders.ChangeOrderStatus.SaveButton_Clicked(Object sender, EventArgs e) +18

       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118

       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112

       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10

       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13

       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36

       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

     

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 10, 2012 @ 09:10
    Søren Spelling Lund
    0

    Hi Steven,

    The config of your pipeline task is correct as the pipeline is getting called as expected.

    The SendEmail task is trying to find the current product catalog group, which is not available from in the backend unless you're running the admin console on the same domain as the frontend.

    You have a couple of options to fix this:

    1) Have the backend run on the same domain name as the frontend

    2) Override the ICatalogContext to provide the current catalog group name even in a context when the URL is not available.

    I'll log a work item to support this scenario better going forward.

    Sorry about the inconvenience.

  • Steven Sønderskov 30 posts 142 karma points
    Oct 10, 2012 @ 09:36
    Steven Sønderskov
    0

    Hey Søren

    Thanks for you reply. Can you give an example or an idea to how I can override the ICatalogContext?

    /Steven

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 17, 2012 @ 10:32
    Søren Spelling Lund
    0

    Sure thing:

    You can inherit the CatalogContext class and override the CurrentCatalogName, CurrentCatalogGroupName.

    Here's some code:

    class MyCustomCatalogContext : CatalogContext
    {
    public override string CurrentCatalogGroupName
    {
    // Use default if present, or use the first catalog available otherwise
    return base.CurrentCatalogGroupName ?? ProductCatalogGroup.All().First().Name;
    }
    }

    With that done you just have to register the MyCustomCatalogContext in /umbraco/ucommerce/components.config replacing the existing one.

    BTW the fix for this is available in uCommerce 3.0.0.12286 if you don't want to mess around with it.

  • Steven Sønderskov 30 posts 142 karma points
    Oct 17, 2012 @ 11:14
    Steven Sønderskov
    0

    Hi Søren thanks for you reply!

    Im new to .NET, but I would like to try it out for our problem. 

    I'm working in Mono instead of Visual Studio, and I got this code so far:

     

    using System;
    using UCommerce.Runtime;
    using UCommerce.EntitiesV2;
    using System.Linq;

    class MyCustomCatalogContext : CatalogContext
    {
    public override string CurrentCatalogGroupName
    {
    // Use default if present, or use the first catalog available otherwise
    return base.CurrentCatalogGroupName ?? ProductCatalogGroup.All().First().Name;
    }
    }

    But I get a "A get or set accessor expected" for the "return" statement

    Thanks

     

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 17, 2012 @ 12:10
    Søren Spelling Lund
    0

    Sorry. I forgot to include the setter:

    classMyCustomCatalogContext:CatalogContext
    {
     
    publicoverridestringCurrentCatalogGroupName
     
    {
    get {
       
    // Use default if present, or use the first catalog available otherwise
       
    returnbase.CurrentCatalogGroupName??ProductCatalogGroup.All().First().Name;
    }
    set { base.CurrentCatalogGroupName = value; }
     
    }
    }
  • Steven Sønderskov 30 posts 142 karma points
    Oct 17, 2012 @ 12:24
    Steven Sønderskov
    0

    Hi again. Thats great, I was reading up upon get & set properties just now :)

    I do get this error now: "The type 'Ucommerce.Runtime.CatalogContext' does not contain a constructor that takes '0' arguments".
    I can't seem to figure that one out?

  • Steven Sønderskov 30 posts 142 karma points
    Oct 17, 2012 @ 17:05
    Steven Sønderskov
    0

    Hey Søren

    I got no error when building the project, if I do this:

     

    using System;
    using UCommerce.Runtime;
    using UCommerce.EntitiesV2;
    using System.Linq;
    using System.Collections.Generic;
    using System.Web;
    using UCommerce.Content;

    class MyCustomCatalogContext:CatalogContext
    {
    public override string CurrentCatalogGroupName{

    get { return base.CurrentCatalogGroupName ?? ProductCatalogGroup.All().First().Name; }

    set { base.CurrentCatalogGroupName = value; }
    }
    public MyCustomCatalogContext(IContentService contentService) : base(contentService) { }

    }

     

    So after copying the "MyCustomCatalogContext.dll" to the bin folder, I am a little confused on how to set up the components.config file.

    If have tried the following with no luck:

    <component id="MyCustomCatalogContext"

    service="UCommerce.Runtime.ICatalogContext, UCommerce"

    type="UCommerce.Runtime.MyCustomCatalogContext, UCommerce" lifestyle="PerWebRequest"/> 

    I have outcommentet the original registrered catalogcontext, but the only result I have gotten so far is all of the XSLT functions to give an error :)

  • Søren Spelling Lund 1797 posts 2786 karma points
    Oct 24, 2012 @ 11:16
    Søren Spelling Lund
    0

    Steven, thanks for being awesome and posting the solution.

    The gist of it is that you need to have constructor on an inheriting class if the inherited class (super class) defines a constructur with params and no empty constructor.

  • Steven Sønderskov 30 posts 142 karma points
    Oct 29, 2012 @ 13:12
    Steven Sønderskov
    0

    Hi Søren 

    Sorry for my late reply. 

    I am still a little confused about how I set up the components.config file. I have tried the following, but with no luck. 
    I dont know if it is the way I try to implement the changes to the componemts.config file, or if it is because I have an error in my C# code.
    The error I get when I implement it is all of my xslt files fail to execute properly. 

      <component id="MyCustomCatalogContext" service="UCommerce.Runtime.ICatalogContext, UCommerce" type="UCommerce.Runtime.MyCustomCatalogContext, UCommerce" lifestyle="PerWebRequest"/>  

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 02, 2012 @ 09:28
    Søren Spelling Lund
    0

    Hi Steven,

    I have added a fix to uCommerce 3, which fixes this issue. You might want to consider updating to the latest version.

     

  • Steven Sønderskov 30 posts 142 karma points
    Nov 02, 2012 @ 09:30
    Steven Sønderskov
    0

    Hi Søren

    Yeah thats also the solution we are heading at :)

    I can just download and install the new Ucommerce package, and thats it for an update? :)

  • Søren Spelling Lund 1797 posts 2786 karma points
    Nov 02, 2012 @ 10:07
    Søren Spelling Lund
    0

    Pretty much. uCommerce will migrate your version 2 setup. 

    There are some breaking API changes that you may or may not be affected by depending on which APIs you're using. The code update required is trivial though.

    You might want to take a look at Checklist for Updating uCommerce too. It lists all the things you can check to verify the update.

  • Steven Sønderskov 30 posts 142 karma points
    Nov 02, 2012 @ 10:09
    Steven Sønderskov
    0

    Thanks Søren

    It has been great with all your help :)

Please Sign in or register to post replies

Write your reply to:

Draft