Developer forum

Forum » Development » Extend OrderOverview in Admin

Extend OrderOverview in Admin

Dmitrij Jazel
Reply

Hi guys,

The customer asked us to extend standard order overview in DW Ecommerce.

Here is what they want:

http://screencast.com/t/WR47nnZwnF

 

1) Website uses allot of promo codes (discount codes) and GiftCards.

Customer would like to have an extra column in the order overview for that. But when you rightclick on the overview table header - you are able to filter by Order default fields, or Custom order fields. But not Discount code or Gift card code, theese columns are not available.

2) Customer would like to have additional controls, in the Ribbon (or in the Order filtering panel) that would work together with Filtering controls, that would be a Dropdown list with all GiftCard codes that where used.

 

Any suggestions, tips and tricks or some usefull links would be much appreciated! :)

 

/Dmitrij


Replies

 
Nicolai Pedersen
Reply

Hi

@1: Discount codes are called "Coupons" in that list, if using English as UI. Giftcard code cannot be added because you have multple giftcards on the same order - so the giftcard codes is in a transaction table instead. I would add a custom field on my order and during checkout add the giftcard code used in that field so i can be displayed in the backend.

@2: That is not possible. You could maybe go for a ribbon bar addin to add new buttons/controls to the ribbon. But it would not work with the filtering. Here is an example: http://devierkoeden.com/articles/extending-the-ribbon-interface-for-ecommerce-orders-with-custom-functionality.aspx

NP

 
Dmitrij Jazel
Reply

Hi Nicolai,

Thank you for your info. I had simmilar ideas regarding #1, but was thinking if there might have been more elegant solution.

No problem, thanks for so far! :)

 

/Dmitrij

 
Dmitrij Jazel
Reply

Hi Nicolai,

Ok, #1 sounds like a really reasonable solution.

But than in that case, What would be the bst way to get Discount code, and GiftCard?

 

My plan is to subscribe to Dynamicweb.Notifications.eCommerce.Cart.CheckoutDoneOrderIsComplet

And than get Order from myArgs.Order?

 

My guess is that Coupon and GiftCards are just "order line of specific type".

But my question would be than how to get that information, and get the actual Discount code and GiftCard code that where used?

 

/Dmitrij

 
Nicolai Pedersen
Reply

@1: Discount codes are called "Coupons" in standard DW - so just add that column. Giftcard you have to create a custom order field and in your checkout flow add all the giftcard codes for the order to that (hidden) field in your template if the user types in any. An order can have multiple giftcard codes on them and is therefore on a related table.

Coupon is a field already on the order.

You can find database information here: http://doc.dynamicweb.com/documentation-9/ecommerce/payment-shipping/discounts-vouchers#sideNavTitle1-4

And here: http://doc.dynamicweb.com/documentation-9/ecommerce/payment-shipping/payment#sideNavTitle1-4

 
Dmitrij Jazel
Reply

Ok, this is what I wanted to hear:

Coupon is a field already on the order.

But in that case why am I not able to see it? http://www.screencast.com/t/NQ08eOfV6

/Dmitrij

 
Nicolai Pedersen
Reply

Because the property is called VoucherCode - the name coupon is a label in DW, maybe should be renamed.

 
Dmitrij Jazel
Reply

Nice! :) Thanks for that! :)

But than another part of my question was, what about GiftCard?

 

When GiftCard code is beying used - it adds an orderline with a discount - so we need to search for discount orderline.

But how do you do that correctly?

F.Eks. on OrderLine I can't call something like ol.IsDiscount?

I could check if(!string.isNullOrEmpty(ol.DiscountID)) 

And if it is NOT Empty - than it is a discount, but is that really the best way?

If you have better suggestions I would love to hear them.

 
Nicolai Pedersen
Reply

You just look for them here:

http://doc.dynamicweb.com/documentation-9/ecommerce/payment-shipping/payment#sideNavTitle1-4

That would be GiftcardTransactions. Look at the data and you will figure it out.

 
Dmitrij Jazel
Reply

Hi NIcolai,

Ok, well strange, but none of the tables you have there contact information I am looking for.

http://www.screencast.com/t/P1Xxbwg8

 

First I thought it was a "GiftCardCode" the one that I need, but appears is it not the one.

When you getting email you get something like nice like "4e7a4faa81c6" or simmilar.

How do I find this?

 

Could I please ask you to include a SQL snippet on how to find it? cause this got quite confusing.

 
Dmitrij Jazel
Reply

And besides you have a method here 

var myArgs = (Dynamicweb.Notifications.eCommerce.Cart.CheckoutDoneOrderIsCompleteArgs)args; 
var order = myArgs.Order;    
if (order.BoughtGiftCards.Any())
{
    foreach (var gf in order.BoughtGiftCards)
    {
        string gfcode = gf.Code;
        //This returns GiftCard code (correct one). When user ORDERS giftcard.
        // Would be great if there could be a method that gets the same giftcard codes when user PAYS with GIFTCARD
    }
}

 

This code is so elegant and simple.

Too bad that there is no simmilar implementation for getting GiftCard numbers that where used for paying in the order.

 
Nicolai Pedersen
Reply

Hi Dmitrij

The giftcard codes are encrypted in the database for security reasons.

If you have an order the giftcards can be found in the orderlines collection where the Orderline.Type is OrderLine.OrderLineType.GiftCard. The orderline has a GiftCardCode property.

BR Nicolai

 
Dimitrij Jazel
Reply

Hi Nocolai,

http://www.screencast.com/t/KQ2ypWZHh8U1 That is the codes I need?

Are you using SHA256 or other type of encryption?

But nevermind that.

 

1) When I used the cart, this is the code (as looks in debugger) that I can see as GIftCardCode http://www.screencast.com/t/ZeTZUYVJ

And that is NOT the code I am after.

 

2) ok I can see that there is a type called: Dynamicweb.eCommerce.Orders.OrderLine.OrderLineType.GiftCard

But it has no "Code" property, how to I exctact GiftCard code out of that particular orderline?

 
Nicolai Pedersen
Reply

eCommerce.GiftCards.Giftcard.getGiftCardsForOrderLine(orderlineid).Code

 
Arker Soe
Arker Soe
Reply

Hi guys,

I am trying to develop the status change function for each individual orderline . I want to use a dropdown list for the status. But I find that there is only way to extend the orderdetail is to use orderEdit Addin. can I use a popup form and collect data form that popup ? I want something like - a popup with the list of orderlines with status dropdown attach to them. when the popup close I want to know the status of the orderlines. like orderline1 is shipped, orderline2 is ready to shipped,orderline 3 is still in processing etc. So, my question again is " can I use a popup form and collect data form that popup in orderEdit Addin code? " 

Arker Soe

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Arker

Each orderline does not have a status - so not sure I understand what you want in that regard.

When creating a RibbonBarAddIn, you can call the AddWindow method in the initialisation and add a PopUpWindow (or more) to the add in. That pop-up window can be triggered and opened from the clicking the button you added. The popup Window has a ContentUrl property that is set to a URL of your choice - usually a custom webform/controller URL. In that page you can do whatever magic that is required.

BR Nicolai

Votes for this answer: 1
 
Arker Soe
Arker Soe
Reply

I will add these lines in the load method

Dialog d=new Dialog();
d.ID = "popup";
base.AddWindow(d);

but then when I click the ribbon bar button, what shall i write in button_Click(){} to show the window I created?

 

You must be logged in to post in the forum