2017-02-20 5 views
0

私はカスタムゲートウェイクラスを作成しました。これを管理モジュールに登録する必要があります。Kenticoにカスタムクラスを登録する9

私はCSのファイルに次の行を追加したが、それは、名前空間のエラー

[アセンブリ:RegisterCustomClass( "CustomGateway"、typeof演算(CustomGateway))]スロー

また、管理者で - > modules-> Eを-commerce - > classesタブそれは私がインストールされたモジュールのクラスを追加または削除することはできないと言います。

私のカスタムゲートウェイクラスはどのように登録する必要がありますか?

答えて

0

.csファイルのCMS名前空間にusingステートメントを必ず追加してください。あなたのCustomGatewayクラスがカスタム名前空間にある場合

using CMS; 

さらに、あなたにも、その名前空間のためのusingステートメントを追加する必要があります(のはそれMyCompanyを呼びましょう)。

using CMS; 
using MyCompany; 


「クラス」タブについて - 電子商取引のクラスは、カスタム支払いゲートウェイの登録とは何の関係もありません。 RegisterCustomClass属性で登録している限り、問題ありません。

「ストア設定」アプリケーションで設定を進めることができます。

カスタムペイメントゲートウェイに関する完全なドキュメントはhereです。

0

管理UIのモジュールでカスタム支払いゲートウェイクラスを登録することはできません。モジュールのフォルダに.csファイルを置くことによってのみ行うことができます。これはeaslyあなたのモジュール内のゲートウェイクラスをエクスポートすることができます。

0

これは私が8.2で行った方法です。以下の例は、Eコマースモジュールの例です。試してみよう:

public partial class CMSModuleLoader 
{ 
    #region "Macro methods loader attribute" 

    /// <summary> 
    /// Module registration 
    /// </summary> 
    private class CustomGatewayLoaderAttribute : CMSLoaderAttribute 
    { 
     /// <summary> 
     /// Constructor 
     /// </summary> 
     public CustomGatewayLoaderAttribute() 
     { 
      // Require E-commerce module to load properly 
      RequiredModules = new string[] { ModuleName.ECOMMERCE }; 
     } 


     /// <summary> 
     /// Initializes the module 
     /// </summary> 
     public override void Init() 
     { 
      // This line provides the ability to register the classes via web.config cms.extensibility section from App_Code 
      ClassHelper.OnGetCustomClass += GetCustomClass; 
     } 


     /// <summary> 
     /// Gets the custom class object based on the given class name. This handler is called when the assembly name is App_Code. 
     /// </summary> 
     private static void GetCustomClass(object sender, ClassEventArgs e) 
     { 
      if (e.Object == null) 
      { 
       // Provide your custom classes 
       switch (e.ClassName.ToLower()) 
       { 
        // Define the class CustomGatewayProvider inheriting the CMSPaymentGatewayProvider and you can customize the provider 
        case "customgatewayprovider": 
         e.Object = new CustomGatewayProvider(); 
         break; 
       } 
      } 
     } 
    } 

    #endregion 
} 
関連する問題