本文整理汇总了PHP中Varien_Db_Adapter_Interface::getCheckSql方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Db_Adapter_Interface::getCheckSql方法的具体用法?PHP Varien_Db_Adapter_Interface::getCheckSql怎么用?PHP Varien_Db_Adapter_Interface::getCheckSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Db_Adapter_Interface
的用法示例。
在下文中一共展示了Varien_Db_Adapter_Interface::getCheckSql方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareGroupWebsite
/**
* Prepare data for group website relation
*/
protected function _prepareGroupWebsite($timestamp)
{
$this->_connection->delete($this->_resource->getTable('catalogrule/rule_group_website'), array());
$select = $this->_connection->select()->distinct(true)->from($this->_resource->getTable('catalogrule/rule_product'), array('rule_id', 'customer_group_id', 'website_id'))->where(new Zend_Db_Expr("{$timestamp} >= from_time"))->where($this->_connection->getCheckSql(new Zend_Db_Expr('to_time = 0'), new Zend_Db_Expr(1), new Zend_Db_Expr("{$timestamp} <= to_time")));
$query = $select->insertFromSelect($this->_resource->getTable('catalogrule/rule_group_website'));
$this->_connection->query($query);
}
示例2: _getAllProducts
/**
* Get select for all products
*
* @param $store
* @return Varien_Db_Select
*/
protected function _getAllProducts(Mage_Core_Model_Store $store)
{
if (!isset($this->_allProductsSelect[$store->getId()])) {
/** @var $eavConfig Mage_Eav_Model_Config */
$eavConfig = $this->_factory->getSingleton('eav/config');
$statusAttributeId = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'status')->getId();
$visibilityAttributeId = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'visibility')->getId();
$select = $this->_connection->select()->from(array('cp' => $this->_getTable('catalog/product')), array())->joinInner(array('cpw' => $this->_getTable('catalog/product_website')), 'cpw.product_id = cp.entity_id', array())->joinInner(array('cpsd' => $this->_getTable(array('catalog/product', 'int'))), 'cpsd.entity_id = cp.entity_id AND cpsd.store_id = 0 AND cpsd.attribute_id = ' . $statusAttributeId, array())->joinLeft(array('cpss' => $this->_getTable(array('catalog/product', 'int'))), 'cpss.entity_id = cp.entity_id AND cpss.attribute_id = cpsd.attribute_id' . ' AND cpss.store_id = ' . $store->getId(), array())->joinInner(array('cpvd' => $this->_getTable(array('catalog/product', 'int'))), 'cpvd.entity_id = cp.entity_id AND cpvd.store_id = 0' . ' AND cpvd.attribute_id = ' . $visibilityAttributeId, array())->joinLeft(array('cpvs' => $this->_getTable(array('catalog/product', 'int'))), 'cpvs.entity_id = cp.entity_id AND cpvs.attribute_id = cpvd.attribute_id ' . 'AND cpvs.store_id = ' . $store->getId(), array())->joinLeft(array('ccp' => $this->_getTable('catalog/category_product')), 'ccp.product_id = cp.entity_id', array())->where('cpw.website_id = ?', $store->getWebsiteId())->where($this->_connection->getIfNullSql('cpss.value', 'cpsd.value') . ' = ?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->where($this->_connection->getIfNullSql('cpvs.value', 'cpvd.value') . ' IN (?)', array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH, Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH))->group('cp.entity_id')->columns(array('category_id' => new Zend_Db_Expr($store->getRootCategoryId()), 'product_id' => 'cp.entity_id', 'position' => new Zend_Db_Expr($this->_connection->getCheckSql('ccp.product_id IS NOT NULL', 'ccp.position', '0')), 'is_parent' => new Zend_Db_Expr($this->_connection->getCheckSql('ccp.product_id IS NOT NULL', '0', '1')), 'store_id' => new Zend_Db_Expr($store->getId()), 'visibility' => new Zend_Db_Expr($this->_connection->getIfNullSql('cpvs.value', 'cpvd.value'))));
$this->_allProductsSelect[$store->getId()] = $select;
}
return $this->_allProductsSelect[$store->getId()];
}
示例3: getDownloadableLinkFinalPriceSelect
/**
* Get downloadable link final price select
*
* @param Varien_Db_Adapter_Interface $write
* @param string $table
*
* @return Zend_Db_Select
*/
public function getDownloadableLinkFinalPriceSelect($write, $table)
{
if ($this->getVersionHelper()->isGe1600()) {
$ifTierPrice = $write->getCheckSql('i.tier_price IS NOT NULL', '(i.tier_price + id.min_price)', 'NULL');
if ($this->getVersionHelper()->isGe1700()) {
$ifGroupPrice = $write->getCheckSql('i.group_price IS NOT NULL', '(i.group_price + id.min_price)', 'NULL');
}
$tierPrice = new Zend_Db_Expr($ifTierPrice);
} else {
$tierPrice = new Zend_Db_Expr('IF(i.tier_price IS NOT NULL, i.tier_price + id.min_price, NULL)');
}
$select = $write->select()->join(array('id' => $table), 'i.entity_id = id.entity_id AND i.customer_group_id = id.customer_group_id' . ' AND i.website_id = id.website_id', array())->columns(array('min_price' => new Zend_Db_Expr('i.min_price + id.min_price'), 'max_price' => new Zend_Db_Expr('i.max_price + id.max_price'), 'tier_price' => $tierPrice));
if ($this->getVersionHelper()->isGe1700()) {
$select->columns(array('group_price' => new Zend_Db_Expr($ifGroupPrice)));
}
return $select;
}