Copied to clipboard

Flag this post as spam?

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


  • Jeremy 17 posts 37 karma points
    Jun 07, 2011 @ 19:27
    Jeremy
    0

    Problem Implementing ITeaCommerceExtension

    Hi Anders and Rune,

    I've run into another problem that I'm hoping you will be able to help me with. I need to subscribe to the AfterOrderFinalized event, so I can manipulate some user data when they checkout. To do this, I began with the code at the beginning of this page: http://rune.gronkjaer.dk/en-US/2010/11/26/how-to-use-the-tea-commerce-events/.

    I have my extension code in a file called MemberVideoExtension in App_Code, but the Initialize() method is never reached. Am I missing something when it comes to hooking this new class into Tea Commerce?

    Here is my code:

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net.Mail;
    using System.Net.Mime;
    using System.Text;
    using System.Web;
    using System.Xml;
    using System.Xml.XPath;
    using TeaCommerce.Data;
    using TeaCommerce.Data.Extensibility;
    using TeaCommerce.Data.Tools;
    using umbraco.BusinessLogic;
    using umbraco.cms.businesslogic.member;

        public class MemberVideoExtension : ITeaCommerceExtension
        {

            /// <summary>
            /// Initialize wil automatically be run by Tea Commerce on apllication load.
            /// Any events you want to hook into is done here.
            /// </summary>
            public void Initialize()
            {
                //The only custom thing we want to do happens after the order has been finalized
                WebshopEvents.AfterOrderFinalized += WebshopEvents_AfterOrderFinalized;
            }

            /// <summary>
            /// This event is fired when the order has been finalized.
            /// This means that the payment has been registered.
            /// </summary>
            /// <param name="order">The order that has just been finalized</param>
            /// <param name="pci">The Callback information from the payment provider</param>
            void WebshopEvents_AfterOrderFinalized(Order order, TeaCommerce.Data.Payment.CallbackInfo pci)
            {
                //Member.GetCurrentMember().getProperty("video_access").Value = "0";
                //Member.GetCurrentMember().Save();
            }
        }

    Thanks for your time,

    Jeremy

  • Anders Burla 2560 posts 8256 karma points
    Jun 08, 2011 @ 00:06
    Anders Burla
    0

    I think maybe it is because of the App_Code approach. Try create a dll file and paste it into the bin folder and see if that works.

  • Jeremy 17 posts 37 karma points
    Jun 08, 2011 @ 19:59
    Jeremy
    0

    Thanks again Anders, that did the trick.

    Do you know why this happens? It would be much easier to debug my code if I could keep it in the App_Code section of my Umbraco installation, and I've never had a problem with this before.

    Jeremy

  • Anders Burla 2560 posts 8256 karma points
    Jun 08, 2011 @ 23:58
    Anders Burla
    0

    Glad it was the solution. I think it has to do with the way we automatic load classes that implement the ITeaCommerceExtension interface. I will try and write a tweet and see if I can get help to fix it in Tea Commerce

Please Sign in or register to post replies

Write your reply to:

Draft