Installation and deployment Questions on installation, system configuration and deployment to the live server.
Version 5.x > Installation and deployment > Add Sufffix to invoice View modes: 
User avatar
Member
Member
philip-mosquitodigital.co - 9/15/2010 3:44:31 AM
   
Add Sufffix to invoice
Im kind of new to kentico cms and still trying to get to grips with it. On the invoice templates in the ecommerce module is there a way i can add some text next to the product name if the product name contains 35?

User avatar
Kentico Consulting
Kentico Consulting
kentico_mirekr - 9/15/2010 8:56:56 AM
   
RE:Add Sufffix to invoice
Hi,

You need to use custom macro for this purpose:

http://devnet.kentico.com/docs/devguide/appendix_a___macro_expressions.htm

In code of your custom macro you would need to output similar HTML code which is generated by default ##PRODUCTLIST## macro.

In code of your custom macro (as it is described in the documentation) you can retrieve data from database, format them according your needs and return the formatted string.

"PRODUCTLIST" macro is internally using following method which returns product list table:

string result = CMS.Ecommerce.OrderInfoProvider.GetProductList(ShoppingCartContentTable, CurrencyInfoObj, IsDiscountApplied);

So, in code of your custom macro you can use this method to get the product list table and then modify it according your needs or you can build the table on your own. The DataTable is defined like ECommerceContext.CurrentShoppingCart.ShoppingCartContentTable and CurrencyInfo like ECommerceContext.CurrentShoppingCart.CurrencyInfoObj.IsDiscountApplied is either True or False.

You also need to add following method to your custom macro right before you return the final string:

sender.AllowParameters = false;

Second possible solution on how to modify PRODUCTLIST macro is to to use E-commerce custom handlers (http://devnet.kentico.com/docs/ecommerceguide/using_custom_providers.htm) and modify GetProductList method in CustomOrderInforovider class.

Best regards,
Miroslav Remias.