Using Variables on the Order Confrimation Page

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
ejclay
Ensign (ENS)
Ensign (ENS)
Posts: 2
Joined: Thu Nov 04, 2010 11:17 am

Using Variables on the Order Confrimation Page

Post by ejclay » Thu Nov 04, 2010 11:25 am

I'm researching the variable capabilities and I'm curious if I'm able to access the variables looping on the order confirmation page to include with some 3rd party aplications.

Can you direct me to the available variables on the order confirmation page? I’m specifically looking for the variables for these items looping on the receipt page:

orderId - It will be the id of the order
email - The is the email of the customer (billing).
firstName - The first name of the customer (billing).
lastName - The last name of the customer (billing).
sku - The the sku of the product.
price - The the price of the product.
itemImageUrl - The the url to the image of the product
postalCode – zip code of the customer
title - This is the name of the product
url - This is the url on the site to link the product to.

I found this in the dev pages:

for feeds:
Available Variables
The variables that are available to you depend on the page being viewed. You will always have access to the ”Store” and ”User” variables. If the scriptlet is part of a page that is viewing a category, you will also have access to the ”Category” variable. The same applies to ”Product”, ”Webpage”, and ”Link”.
A sample of the more commonly accessed properties is given below.
$Store.Name
$Store.StoreUrl
$User.IsAnonymous
$User.Name
$User.PrimaryAddress.FirstName
$User.PrimaryAddress.LastName
$Product.Name
$Product.Price
$Product.Weight
$Category.Name

Any idea is there is a comprehensive list of them? Also anyone had any problems pulling these on the Reciept page, or know where I could place a JS feed with these variables?

Thanks.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Using Variables on the Order Confrimation Page

Post by mazhar » Fri Nov 05, 2010 5:35 am

Actually items with $ sign represents the NVeclocity variables and most of them are complete AbleCommerce objects having a lot of fields. For example you can download the API documentation from following link and then you can investigate different variables to see what are complete fields available on them. For example $store will provide you access on CommerceBuilder.Stores.Store object.
ftp://ftp.ablecommerce.com/evals/Commer ... 7_Help.zip

So You need to check the API documentation for following objects to see what data they can provide you.
$store = CommerceBuilder.Stores.Store
$user = CommerceBuilder.Users.User
$Product = CommerceBuilder.Products.Product
$order = CommerceBuilder.Orders.Order
$Category = CommerceBuilder.Catalog.Category

ejclay
Ensign (ENS)
Ensign (ENS)
Posts: 2
Joined: Thu Nov 04, 2010 11:17 am

Re: Using Variables on the Order Confrimation Page

Post by ejclay » Fri Nov 05, 2010 9:15 am

Mazhar,

Thanks for your help. I suppose those aren't the variables I am looking for then. Unfortunately I cannot open that zip file properly to view it. I can't load the pages of the API doc. Is there an online version? Maybe you can help me gather the variables I am looking for. Specifically I need these items:

orderId - It will be the id of the order
email - The is the email of the customer (billing).
firstName - The first name of the customer (billing).
lastName - The last name of the customer (billing).
sku - The the sku of the product.
price - The the price of the product.
itemImageUrl - The the url to the image of the product
postalCode – zip code of the customer
title - This is the name of the product
url - This is the url on the site to link the product to.

And I will need to be looping them into a JavaScript feed like:
<script type="text/javascript">
Feed.addFeedPurchaseOrder({ orderId:'$myvariable',email:'$myvariable',postalCode: '$myvariable', firstName: '$myvariable', lastName: '$myvariable'});
</script>
<script type="text/javascript">
Feed.addFeedLineItem({ title: '$myvariable', url: '$myvariable',sku:'$myvariable', price:'$myvariable',itemImageUrl:'$myvariable'});
</script>

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Using Variables on the Order Confrimation Page

Post by mazhar » Sat Nov 06, 2010 4:10 am

In order to get this information on receipt page you need to create a custom user control in conlib/custom folder and then use it on receipt page. Finally all your code will be in that custom user control. This code could be something like this

Code: Select all

protected void Page_PreInit(object sender, EventArgs e)
    {
        Order order = OrderDataSource.Load(PageHelper.GetOrderId());

        //ORDER ID
        int orderId = order.OrderId;
        
        //CUSTOMER EMAIL
        string email = order.BillToEmail;
        
        //CUSTOMER FIRST NAME
        string firstName = order.BillToFirstName;
        
        //CUSTOMER LAST NAME
        string lastName = order.BillToLastName;
        
        //CUSTOMER POSTAL CODE
        string postalCode = order.BillToPostalCode;

        foreach (OrderItem orderItem in order.Items)
        {
            if (orderItem.OrderItemType == OrderItemType.Product)
            {
                //PRODUCT SKU
                string sku = orderItem.Sku;
                
                //PRODUCT PRICE
                LSDecimal price = orderItem.Price;
                
                //PRODUCT NAME AS TITLE
                string title = orderItem.Name;
                
                if(orderItem.Product != null)
                {
                    //PRODUCT IMAGE URL
                    string imageUrl = Page.ResolveUrl(orderItem.Product.ImageUrl);
                    
                    //PROUDCT PAGE URL
                    string navigateUrl = Page.ResolveUrl(orderItem.Product.NavigateUrl);
                }
                
            }
        }
    }

Post Reply