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