本文整理匯總了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;
}