本文整理汇总了PHP中Mage_Eav_Model_Entity_Attribute::getCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Attribute::getCollection方法的具体用法?PHP Mage_Eav_Model_Entity_Attribute::getCollection怎么用?PHP Mage_Eav_Model_Entity_Attribute::getCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Eav_Model_Entity_Attribute
的用法示例。
在下文中一共展示了Mage_Eav_Model_Entity_Attribute::getCollection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCollection
/**
* Retrive Vendor attribute collection
*
* @return Mage_Eav_Model_Resource_Entity_Collection
*/
public function getCollection()
{
$collection = parent::getCollection();
$typeId = Mage::getModel('csmarketplace/vendor')->getEntityTypeId();
$collection = $collection->addFieldToFilter('entity_type_id', array('eq' => $typeId));
$labelTableName = Mage::getSingleton('core/resource')->getTableName('eav/attribute_label');
$tableName = Mage::getSingleton('core/resource')->getTableName('csmarketplace/vendor_form');
if ($this->getStoreId()) {
$availableStoreWiseIds = $this->getStoreWiseIds($this->getStoreId());
$collection->getSelect()->join(array('vform' => $tableName), 'main_table.attribute_id=vform.attribute_id', array('is_visible' => 'vform.is_visible', 'sort_order' => 'vform.sort_order', 'store_id' => 'vform.store_id', 'use_in_registration' => 'vform.use_in_registration', 'use_in_left_profile' => 'vform.use_in_left_profile', 'position_in_registration' => 'vform.position_in_registration', 'position_in_left_profile' => 'vform.position_in_left_profile', 'fontawesome_class_for_left_profile' => 'vform.fontawesome_class_for_left_profile'));
$collection->getSelect()->where('(vform.attribute_id IN ("' . $availableStoreWiseIds . '") AND vform.store_id=' . $this->getStoreId() . ') OR (vform.attribute_id NOT IN ("' . $availableStoreWiseIds . '") AND vform.store_id=0)');
$collection->getSelect()->group('vform.attribute_id');
$collection->getSelect()->joinLeft(array('vlabel' => $labelTableName), 'main_table.attribute_id=vlabel.attribute_id && vlabel.store_id=' . $this->getStoreId(), array('store_label' => 'vlabel.value'));
} else {
$collection->getSelect()->join(array('vform' => $tableName), 'main_table.attribute_id=vform.attribute_id && vform.store_id=0', array('is_visible' => 'vform.is_visible', 'sort_order' => 'vform.sort_order', 'store_id' => 'vform.store_id', 'use_in_registration' => 'vform.use_in_registration', 'use_in_left_profile' => 'vform.use_in_left_profile', 'position_in_registration' => 'vform.position_in_registration', 'position_in_left_profile' => 'vform.position_in_left_profile', 'fontawesome_class_for_left_profile' => 'vform.fontawesome_class_for_left_profile'));
$collection->getSelect()->joinLeft(array('vlabel' => $labelTableName), 'main_table.attribute_id=vlabel.attribute_id && vlabel.store_id=0', array('store_label' => 'vlabel.value'));
}
/* $collection->addExpressionFieldToSelect("is_visible","(CASE WHEN `"."vform"."`.`is_visible` IS NULL THEN (SELECT `".$tableName."`.`is_visible` from `".$tableName."` WHERE `".$tableName."`.`store_id`=0 AND `".$tableName."`.`attribute_id`=`vform`.`attribute_id`) ELSE `"."vform"."`.`is_visible` END)", "");
echo $collection->getSelect();die; */
return $collection;
}