本文整理汇总了PHP中Varien_Event_Observer::getQueryData方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getQueryData方法的具体用法?PHP Varien_Event_Observer::getQueryData怎么用?PHP Varien_Event_Observer::getQueryData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getQueryData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyProductsPositions
/**
* Append a sort by our custom positions when processing a fulltext search query
*
* @param Varien_Event_Observer $observer The observer
*
* @event smile_elasticsearch_query_assembled
*
* @return Smile_ElasticSearch_Model_Search_Term_Observer self reference
*/
public function applyProductsPositions(Varien_Event_Observer $observer)
{
$data = $observer->getQueryData();
$query = $data->getQuery();
$fullTextQuery = Mage::helper('catalogsearch')->getQuery();
if ($fullTextQuery->getId()) {
$optimizer = Mage::getModel("smile_elasticsearch/search_term_optimizer");
$query = $optimizer->applyCustomProductsPositions($query, $fullTextQuery);
$data->setQuery($query);
}
return $this;
}
示例2: applyProductsPositions
/**
* Append a sort by our custom positions when viewing a virtual category
*
* @param Varien_Event_Observer $observer The observer
*
* @event smile_elasticsearch_query_assembled
*
* @return Smile_VirtualCategories_Model_Observer self reference
*/
public function applyProductsPositions(Varien_Event_Observer $observer)
{
$data = $observer->getQueryData();
$query = $data->getQuery();
$category = Mage::registry("current_category");
if ($category !== null && $category->getId() && $this->_getVirtualRule($category) !== null) {
$optimizer = Mage::getModel("smile_virtualcategories/virtualCategory_product_position");
$query = $optimizer->applyCustomProductsPositions($query, $category);
$data->setQuery($query);
}
return $this;
}