SmithCart SDK

SmithCart > Integration

Visual Studio Configuration

In order to use the SmithCart SDK in your project, you need to create a reference in Visual Studio to "SmithBuyNow.dll" located in the \bin folder off the root of your DNN installation.  The SmithBuyNow.dll should already exist in your \bin folder if you have installed SmithCart.
 

Add To Cart

The “AddToShoppingCart” function is used to add items to the cart.  
 
Input parameters:
 
Field Description Type Rqd.
productID
The unique identifier of your SmithCart product.  The productID can be found in the Smith_Products table in SQL Server.
integer
Yes
productName
The name of your SmithCart product.  The productName field can be found in SQL Server Smith_Products table in the “ModelName” field.  Any data passed in this field will be saved with the order.
nvarchar(200)
Yes
quantity
The number of items you would like to add to cart.
decimal(10, 2)
Yes
price
The price of the product.  The price of the product can be passed in two ways:
1.   Using the “UnitCost” field found in the
Smith_Products table in SQL Server.
2.   User Enter Amount – Any price you pass.
decimal(18, 2)
Yes
minPartialAmount
The minimum partial amount the customer is allowed to pay for this product. Pass -1 to indicate no partial amount allowed.
decimal(18, 2)
Yes
weight
The weight of your product.  The weight field can be found in the Smith_Products table in SQL Server.
decimal(12, 2)
Yes
inBundle
If this product belongs to a bundle.
boolean
No
bundleID
The BundleID of the product.   The BundleID field can be found in the Smith_ProductBundle table in SQL Server.
integer
No
smithDiscounts
The type of discount you want to apply to the product.  The following discount types are supported:
·  ProductDiscounts
·   ProductDiscountPercent
·   ProductDiscountByUser
·   CategoryDiscounts
·   PriceClassDiscounts
For no discounts pass an empty string.
string
No
attributeName
The name of your custom attribute.  On successful order the value passed in this field is saved in your SQL Server StoreOrderDetailAttributes table in the “Name” field.  The attributeName field can also be viewed in the SmithCart Manage Orders Screen.
nvarchar(150)
No
attributeValue
The value of your custom attribute.  On successful order the value passed in this field is saved in your SQL Server StoreOrderDetailAttributes table in the “Value” field.  The attributeName field can also be viewed in the SmithCart Manage Orders Screen.
nvarchar(200)
No
buyNowTabModuleID
The tabModuleID of your BuyNow module.  You can get the buyNowTabModuleID by looking in your Smith_Products table.
integer
Yes
 
 
 
Output Parameters:

The “AddToShoppingCart” function returns No Parameters.
 
 
Sample Code (C#):

using Smith.DNN.Modules.BuyNow;
 
SmithCart API SmithCart cart = new SmithCart();
cart.AddToShoppingCart(1, "My Product Name", 1, 25, -1, 12, false, 5, "", "AttendeeID", "25", 105);
 
 
 

List Products

The “ListIProducts” function is used to retrieve a listing of all products by PortalID.
 
Input Parameters:
  • PortalID (integer)
 
Output:
  • Returns an “ICollection” of type IProduct (all fields from Smith_Products table)
 
Sample Code (C#):
 
using Smith.DNN.Modules.BuyNow;
 
var products
= from product in ProductsController.ListIProducts(PortalId)
select product as IProduct;
 
foreach (IProduct product in products)
{
//Get data from object
int pid = product.ProductID;
string sku = product.ProductSKU;
 
//get the rest of the data
//add your code here
}
 
 

Get Customers By Date

Returns a list of all customers by create date.

Input Parameters:
  • DateCreated (datetime)
  • PortalId (integer)
 
Output:
  • Returns an “ICollection” of type ICustomer (all fields from Smith_Customer table)
 
Sample Code (C#):
 
using Smith.DNN.Modules.BuyNow;
 
var customers
= from customer in RegistrationController.GetCustomersByDate(DateCreated, PortalId)
select customer as ICustomer;
 
foreach (ICustomer customer in customers)
{
//Get data from object
int cid = customer.CustomerID;
string FirstName = customer.FirstName;
 
//get the rest of the data
//add your code here
}
 
 
 

Get Store Order Details By Date

Retrieves a listing of all orders and order details by order create date.

Input Parameters:
  • DateCreated (datetime)
  • PortalId (integer)
     
Output:
  • Returns a dataset of all the fields from the Smith_StoreOrders and Smith_StoreOrderDetails tables.
 
Sample Code (C#):
 
using Smith.DNN.Modules.BuyNow;
 
private ProductsController pc = new ProductsController();
 
//get orderDetail records from database
DataSet ds = pc.GetStoreOrderDetailsByDate(OrderDate, PortalId); DataTable objDT = ds.Tables[0];
 
//Start For Loop – Get Product Data foreach (DataRow row in objDT.Rows)
{
string productName = row["ProductName"].ToString();
// Get the rest of your data here
}

 
 
 

List Payment History By Date

Retrieves a listing of all payment history records by create date.

Input Parameters:
  • fromDate (datetime)
  • toDate    (datetime)
  • PortalId (integer)

Output:
  • Returns an “ICollection” of type PaymentHistoryInfo (all fields from the Smith_PayHist table)
 
Sample Code (C#):
 
using Smith.DNN.Modules.BuyNow;
 
var payhists = from payhist in RegistrationController.ListIPaymentHistory(fromDate, toDate, PortalId)
select payHist as PaymentHistoryInfo;
 
foreach (PaymentHistoryInfo payhist in payhists)
{
//Get data from object
int phid = payhist.PayHistID;
string BillingName = payhist.BillingName;
 
//get the rest of the data
//add your code here
}
 
 
 
The methods listed above are just a few of the many public methods available to you in the SmithBuyNow.dll.  To discover all methods, explore the DLL in Visual Studio.