Forums / Extensions / eZ Find / Filter by price

Filter by price

Author Message

Martin Jerie

Wednesday 28 July 2010 1:04:02 am

Hi,

I need use search filter with product price:

'filter', array('product/price:[500 TO *]')

.
But eZpublish doesn't allow me to index Price datatype

How can i force eZpublish to index it?

Thanks

Robin Muilwijk

Wednesday 28 July 2010 1:11:31 am

Hi Martin,

Have you read the recently added tutorials, called "Advanced development with eZ Find"? You can find them in the tutorial section http://share.ez.no/tutorials. From what I've shortly read in part 2, is how you can add fields/datatypes. Worth checking I think.

Regards Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Christian Rößler

Wednesday 28 July 2010 2:06:17 am

Hy,

reading the tutorials "Advanced development wirth ezfind" won't help here, because the ezprice datatype is declared as "not searchable" (see your contentclasses, product for example). Thus it will not be indexed by ezfind or any other search-plugin.

Right?

First you need to alter/hack the ezprice datatype, add logic to enable sorting, indexing and perhaps information collection.
Then you might write a ezfind-datatype handler to extract the information (price, vat, ...) and by doing so enabling ezfind to get the price values into its index. Another problem remains: is it possible to search/filter for floats or only for integers?

I wrote an enhancement of the ezfloat-type some months ago, also filed/updated a bugticket but got no response so far.

See here as it might be similar to ezprice: http://share.ez.no/forums/general/ezfloat-datatype-not-searchable

Happy hacking :-)
Christian

Hannover, Germany
eZ-Certified http://auth.ez.no/certification/verify/395613

Peter Keung

Thursday 25 November 2010 5:27:33 pm

The ezprice datatype already seems to store indexable (and sortable) price data in terms of floats. Quick hack is to add isIndexable() function to eZPriceType and have that return true. Less "hellish burning" solution (I reference this issue: http://issues.ez.no/IssueView.php?Id=15982&ProjectId=3&Anchor=Comment265930) is to copy that datatype but with that very minor change, then override eZShopFunctions to add your own datatype to the list of valid price datatypes.

Either way, in ezfind.ini.append.php you'll want to map your price datatype as a float:

[SolrFieldMapSettings]
DatatypeMap[<ezprice|yourcustomdatatype>]=sfloat

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada