AbleCommerce integration
An ecommerce software that’s easy to use, developer friendly & feature rich.
Asp.NET based shopping cart solution
1. Create a widget
Create a text file and rename it to PostAffiliateProWidget.ascx Use any text editor to open it and insert this code into it:
<%@ Control Language="C#" ClassName="PostAffiliateProWidget" %>
<script runat="server">
private Order _Order;
private int _OrderId;
protected void Page_Load(object sender, EventArgs e)
{
_OrderId = PageHelper.GetOrderId();
_Order = OrderDataSource.Load(_OrderId);
string image = "<script id=\"pap_x2s6df8d\" src=\"https://URL_TO_PostAffiliatePro/scripts/trackjs.js\" type=\"text/javascript\">\n </";
image += "script><script type=\"text/javascript\">\n";
LSDecimal i;
i = 1;
foreach (OrderItem item in _Order.Items) {
if (item.OrderItemType == OrderItemType.Product) {
image += "var sale" + i + " = PostAffTracker.createSale();\n sale" + i + ".setTotalCost(" + item.ExtendedPrice + ");\n sale" + i + ".setOrderID(" + _OrderId + "(" + i + ")");\n sale" + i + ".setProductID(" + item.ProductId + ");\n";
i = i + 1;
}
}
image += "\nPostAffTracker.register();\n </";
image += "script>";
PostAffiliateProScriptHolder.Controls.Add(new LiteralControl(image));
}
</script>
<asp:PlaceHolder ID="PostAffiliateProScriptHolder" runat="server">
</asp:PlaceHolder>
Now save the file and upload it to your server files for AbleCommerce – ConLib\Custom.
2. Setup the interface to use the widget
Login to your admin panel of AbleCommerce and navigate to Administration> Website> Content and Layout. Locate RecieptPage and edit it. Then change the code [[ConLib:Custom/ReceiptPage HandleFailedPayments=”true”]]
to this:
[[ConLib:Custom\PostAffiliateProWidget]]
[[ConLib:ReceiptPage]]
Save your changes and now, it is all integrated.