本文整理汇总了PHP中Mage_Core_Model_Mysql4_Collection_Abstract::_initSelect方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Mysql4_Collection_Abstract::_initSelect方法的具体用法?PHP Mage_Core_Model_Mysql4_Collection_Abstract::_initSelect怎么用?PHP Mage_Core_Model_Mysql4_Collection_Abstract::_initSelect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Mysql4_Collection_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Mysql4_Collection_Abstract::_initSelect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initSelect
protected function _initSelect()
{
parent::_initSelect();
$modelCat = Mage::getResourceSingleton('downloads/categories');
$this->getSelect()->joinLeft(array('relation' => $this->getTable('downloads/relation')), 'main_table.file_id = relation.file_id', array('products_count' => 'COUNT(relation.product_id)'))->joinLeft(array('cat' => $modelCat->getMainTable()), 'main_table.category_id = cat.category_id', array('title'))->group('main_table.file_id');
return $this;
}
示例2: _initSelect
public function _initSelect()
{
//die("<PRE>".$this->getSelect()->__toString(). "</PRE>");
parent::_initSelect();
$this->getSelect()->distinct(true)->joinInner(array('product_table' => $this->getTable('catalogrule/rule_product')), 'main_table.rule_id = product_table.rule_id', array())->where('from_time=0 or from_time<=? or to_time=0 or to_time>=?', now())->group('main_table.rule_id');
//die("<PRE>".$this->getSelect()->__toString()."</PRE>");
}
示例3: _initSelect
protected function _initSelect()
{
parent::_initSelect();
// $this->getSelect()->where('main_table.post_type=?', 'post')
// ->where('main_table.post_status=?', 'publish');
return $this;
}
示例4: _initSelect
protected function _initSelect()
{
parent::_initSelect();
$select = $this->getSelect();
$select->join(array('cust' => $this->getTable('loyaltyprogram/customer_entity')), 'referer_id = cust.entity_id');
return $this;
}
示例5: _initSelect
/**
*
*
* (overrides parent method)
*/
public function _initSelect()
{
parent::_initSelect();
// Add a simplified version of the transfer references (1 reference per 1 transfer)
$this->_addTransferReferences($this->_getSingleReferenceSelect());
return $this;
}
示例6: _initSelect
protected function _initSelect()
{
parent::_initSelect();
$this->getSelect()->joinLeft(array('cat' => $this->getIndex()->getProperty('db_table_prefix') . 'categories'), 'cat.id=main_table.catid', array('path'));
// echo $this->getSelect();die();
return $this;
}
示例7: addListRestriction
public function addListRestriction()
{
$statuses = Mage::getStoreConfig('rewardpoints/default/valid_statuses', Mage::app()->getStore()->getId());
$statuses_used = Mage::getStoreConfig('rewardpoints/default/valid_used_statuses', Mage::app()->getStore()->getId());
$status_field = Mage::getStoreConfig('rewardpoints/default/status_used', Mage::app()->getStore()->getId());
$order_states = explode(",", $statuses);
$order_states_used = explode(",", $statuses_used);
parent::_initSelect();
$select = $this->getSelect();
$select->from($this->getTable('rewardpoints/rewardpoints_account'), array(new Zend_Db_Expr('SUM(' . $this->getTable('rewardpoints/rewardpoints_account') . '.points_current) AS all_points_accumulated'), new Zend_Db_Expr('SUM(' . $this->getTable('rewardpoints/rewardpoints_account') . '.points_spent) AS all_points_spent')))->where($this->getTable('rewardpoints/rewardpoints_account') . '.customer_id = e.entity_id');
if (version_compare(Mage::getVersion(), '1.4.0', '>=')) {
/*$select->where(" (".Mage::getModel("rewardpoints/stats")->constructSqlPointsType($this->getTable('rewardpoints/rewardpoints_account'))."
or ".$this->getTable('rewardpoints/rewardpoints_account').".rewardpoints_$status_field in (?)
) ", $order_states);*/
$select->where(" (" . Mage::getModel("rewardpoints/stats")->constructSqlPointsType($this->getTable('rewardpoints/rewardpoints_account')) . "\n or (" . $this->getTable('rewardpoints/rewardpoints_account') . ".rewardpoints_{$status_field} in (?) AND " . $this->getTable('rewardpoints/rewardpoints_account') . ".points_current > 0)\n or (" . $this->getTable('rewardpoints/rewardpoints_account') . ".rewardpoints_{$status_field} in (?) AND " . $this->getTable('rewardpoints/rewardpoints_account') . ".points_spent > 0)\n ) ", $order_states, $order_states_used);
} else {
/*$select->where(" (".Mage::getModel("rewardpoints/stats")->constructSqlPointsType($this->getTable('rewardpoints/rewardpoints_account'))."
or ".$this->getTable('rewardpoints/rewardpoints_account').".rewardpoints_state in ((?)
) ", $order_states);*/
$select->where(" (" . Mage::getModel("rewardpoints/stats")->constructSqlPointsType($this->getTable('rewardpoints/rewardpoints_account')) . "\n or (" . $this->getTable('rewardpoints/rewardpoints_account') . ".rewardpoints_{$status_field} in (?) AND " . $this->getTable('rewardpoints/rewardpoints_account') . ".points_current > 0)\n or (" . $this->getTable('rewardpoints/rewardpoints_account') . ".rewardpoints_{$status_field} in (?) AND " . $this->getTable('rewardpoints/rewardpoints_account') . ".points_spent > 0)\n ) ", $order_states, $order_states_used);
}
//v.2.0.0
if (Mage::getStoreConfig('rewardpoints/default/points_delay', Mage::app()->getStore()->getId())) {
$this->getSelect()->where('( NOW() >= ' . $this->getTable('rewardpoints/rewardpoints_account') . '.date_start OR ' . $this->getTable('rewardpoints/rewardpoints_account') . '.date_start IS NULL)');
}
if (Mage::getStoreConfig('rewardpoints/default/points_duration', Mage::app()->getStore()->getId())) {
$select->where('( ' . $this->getTable('rewardpoints/rewardpoints_account') . '.date_end >= NOW() OR ' . $this->getTable('rewardpoints/rewardpoints_account') . '.date_end IS NULL)');
}
$select->group($this->getTable('rewardpoints/rewardpoints_account') . '.customer_id');
return $this;
}
示例8: _initSelect
protected function _initSelect()
{
$allowedAttributes = explode(',', Mage::getStoreConfig('dc_catalog/attributes/selectedattributes'));
parent::_initSelect();
$this->getSelect()->joinRight(array('aov' => $this->getTable('eav/attribute_option_value')), 'aov.option_id = main_table.attribute_option_id AND aov.store_id = main_table.attribute_value_store_id', array('value_id', 'value', 'store_id', 'option_id'))->join(array('ao' => $this->getTable('eav/attribute_option')), 'ao.option_id = aov.option_id', array())->join(array('a' => $this->getTable('eav/attribute')), 'a.attribute_id = ao.attribute_id', array('attribute_code', 'frontend_label', 'concat(a.attribute_code, ao.option_id, \'store\', aov.store_id) as false_id'))->where('a.attribute_code IN (?)', $allowedAttributes)->where('SUBSTRING(aov.value,1,1) != \'-\'')->order('value');
return $this;
}
示例9: _initSelect
/**
* Initialize select, add country iso3 code and region name
*
* @return void
*/
public function _initSelect()
{
parent::_initSelect();
$this->_select->columns(array('shipping_price' => new Zend_Db_Expr("IF(main_table.markup_type = '1' OR main_table.markup_type = '2', IF(main_table.markup_type = '1',CONCAT(main_table.price, '%'), CONCAT(main_table.price,'+')), CONCAT(main_table.price,'#'))")))->joinLeft(array('country_table' => $this->_countryTable), 'country_table.country_id = main_table.dest_country_id', array('dest_country' => 'iso3_code'))->joinLeft(array('region_table' => $this->_regionTable), 'region_table.region_id = main_table.dest_region_id', array('dest_region' => 'code'));
$this->addOrder('dest_country', self::SORT_ORDER_ASC);
$this->addOrder('dest_region', self::SORT_ORDER_ASC);
$this->addOrder('dest_zip', self::SORT_ORDER_ASC);
}
示例10: _initSelect
/**
* Initialize select, add country iso3 code and region name
*
* @return void
*/
public function _initSelect()
{
parent::_initSelect();
Zitec_TableRates_Model_Mysql4_Tablerate::prepareSelectColumns($this->_select);
$this->_select->joinLeft(array('country_table' => $this->_countryTable), "country_table.country_id = main_table.{$this->_map['dest_country_id']}", array('dest_country' => 'iso2_code'))->joinLeft(array('region_table' => $this->_regionTable), "region_table.region_id = main_table.{$this->_map['dest_region_id']}", array('dest_region' => 'code', 'dest_region_name' => 'default_name'));
$select = (string) $this->_select;
$this->_getHelper()->log($select);
}
示例11: _initSelect
/**
* Initialize select, add country iso3 code and region name
*
* @return void
*/
public function _initSelect()
{
parent::_initSelect();
$this->_select->joinLeft(array('country_table' => $this->_countryTable), 'country_table.country_id = main_table.dest_country_id', array('dest_country' => 'iso3_code'))->joinLeft(array('region_table' => $this->_regionTable), 'region_table.region_id = main_table.dest_region_id', array('dest_region' => 'code'));
$this->addOrder('dest_country', self::SORT_ORDER_ASC);
$this->addOrder('dest_region', self::SORT_ORDER_ASC);
$this->addOrder('dest_zip', self::SORT_ORDER_ASC);
}
示例12: _initSelect
/**
* Ensures that only posts and not pages are returned
* WP stores posts and pages in the same DB table
*
*/
protected function _initSelect()
{
parent::_initSelect();
$this->getSelect()->where("`main_table`.`post_type`=?", $this->_getPostType());
return $this;
}
示例13: _initSelect
protected function _initSelect()
{
parent::_initSelect();
//$attributeId = Mage::getResourceSingleton('outofstocksubscription/info')->getAttributeId();
$this->getSelect()->join(array("cpe" => 'catalog_product_entity'), 'main_table.product_id=cpe.entity_id', array('sku' => 'cpe.sku'));
//$this->getSelect()->join(array("cpev" => 'catalog_product_entity_varchar'), 'cpe.entity_id=cpev.entity_id', array('value'=>'cpev.value'));
//$this->getSelect()->where("cpev.attribute_id=".$attributeId);
//$this->getSelect()->group("con.ticket_id");
//$this->getSelect()->order("con.comment_date DESC");
//exit($this->getSelect());
}
示例14: addListRestriction
public function addListRestriction()
{
$statuses = Mage::getStoreConfig('rewardpoints/default/valid_statuses', Mage::app()->getStore()->getId());
$status_field = Mage::getStoreConfig('rewardpoints/default/status_used', Mage::app()->getStore()->getId());
$order_states = explode(",", $statuses);
parent::_initSelect();
$select = $this->getSelect();
$select->from($this->getTable('rewardpoints/rewardpoints_account'), array(new Zend_Db_Expr('SUM(' . $this->getTable('rewardpoints/rewardpoints_account') . '.points_current) AS all_points_accumulated'), new Zend_Db_Expr('SUM(' . $this->getTable('rewardpoints/rewardpoints_account') . '.points_spent) AS all_points_spent')))->where($this->getTable('rewardpoints/rewardpoints_account') . '.customer_id = e.entity_id');
if (version_compare(Mage::getVersion(), '1.4.0', '>=')) {
$select->where(" (" . $this->getTable('rewardpoints/rewardpoints_account') . ".order_id = '" . Rewardpoints_Model_Stats::TYPE_POINTS_REVIEW . "' or '" . Rewardpoints_Model_Stats::TYPE_POINTS_ADMIN . "' or " . $this->getTable('rewardpoints/rewardpoints_account') . ".order_id = '" . Rewardpoints_Model_Stats::TYPE_POINTS_REGISTRATION . "'\n or " . $this->getTable('rewardpoints/rewardpoints_account') . ".order_id in (SELECT increment_id\n FROM " . $this->getTable('sales/order') . " AS orders\n WHERE orders.{$status_field} IN (?))\n ) ", $order_states);
} else {
$table_sales_order = $this->getTable('sales/order') . '_varchar';
$select->where(" (" . $this->getTable('rewardpoints/rewardpoints_account') . ".order_id = '" . Rewardpoints_Model_Stats::TYPE_POINTS_REVIEW . "' or '" . Rewardpoints_Model_Stats::TYPE_POINTS_ADMIN . "' or " . $this->getTable('rewardpoints/rewardpoints_account') . ".order_id = '" . Rewardpoints_Model_Stats::TYPE_POINTS_REGISTRATION . "'\n or " . $this->getTable('rewardpoints/rewardpoints_account') . ".order_id in (SELECT increment_id\n FROM " . $this->getTable('sales/order') . " AS orders\n WHERE orders.entity_id IN (\n SELECT order_state.entity_id\n FROM " . $table_sales_order . " AS order_state\n WHERE order_state.value <> 'canceled'\n AND order_state.value in (?))\n ) ) ", $order_states);
}
//v.2.0.0
if (Mage::getStoreConfig('rewardpoints/default/points_delay', Mage::app()->getStore()->getId())) {
$this->getSelect()->where('( NOW() >= ' . $this->getTable('rewardpoints/rewardpoints_account') . '.date_start OR ' . $this->getTable('rewardpoints/rewardpoints_account') . '.date_start IS NULL)');
}
if (Mage::getStoreConfig('rewardpoints/default/points_duration', Mage::app()->getStore()->getId())) {
$select->where('( ' . $this->getTable('rewardpoints/rewardpoints_account') . '.date_end >= NOW() OR ' . $this->getTable('rewardpoints/rewardpoints_account') . '.date_end IS NULL)');
}
$select->group($this->getTable('rewardpoints/rewardpoints_account') . '.customer_id');
return $this;
}
示例15: _initSelect
protected function _initSelect()
{
$this->joinFields();
parent::_initSelect();
}
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:5,代码来源:Mirasvit_Helpdesk_Model_Resource_Message_Collection.php