本文整理汇总了PHP中Mage_Catalog_Model_Resource_Product_Collection::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Catalog_Model_Resource_Product_Collection::getTable方法的具体用法?PHP Mage_Catalog_Model_Resource_Product_Collection::getTable怎么用?PHP Mage_Catalog_Model_Resource_Product_Collection::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Catalog_Model_Resource_Product_Collection
的用法示例。
在下文中一共展示了Mage_Catalog_Model_Resource_Product_Collection::getTable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _filterPrice
/**
* Callback method for applying price filter.
* @param Mage_Catalog_Model_Resource_Product_Collection $_collection
* @param Mage_Adminhtml_Block_Widget_Grid_Column $_column
*/
public function _filterPrice($_collection, $_column)
{
$_field = $_column->getFilterIndex() ? $_column->getFilterIndex() : $_column->getIndex();
$_condition = $_column->getFilter()->getCondition();
if (!$_field || !is_array($_condition)) {
return;
}
if (!array_key_exists('type', $_condition) || !is_numeric($_condition['type'])) {
$_collection->addFieldToFilter($_field, $_condition);
} else {
$_storeId = (int) $this->getRequest()->getParam('store', 0);
$_store = Mage::app()->getStore($_storeId);
$_joinCondition = array('`e`.`entity_id` = `at_reservation_price`.`entity_id`', '`at_reservation_price`.`store_id` = ' . $_store->getId(), '`at_reservation_price`.`ptype` = ' . $_condition['type']);
if (array_key_exists('from', $_condition)) {
$_joinCondition[] = '`at_reservation_price`.`price` >= ' . $_condition['from'];
}
if (array_key_exists('to', $_condition)) {
$_joinCondition[] = '`at_reservation_price`.`price` <= ' . $_condition['to'];
}
$_joinCondition[] = '`at_reservation_price`.`date_from` = \'0000-00-00 00:00:00\' OR DATE(`at_reservation_price`.`date_from`) <= DATE(\'' . date('Y-m-d H:i:s', Mage::getModel('core/date')->gmtTimestamp(time())) . '\')';
$_joinCondition[] = '`at_reservation_price`.`date_to` = \'0000-00-00 00:00:00\' OR DATE(`at_reservation_price`.`date_to`) >= DATE(\'' . date('Y-m-d H:i:s', Mage::getModel('core/date')->gmtTimestamp(time())) . '\')';
$_collection->getSelect()->joinInner(array('at_reservation_price' => $_collection->getTable('payperrentals/reservationprices')), '(' . implode(') AND (', $_joinCondition) . ')', array('price_type' => 'at_reservation_price.ptype', 'reservation_price' => 'at_reservation_price.price', 'reservation_number' => 'at_reservation_price.numberof'));
/** TODO Check collection count calculation with group. I think need change join for use distinct */
$_collection->getSelect()->group('e.entity_id');
}
}