本文整理汇总了PHP中Mage_Eav_Model_Entity_Attribute_Abstract::getFlatAddChildData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Attribute_Abstract::getFlatAddChildData方法的具体用法?PHP Mage_Eav_Model_Entity_Attribute_Abstract::getFlatAddChildData怎么用?PHP Mage_Eav_Model_Entity_Attribute_Abstract::getFlatAddChildData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Attribute_Abstract
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Attribute_Abstract::getFlatAddChildData方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFlatUpdateSelect
/**
* Retrieve Select for update Flat data
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @param int $store
* @param bool $hasValueField flag which require option value
* @return Varien_Db_Select
*/
public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store, $hasValueField = true)
{
$attributeTable = $attribute->getBackend()->getTable();
$attributeCode = $attribute->getAttributeCode();
$joinCondition = "`e`.`entity_id`=`t1`.`entity_id`";
if ($attribute->getFlatAddChildData()) {
$joinCondition .= " AND `e`.`child_id`=`t1`.`entity_id`";
}
$valueExpr = new Zend_Db_Expr("IFNULL(t2.value, t1.value)");
$select = $this->_getReadAdapter()->select()->joinLeft(array('t1' => $attributeTable), $joinCondition, array())->joinLeft(array('t2' => $attributeTable), "`t2`.`entity_id`=`t1`.`entity_id`" . " AND `t1`.`entity_type_id`=`t2`.`entity_type_id`" . " AND `t1`.`attribute_id`=`t2`.`attribute_id`" . " AND `t2`.`store_id`={$store}", array($attributeCode => $valueExpr));
if ($attribute->getFrontend()->getInputType() != 'multiselect' && $hasValueField) {
$select->joinLeft(array('to1' => $this->getTable('eav/attribute_option_value')), "`to1`.`option_id`={$valueExpr}" . " AND `to1`.`store_id`='0'", array())->joinLeft(array('to2' => $this->getTable('eav/attribute_option_value')), "`to2`.`option_id`={$valueExpr}" . " AND `to2`.`store_id`='{$store}'", array($attributeCode . '_value' => "IFNULL(`to2`.`value`, `to1`.`value`)"));
}
$select->where('t1.entity_type_id=?', $attribute->getEntityTypeId())->where('t1.attribute_id=?', $attribute->getId())->where('t1.store_id=?', 0);
if ($attribute->getFlatAddChildData()) {
$select->where("e.is_child=?", 0);
}
return $select;
}
示例2: getFlatUpdateSelect
/**
* Retrieve Select for update Flat data
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @param int $store
* @param bool $hasValueField flag which require option value
* @return Varien_Db_Select
*/
public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store, $hasValueField = true)
{
$adapter = $this->_getReadAdapter();
$attributeTable = $attribute->getBackend()->getTable();
$attributeCode = $attribute->getAttributeCode();
$joinConditionTemplate = "%s.entity_id = %s.entity_id" . " AND %s.entity_type_id = " . $attribute->getEntityTypeId() . " AND %s.attribute_id = " . $attribute->getId() . " AND %s.store_id = %d";
$joinCondition = sprintf($joinConditionTemplate, 'e', 't1', 't1', 't1', 't1', Mage_Core_Model_App::ADMIN_STORE_ID);
if ($attribute->getFlatAddChildData()) {
$joinCondition .= ' AND e.child_id = t1.entity_id';
}
$valueExpr = $adapter->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
/** @var $select Varien_Db_Select */
$select = $adapter->select()->joinLeft(array('t1' => $attributeTable), $joinCondition, array())->joinLeft(array('t2' => $attributeTable), sprintf($joinConditionTemplate, 't1', 't2', 't2', 't2', 't2', $store), array($attributeCode => $valueExpr));
if ($attribute->getFrontend()->getInputType() != 'multiselect' && $hasValueField) {
$valueIdExpr = $adapter->getCheckSql('to2.value_id > 0', 'to2.value', 'to1.value');
$select->joinLeft(array('to1' => $this->getTable('eav/attribute_option_value')), "to1.option_id = {$valueExpr} AND to1.store_id = 0", array())->joinLeft(array('to2' => $this->getTable('eav/attribute_option_value')), $adapter->quoteInto("to2.option_id = {$valueExpr} AND to2.store_id = ?", $store), array($attributeCode . '_value' => $valueIdExpr));
}
if ($attribute->getFlatAddChildData()) {
$select->where('e.is_child = 0');
}
return $select;
}
示例3: getFlatUpdateSelect
/**
* Retrieve Select For Flat Attribute update
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @param int $storeId
* @return Varien_Db_Select
*/
public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $storeId)
{
$adapter = $this->_getReadAdapter();
$joinConditionTemplate = "%s.entity_id=%s.entity_id" . " AND %s.entity_type_id = " . $attribute->getEntityTypeId() . " AND %s.attribute_id = " . $attribute->getId() . " AND %s.store_id = %d";
$joinCondition = sprintf($joinConditionTemplate, 'e', 't1', 't1', 't1', 't1', Mage_Core_Model_App::ADMIN_STORE_ID);
if ($attribute->getFlatAddChildData()) {
$joinCondition .= ' AND e.child_id = t1.entity_id';
}
$valueExpr = $adapter->getCheckSql('t2.value_id > 0', 't2.value', 't1.value');
/** @var $select Varien_Db_Select */
$select = $adapter->select()->joinLeft(array('t1' => $attribute->getBackend()->getTable()), $joinCondition, array())->joinLeft(array('t2' => $attribute->getBackend()->getTable()), sprintf($joinConditionTemplate, 't1', 't2', 't2', 't2', 't2', $storeId), array($attribute->getAttributeCode() => $valueExpr));
if ($attribute->getFlatAddChildData()) {
$select->where("e.is_child = ?", 0);
}
return $select;
}
示例4: getFlatUpdateSelect
/**
* Retrieve Select For Flat Attribute update
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @param int $store
* @return Varien_Db_Select
*/
public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store)
{
$joinCondition = "`e`.`entity_id`=`t1`.`entity_id`";
if ($attribute->getFlatAddChildData()) {
$joinCondition .= " AND `e`.`child_id`=`t1`.`entity_id`";
}
$select = $this->_getReadAdapter()->select()->joinLeft(array('t1' => $attribute->getBackend()->getTable()), $joinCondition, array())->joinLeft(array('t2' => $attribute->getBackend()->getTable()), "t2.entity_id = t1.entity_id" . " AND t1.entity_type_id = t2.entity_type_id" . " AND t1.attribute_id = t2.attribute_id" . " AND t2.store_id = {$store}", array($attribute->getAttributeCode() => "IF(t2.value_id>0, t2.value, t1.value)"))->where("t1.entity_type_id=?", $attribute->getEntityTypeId())->where("t1.attribute_id=?", $attribute->getId())->where("t1.store_id=?", 0);
if ($attribute->getFlatAddChildData()) {
$select->where("e.is_child=?", 0);
}
return $select;
}
示例5: getFlatUpdateSelect
/**
* Retrieve Select For Flat Attribute update
*
* @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
* @param int $store
* @return Varien_Db_Select
*/
public function getFlatUpdateSelect(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $store)
{
$joinConditionTemplate = "`e`.`entity_id`=`%s`.`entity_id`" . " AND `%s`.`entity_type_id` = " . $attribute->getEntityTypeId() . " AND `%s`.`attribute_id` = " . $attribute->getId() . " AND `%s`.`store_id` = %d";
$joinCondition = sprintf($joinConditionTemplate, 't1', 't1', 't1', 't1', Mage_Core_Model_App::ADMIN_STORE_ID);
if ($attribute->getFlatAddChildData()) {
$joinCondition .= " AND `e`.`child_id`=`t1`.`entity_id`";
}
$select = $this->_getReadAdapter()->select()->joinLeft(array('t1' => $attribute->getBackend()->getTable()), $joinCondition, array())->joinLeft(array('t2' => $attribute->getBackend()->getTable()), sprintf($joinConditionTemplate, 't2', 't2', 't2', 't2', $store), array($attribute->getAttributeCode() => "IF(t2.value_id>0, t2.value, t1.value)"));
if ($attribute->getFlatAddChildData()) {
$select->where("e.is_child=?", 0);
}
return $select;
}