Developer forum

Forum » CMS - Standard features » Search (Weighted) | Date values

Search (Weighted) | Date values

Bjarne Rosendal
Reply

Hi there
 

I am trying to use the search (weighted) module to find products that have a given value in a custom field of the date type.
 

I those "Search in": eCommerce and under Settings - Product Catalog (eCom) I chose the custom field.
 

My question now is - what do I have to pass in the querystring to get products that match a given month?

I have tried q=09+2013 for september 2013, but this does not give me any results...
 

Alternativelly, if anyone knows how to do this in eCommerce search filter, please let me know.
 

Best regards

 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Bjarne

 

Search weighted does a like search, which in turn gives you something like this on the date field:

WHERE ProductUpdated LIKE '%09 2010%'

 

So to get it to Work, you need to find the format of the string representation of your data. That depends on collation etc.

You can see that by doing like this in the sql firehose:

 

SELECT TOP 10 [ProductID]
      ,[ProductName]
      ,[ProductCreated]
      ,[ProductUpdated]
      ,CONVERT(nvarchar(200),[ProductUpdated]) as TheStringFormatOfTheDate

 

In my database it ends up like this:

Dec 15 2010  4:07PM

 

So in my database it would have to be "%dec%2010%" that I have to use as the search parameter (without the quotes).

 

Hope this helps...

 

BR Nicolai.

 

You must be logged in to post in the forum