IMPORTANT: This version of Sitefinity CMS is out of support and the respective product documentation is no longer maintained and can be outdated. Use the version selector to view a supported product version.
This issue can be caused if there was any problem while upgrading products to use life cycle. Once you are sure that all of the products are upgraded correctly (i.e they are published), run the script below:
private
void
SwitchOrdersToUseLiveVersionOfProducts(SiteInitializer obj)
{
var ordersManager = OrdersManager.GetManager();
var catalogManager = CatalogManager.GetManager();
var orders = ordersManager.GetOrders();
foreach
(var order
in
orders)
try
(var detail
order.Details)
Guid oldProductId = detail.ProductId;
var product = catalogManager.GetProduct(oldProductId);
if
(product !=
null
)
var liveVersionOfProduct = catalogManager.Lifecycle.GetLive(product);
(liveVersionOfProduct !=
detail.ProductId = liveVersionOfProduct.Id;
}
ordersManager.SaveChanges();
catch
(Exception ex)
EcommerceLogger.LogException(ex);
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important