2016-07-25 15 views
-2

Ich versuche add a step to the Kentico 9 e-Commerce Checkout process. Ich ging zu Seiten> spezielle Seiten> Kasse und ich fügte eine neue Checkout-Seite. Ich habe Kentico einen neuen Webpart namens EntityUse Code hinzugefügt.ECommerce Zur Kasse hinzufügen Schritt

Wenn ich den Schritt hinzufügen, bekomme ich diesen Fehler:

Message: Unable to cast object of type 'ASP.cmsmodules_ecommerce_controls_shoppingcart_shoppingcartnonprofit_ascx' to type 'CMS.PortalControls.CMSAbstractWebPart'.

Hier ist mein Code:

public partial class CMSModules_Ecommerce_Controls_ShoppingCart_ShoppingCartNonProfit : ShoppingCartStep 
{ 
    #region "ViewState Constants" 

    private const string SHIPPING_OPTION_ID = "OrderShippingOptionID"; 
    private const string PAYMENT_OPTION_ID = "OrderPaymenOptionID"; 
    private const string FEDERAL_TAX_ID = "FederalTaxID"; 

    #endregion 


/// <summary> 
/// On page load. 
/// </summary> 
/// <param name="sender">Sender.</param> 
/// <param name="e">Event arguments.</param> 
protected void Page_Load(object sender, EventArgs e) 
{ 
    lblTitle.Text = "Tax Exempt Order?"; 

    var fedTaxId = this.ShoppingCart.ShoppingCartCustomData.GetValue("federaltaxid"); 
    var entityUse = this.ShoppingCart.ShoppingCartCustomData.GetValue("entityusecode"); 
    if (fedTaxId != null) 
    { 
     tbTaxID.Text = fedTaxId.ToString(); 
    } 

    if (entityUse != null) 
    { 
     tbEntityUseCode.Text = entityUse.ToString(); 
    } 
} 

/// <summary> 
/// Back button actions 
/// </summary> 
public override void ButtonBackClickAction() 
{ 
    // Save the values to ShoppingCart ViewState 
    // this.ShoppingCartControl.SetTempValue(SHIPPING_OPTION_ID, this.drpShipping.SelectedValue); 
    //this.ShoppingCartControl.SetTempValue(PAYMENT_OPTION_ID, this.drpPayment.SelectedValue); 

    this.ShoppingCartControl.SetTempValue(FEDERAL_TAX_ID, tbTaxID.Text); 
    base.ButtonBackClickAction(); 
} 


public override bool ProcessStep() 
{ 
    try 
    { 
     this.ShoppingCart.ShoppingCartCustomData.SetValue("federaltaxid", tbTaxID.Text); 
     this.ShoppingCart.ShoppingCartCustomData.SetValue("entityusecode", tbEntityUseCode.Text); 


     // Update changes in database only when on the live site 
     if (!ShoppingCartControl.IsInternalOrder) 
     { 
      ShoppingCartInfoProvider.SetShoppingCartInfo(ShoppingCart); 
     } 
     return true; 
    } 
    catch (Exception ex) 
    { 
     lblError.Visible = true; 
     lblError.Text = ex.Message; 
     return false; 
    } 
} 
} 

Antwort

2

Es scheint, wie Sie nicht die richtige Basisklasse erben werden. ShoppingCartStep wird für einen Checkout-Schritt im alten Warenkorbmodell verwendet. Sie müssen eine Webpart-Basisklasse verwenden. Ich würde empfehlen, stattdessen CMSCheckoutWebPart zu verwenden. Sie können ein grundlegendes Checkout-Webpart als Blue Print verwenden. Sie finden sie unter ~ CMS \ CMSWebParts \ E-Commerce \ Checkout.

+0

Danke! Ich habe diese KB erstellt: http://support.cloudcartconnector.com/hc/en-us/articles/212229983-Kentico-Avalara-Entity-Use-Codes –