Posts

Showing posts from April, 2013

Unwanted Lucene Search Results in EpiServer Commerce R2

Issue: User was getting unexpected search results for products, e.g. with a search key word ‘Sate’ he was getting same result as for ‘Site’. Although for most of the clients they will happy with these results but this particular client was unhappy with this result due to their business requirements. We do not have any word like ‘Sate’ in our Database or in Index file for Lucene. Clearly it was Fuzzy search that was causing this although in code we have set FuzzySearch = false; Reason: // Perform Lucene search SearchResults results = searchFilterHelper.SearchEntries(criteria) as SearchResults ; In the Mediachase.Commerce.Website, Version=5.2.243.2, SearchFilterHelper's SearchEntries() method, below: public virtual ISearchResults SearchEntries(CatalogEntrySearchCriteria criteria) {  try  {   _Results = Manager.Search(criteria);  }  catch (SystemException)  {   if (HttpContext.Current.IsDebuggingEnabled)    throw;  }  // Perform fuzzy search if nothing

Clone a purchase order and convert into cart

We have a requirement for our client that he can masquerade user and can create a new cart based on some existing Purchase Order(e.g. for damaged/lost orders). Option 1: Get The OrderForm and other objects from PurchaseOrder and assign it to new Cart. It did not work as result was a nasty output. On saving Purchase Order for new cart, OrderForm from Parent was assigned to new cart and parent Purchase order lost its associated OrderForms. Option 2: Clone the Purchase Order and create a cart based on that but it will not work because. (I tested this with EpiServer Commerce R2SP2) Type 'Mediachase.Commerce.Orders. PurchaseOrder ' in Assembly 'Mediachase.Commerce, Version=5.2.628.0, Culture=neutral, PublicKeyToken=6e58b501b34abce3' is not marked as serializable . Solution: We can clone OrderForms and OrderAddresses. Therefore I created a clone copy of OrderForm and order addresses and added that into the Cart. Below piece of code helped me to achieve