c# - ECommerce Add Checkout Step -
i trying add step kentico 9 e-commerce checkout process. went pages > special pages > checkout , added new checkout page. added new web part kentico called entityuse code.
when add step, error:
message: unable cast object of type 'asp.cmsmodules_ecommerce_controls_shoppingcart_shoppingcartnonprofit_ascx' type 'cms.portalcontrols.cmsabstractwebpart'.
here 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> /// button actions /// </summary> public override void buttonbackclickaction() { // save values 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 when on live site if (!shoppingcartcontrol.isinternalorder) { shoppingcartinfoprovider.setshoppingcartinfo(shoppingcart); } return true; } catch (exception ex) { lblerror.visible = true; lblerror.text = ex.message; return false; } } }
it seems not inheriting correct base class. shoppingcartstep
used checkout step in old shopping cart model. need use web part base class. i'd recommend try use cmscheckoutwebpart
instead. can use basic checkout web part blue print. can find them under ~cms\cmswebparts\ecommerce\checkout.
Comments
Post a Comment