本文整理汇总了PHP中Varien_Db_Select::getAdapter方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Db_Select::getAdapter方法的具体用法?PHP Varien_Db_Select::getAdapter怎么用?PHP Varien_Db_Select::getAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Db_Select
的用法示例。
在下文中一共展示了Varien_Db_Select::getAdapter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: joinAttribute
/**
* @param Varien_Db_Select $select
* @param string $attributeCode
* @return $this
*/
public function joinAttribute($select, $attributeCode)
{
/* @var $core Mana_Core_Helper_Data */
$core = Mage::helper(strtolower('Mana_Core'));
/* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */
$attribute = $core->collectionFind($this->getAttributes(), 'attribute_code', $attributeCode);
/* @var $db Varien_Db_Adapter_Pdo_Mysql */
$db = $select->getAdapter();
$alias = 'meav_' . $attributeCode;
$storeAlias = 's' . $alias;
$from = $select->getPart(Varien_Db_Select::FROM);
if (!isset($from[$alias])) {
$select->joinLeft(array($alias => $attribute->getBackendTable()), implode(' AND ', array("`{$alias}`.`entity_id` = `e`.`entity_id`", $db->quoteInto("`{$alias}`.`attribute_id` = ?", $attribute->getId()), "`{$alias}`.`store_id` = 0")), null);
$select->joinLeft(array($storeAlias => $attribute->getBackendTable()), implode(' AND ', array("`{$storeAlias}`.`entity_id` = `e`.`entity_id`", $db->quoteInto("`{$storeAlias}`.`attribute_id` = ?", $attribute->getId()), $db->quoteInto("`{$storeAlias}`.`store_id` = ?", Mage::app()->getStore()->getId()))), null);
}
return $this;
}
示例2: joinTaxClass
/**
* Join tax class
* @param Varien_Db_Select $select
* @param int $storeId
* @param string $priceTable
* @return Mage_Tax_Helper_Data
*/
public function joinTaxClass($select, $storeId, $priceTable = 'main_table')
{
$taxClassAttribute = Mage::getModel('eav/entity_attribute')->loadByCode(Mage_Catalog_Model_Product::ENTITY, 'tax_class_id');
$joinConditionD = implode(' AND ', array("tax_class_d.entity_id = {$priceTable}.entity_id", $select->getAdapter()->quoteInto('tax_class_d.attribute_id = ?', (int) $taxClassAttribute->getId()), 'tax_class_d.store_id = 0'));
$joinConditionC = implode(' AND ', array("tax_class_c.entity_id = {$priceTable}.entity_id", $select->getAdapter()->quoteInto('tax_class_c.attribute_id = ?', (int) $taxClassAttribute->getId()), $select->getAdapter()->quoteInto('tax_class_c.store_id = ?', (int) $storeId)));
$select->joinLeft(array('tax_class_d' => $taxClassAttribute->getBackend()->getTable()), $joinConditionD, array())->joinLeft(array('tax_class_c' => $taxClassAttribute->getBackend()->getTable()), $joinConditionC, array());
return $this;
}