Try our conversational search powered by Generative AI!

Find cart based on meta data

Vote:
 

Hi,

I need to find an cart based on a meta value that is set on one of it's payments, how can I do this? I have done some tests based on code to find purchase orders with there tracking number and got this code,

------------------

int totalHits = 0;
OrderSearchParameters parameters = new OrderSearchParameters();
parameters.SqlMetaWhereClause = String.Format("META.MY_META_NAME = '{0}'", my_meta_value);
var classes = new StringCollection();
classes.Add("OtherPayment");
var searchOptions = new OrderSearchOptions
{
CacheResults = false,
RecordsToRetrieve = 1,
ReturnTotalCount = true,
Classes = classes,
Namespace = "Mediachase.Commerce.Orders"
};
return OrderContext.Current.FindPurchaseOrders(parameters, searchOptions, out totalHits).FirstOrDefault();

 ------------------

but even if I know there is an purchase order with the value set on it's payment (of type OtherPayment) I still don't get a result.

/Viktor

#58293
Apr 18, 2012 10:36
Vote:
 

You can only uses classes that have foreign key refence to ordergroup on this search

#59219
May 24, 2012 20:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.