本文整理汇总了C#中ShoppingCart.getItems方法的典型用法代码示例。如果您正苦于以下问题:C# ShoppingCart.getItems方法的具体用法?C# ShoppingCart.getItems怎么用?C# ShoppingCart.getItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShoppingCart
的用法示例。
在下文中一共展示了ShoppingCart.getItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getPPPaymentDataString
private string getPPPaymentDataString(ShoppingCart _shc)
{
this.shc = _shc;
StringBuilder paymentData = new StringBuilder();
//Add general PP variables
//Cart Total:
paymentData.Append("cmd=_cart");
paymentData.Append("\nupload=1");
paymentData.Append("\nbusiness=" + ConfigurationManager.AppSettings["PP_MerchantUsername"]);
paymentData.Append("\nreturn=" + PP_returnURL); //return url after payment
paymentData.Append("\ncancel_return=" + PP_cancelReturnURL); //cancel url in case payment is interrupted
//paymentData.Append("\nnotify_url=" + PP_ipnNotifyURL); //link of IPN processing handler
paymentData.Append("\ncert_id=" + ConfigurationManager.AppSettings["PP_CertID"]);
//paymentData.Append("\ninvoice=invoice_1"); //optional - Passthrough variable you can use to identify your invoice number for this purchase.
paymentData.Append("\ncharset=UTF-8");
//Shopping cart Data
paymentData.Append("\ncurrency_code=" + ConfigurationManager.AppSettings["PP_Currency"]);
paymentData.Append("\npaymentaction=sale"); //default is sale (allowed: authorization, order)
paymentData.Append("\nhandling_cart=10"); // Shipping costs of the cart in Currency specified in the request
paymentData.Append("\ntax_cart=" + Math.Round(shc.getTotalNetPrice()*(decimal)0.19,2).ToString()); // overwrites tax for individual items in Currency specified in the request
//paymentData.Append("\ndiscount_amount_cart=0.20") //This variable overrides any individual itemdiscount_amount_x values, if present.
//Prepopulating payer information
paymentData.Append("\naddress_override=1"); //overwrite address in registered at paypal with the one provided at the webshop
paymentData.Append("\naddress1=" + shc.shippingInfo.Address); //address-line 1
paymentData.Append("\naddress2="); //address-line 2
paymentData.Append("\ncity=" + shc.shippingInfo.City); //
paymentData.Append("\ncountry=Nl");
paymentData.Append("\nemail=" + shc.shippingInfo.Email );
paymentData.Append("\nfirst_name=" + shc.shippingInfo.FirstName );
paymentData.Append("\nlast_name=" + shc.shippingInfo.LastName);
paymentData.Append("\nlc=gb"); //language code for displaying the paypal page
//paymentData.Append("\nnight_phone_a=" + shc.shippingInfo.Phone );
//paymentData.Append("\nnight_phone_b=263701066");
//paymentData.Append("\nnight_phone_c=night_phone_c")
// paymentData.Append("\nstate=Gelderland")
paymentData.Append("\nzip=" + shc.shippingInfo.PostCode);
// paymentData.Append("\n=")
int i = 0;
foreach(ShoppingCart.Item item in shc.getItems())
{
i++;
//Shipping --> Added as an item!!!!
paymentData.Append("\nitem_name_" + i.ToString() + "=" + item.EventName); //name of the product
paymentData.Append("\nitem_number_" + i.ToString() + "=" + item.EventId.ToString() ); //product id
paymentData.Append("\nquantity_" + i.ToString() + "=" + item.Quantity ); //nr of ordered pieces per item
paymentData.Append("\namount_" + i.ToString() + "=" + Math.Round(item.EventPrice,2).ToString()); //price per piece
//paymentData.Append("\ntax_1=0.20");
//paymentData.Append("\ndiscount_amount_1=0.20") // = NOT PER INDIVIDUAL ITEM! discount_amount_cart overwrites this if set
//paymentData.Append("\ndiscount_rate_1=20"); // PER INDIVIDUAL ITEM! in %. discount_rate_cart overwrites this if set
//paymentData.Append("\non0_1=color"); //maximum of 7 option field names per item (0-6)
//paymentData.Append("\nos0_1=brown"); // maximum of 7 option selection names per item (0-6). MAX 64 chars
//paymentData.Append("\non1_1=size");
//paymentData.Append("\nos1_1=xxl");
}
////Adding Items
//paymentData.Append("\nitem_name_2=Item_2");
//paymentData.Append("\nitem_number_2=nr_2");
//paymentData.Append("\nquantity_2=2");
//paymentData.Append("\namount_2=2.00");
//paymentData.Append("\ntax_2=0.20");
////paymentData.Append("\ndiscount_amount_2=0.20") //= discount_amount_cart overwrites this if set
//paymentData.Append("\ndiscount_rate_2=10"); // PER INDIVIDUAL ITEM! in %. discount_rate_cart overwrites this if set
return paymentData.ToString();
}