You can use a macro expression. The field names originate from the DiscountCoupon class (database table COM_DiscountCoupon).
Usage in the invoice template, therefore, would be:
{% DiscountCoupon.DiscountCouponCode #% }
for the coupon code, and in a similar way for getting other fields:
DiscountCouponDisplayName (probably the most informative), DiscountCouponValue, etc...
-zc-
When you receive an error in the general dashboard page in CMS Desk / E-Commerce tab with an unresolved macro like:
{ % if (CurrentUser.UserIsGlobalAdministrator == true) { |(user)administator|(hash)
dbb627f8afabe542848ea24ac4e38c0422295a6e0a7d53d70906f31de185df90 % } { % } |(user)
administrator|(hash)c6f3973b455db4c6c92dfec58da458d04a927c5d11e802e100b2006f54e12329 % }
the problem is usually in an outdated macro signature. This can be caused by a change in the CMSConnectionString. If you have modified the connection string, you will need to update macro signatures in Site manager -> Administration -> System -> Macros -> Update macro signatures. A comprehensive description of the situation can be found there as well.
If the payment gateway assembly is not found by Kentico CMS, your custom payment gateway form will not be loaded.
Following properties of your custom payment gateway are case sensitive, so you need to be sure that you specify them correctly (according to
Developing custom gateways) :
Payment gateway assembly name:
Payment gateway class name:
You also need to ensure that you are using correct dll files with your custom payment gateway dll file. In other words, if you have built your dll file in your development environment and you are delivering the custom payment gateway dll file to your live web site, please copy all of the other Kentico CMS dll files together.
Also please check Kentico CMS Event log (CMS Site Manager -> Administration -> Event log) for possible error messages which might lead you to the cause of this issue.
We support the Website Payments Standard at PayPal. For more information please see "
Website Payment Standard: Overview".
Should you want to hide the “Add to cart” button and you are using a transformation where you are registering the
Shopping Cart Item Selector control, you can just add the following macro-based
Visible property to it:
Visible='<%# IfCompare(ValidationHelper.GetInteger(Eval("SKUAvailableItems"), 0), 0, true, false) %>'
-jh-
If you would like to display a customer’s first name and last name on the invoice, you can go to the
CMS Desk –> E-commerce –> Configuration –> Invoice tab and add the following macros to the template:
{% EcommerceContext.CurrentCustomer.CustomerFirstName #% }
{% EcommerceContext.CurrentCustomer.CustomerLastName #% }
Please remove the spaces before the last brackets, if you copy the strings.
-it-
Kentico CMS provides a new customization model that allows you to modify each available provider very easily. For example, if you need to extend the shopping cart's content table and include a custom field that you have defined in the Site manager -> Development -> System tables -> edit COM_SKU table, all you need to do is to override the
CreateContentTableInternal and
CreateContentRowInternal methods of the
ShoppingCartInfoProvider class.
First, you need to call their base versions and then modify the returned
DataTable (in the
CreateContentTableInternal ) and
DataRow (in the
CreateContentRowInternal) as is demonstrated here:
protected override DataTable CreateContentTableInternal()
{
DataTable dt = base.CreateContentTableInternal();
dt.Columns.Add(new DataColumn("<column name>", typeof(<type>)));
return dt;
}
protected override DataRow CreateContentRowInternal(ShoppingCartItemInfo item, DataTable table)
{
DataRow row = base.CreateContentRowInternal(item, table);
row["<column name>"] = item.SKUObj.GetValue("<SKU field name>");
return row;
}
Then you can, for example, reference the custom field in the transformation, applied to the content table, by doing this:
{% ContentTable.ApplyTransform(String transformationName, String contentBeforeTransformationName, String contentAfterTransformationName) #% }
Links to other resources: E-commerce 6: New customization model, Transformations in macro expressions
-ml-
You may need to display only products with images in a smart search result web part. To achieve this goal you need to follow these steps:
-
In the Site Manager –> Development –> System tables -> select Edit for table Ecommerce – SKU and go to the Search fields tab. Among these fields find SKUImagePath and check boxes Tokenized and Searchable. Do not forget to click on the OK button to confirm this change
-
As always, if some field definition is changed, you need to rebuild the index. Go to the Site Manager – Administration – Smart search and Rebuild the index. You need to make sure that Analyzer for this index is set to Simple.
-
Now you just need to configure the Search condition property in your smart search result web part. Its value should be: +SKUImagePath:getmetafile
Links to other resources: Using the smart search filter
-it-
Here is an example code of how to empty the shopping cart content:
if (ECommerceContext.CurrentShoppingCart != null)
{
ShoppingCartInfoProvider.DeleteShoppingCartInfo(ECommerceContext.CurrentShoppingCart);
ECommerceContext.CurrentShoppingCart = null;
}
The
DeleteShoppingCartInfo method removes all records related to the current shopping cart from the database (COM_ShoppingCart and COM_ShoppingCartSKU tables). By entering the
null value to the
CurrentShoppingCart (ShoppingCartInfo object) property of the
ECommerceContext object, we will ensure that the session and/or cookie information is deleted as well.
-mr-
You can hide the "Skip payment“ button (
ButtonBack control) in the
~\CMSModules\Ecommerce\Controls\ShoppingCart\ShoppingCartPaymentGateway.ascx.cs file by using the following code:
this.ShoppingCartControl.ButtonBack.Visible = false;
-mr-
You can set the
Currency formatting string in the
CMS Desk -> Tools -> E-commerce -> Configuration -> Currencies -> <your currency>. This property uses Standard Numeric Format Strings. In this example, enter following string:
${0:F3}.
See Also:
Standard Numeric Format Strings
You can modify ProductOptionSelector control.
Please find a description how to do so below.
1) Open <your project>\App_Code\CMSModules\Ecommerce\ProductOptionSelector.cs file
2) Find line about 431 - item.Text += " (" + preffix + formattedPrice + ")"; here you can add the number of available items.
3) You can get it using this piece of code:
int items = ValidationHelper.GetInteger(row["SKUAvailableItems"], 0);
Could you please set up the From address in:
CMSDesk -> Tools -> E-commerce -> Configuration -> Store settings -> E-mails -> Send e-commerce e-mails from ?
Then it should work correctly if the SMTP server is configured.
-hg-
First of all, please check if the payment method is enabled in: CMSDesk -> Tools-> E-commerce -> Configuration -> Payment methods -> <edit> -> Enabled: checked
Then the payment method needs to be assigned to appropriate shipping options. Please check if your payment method is enabled in: CMSDesk -> Tools-> E-commerce -> Configuration -> Shipping options -> <edit> -> Payment methods tab
This problem is partially caused by PayPal. PayPal somehow remembers all of the OrderIDs, so in case you performed some test orders and you have deleted them after and tried to create a new order it might have the same OrderID that has been previously marked in PayPal as "paid".
We suggest you to go to the Kentico CMS database -> COM_Order table and check your 'OrderID' column, eventually to increase next OrderID to some value you are sure has never been used before.
Or, it seems that the email you should use in Kentico for the Paypal integration is a seller account you have to create under Paypal and NOT the email for the entire sandbox.
This is a matter of what code is used in appropriate transformation.
You can edit transformation used for wishlist web part, find following line:
<%# EcommerceFunctions.GetFormatedPrice(Eval("SKUPrice"), Eval("SKUDepartmentID"))%>
And replace it by this one:
<%# EcommerceFunctions.GetFormatedPrice(Eval("SKUPrice"), Eval("SKUDepartmentID"), Eval("SKUID"))%>
There are two invoices - in fact they are the same but used separately. One is used only on the site after the purchase is made and the second one is used in the e-mail template. Their locations are following:
1)
CMS Desk -> Tools -> E-commerce -> Configuration tab -> Invoice (
devnet.kentico.com/docs/ecommerceguide/invoice.htm)
2)
Site Manager -> Development -> E-mail templates -> E-commerce - Order notification to customer template
You can apply tax to shipping in
custom CalculateShipping method (please see
Overview and
Using Custom Providers sections in E-commerce guide for more details about how to implement custom provider), that is used every time the shipping value is required, and return shipping including tax from this method. If you want also to display the tax in shopping cart content/tax table you can use
custom EvaluateShoppingCartContent method - you can store calculated tax into
cart.ShoppingCartCustomData hashtable in
CalculateShipping method and then you can acquire it in
EvaluateShoppingCartContent method in order to to display it in tax table.
This happens mostly when you are copying a text from some text editor, like Word. In the transformation which is used to display the product details, the default setting for the description field is set to be HTML enconded:
<td><%# Eval("SKUDescription", true) %></td>
Please change it to:
<td><%# Eval("SKUDescription") %></td>
Text: The subject of the e-mail is a resource string. You can find the key value in the ~\CMSResources\CMS.resx file. In this case it should be "ordernotification.customersubject" and "ordernotification.administratorsubject".
You can change the values for these key directly in the resource file. The "{0}" is a macro and the orderID is displayed instead.
Other way is to add these keys to the Site Manager -> Development -> UI Cultures -> click to edit En culture -> New string. Add the key value and the text you want to have. This will ensure that you will be able to easily translate the subjects in other languages.