Details
-
Improvement
-
Resolution: Unresolved
-
Medium
-
None
-
2012.5
-
None
Description
Hi, I need to get a best sell list filtered by classes, but don't find a build in solution.
I am not sure if this is the correct way I have done it, but it would be great to get this filter in the kernel in future :]
1. add this parameters to the best_sell_list function into kernel/shop/function_definition.php (line 28)
array( 'name' => 'class_filter_type', 'type' => 'string', 'required' => false, 'default' => false ), array( 'name' => 'class_filter_array', 'type' => 'array', 'required' => false, 'default' => false ),
2. add this to the fetchBestSellList into kernel/shop/ezshopfunctioncollection.php (line 66)
function fetchBestSellList( $topParentNodeID, $limit, $class_filter_type, $class_filter_array, $offset, $start_time, $end_time, $duration, $ascending, $extended )
3. add the class filter condition (line 76)
// class filter
$classCondition = eZContentObjectTreeNode::createClassFilteringSQLString( $class_filter_type, $class_filter_array );
4. add the query data (line 110)
$query="SELECT sum(ezproductcollection_item.item_count) as count,
ezproductcollection_item.contentobject_id
FROM ezcontentobject_tree,
ezproductcollection_item,
ezorder
,ezcontentclass
,ezcontentobject
WHERE ezcontentobject_tree.contentobject_id=ezproductcollection_item.contentobject_id AND
ezorder.productcollection_id=ezproductcollection_item.productcollection_id AND
$classCondition
ezcontentclass.version=0 AND
ezcontentobject_tree.contentobject_id = ezcontentobject.id AND
ezcontentclass.id = ezcontentobject.contentclass_id AND
ezcontentobject_tree.path_string like '$nodePath%'
$sqlCreatedCondition
GROUP BY ezproductcollection_item.contentobject_id
$sqlOrderString";
the extended_attribute_filter would be nice too :]