本文整理汇总了PHP中Mage_Core_Model_Abstract::getCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getCollection方法的具体用法?PHP Mage_Core_Model_Abstract::getCollection怎么用?PHP Mage_Core_Model_Abstract::getCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getCollection方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCollection
public function getCollection()
{
$collection = parent::getCollection();
// adiciona os campos de nome dos enderecos de entrega e fatura
$collection->getSelect()->joinLeft(array('order_table' => $collection->getTable('sales/order')), "(main_table.order_id = order_table.entity_id)", array("order_table.increment_id", "order_table.grand_total"), null);
return $collection;
}
示例2: getChildren
public function getChildren(Mage_Core_Model_Abstract $object)
{
/** @var Magpleasure_Common_Model_Resource_Treeview_Collection_Abstract $collection */
$collection = $object->getCollection();
$collection->addFieldToFilter($this->getParentIdField(), $object->getData($this->getParentIdField()))->setOrder($this->getPositionField(), 'ASC');
return $collection;
}
示例3: _checkUniqueFields
protected function _checkUniqueFields(Mage_Core_Model_Abstract $objectToSave)
{
$collection = $objectToSave->getCollection()->addFieldToFilter('direction', $objectToSave->getDirection());
foreach ($collection as $item) {
if ($item->getId() == $objectToSave->getId()) {
continue;
}
$this->_afterLoad($item);
$customerGroupUniqueFlag = true;
foreach ($objectToSave->getData('customer_group_ids') as $objectToSaveCustomerGroupId) {
if (in_array($objectToSaveCustomerGroupId, $item->getData('customer_group_ids'))) {
$customerGroupUniqueFlag = false;
break;
}
}
$websiteUniqueFlag = true;
foreach ($objectToSave->getData('website_ids') as $objectToSaveWebsiteId) {
if (in_array($objectToSaveWebsiteId, $item->getData('website_ids'))) {
$websiteUniqueFlag = false;
break;
}
}
if (!$customerGroupUniqueFlag && !$websiteUniqueFlag) {
throw new Exception();
}
}
}
示例4: getCollection
public function getCollection()
{
$store_id = $this->getStoreId();
if (!$store_id) {
return parent::getCollection();
}
$collection = Mage::getResourceModel('faq/categorystore_collection')->addFieldToFilter('store_id', $store_id)->addFieldToFilter("status", 1)->setOrder("ordering", "ASC")->setOrder("name", "ASC");
return $collection;
}
示例5: _loadExistingModel
/**
* Load a model by attribute code
*
* @param Mage_Core_Model_Abstract $model
* @param string $attributeCode
* @param string $value
* @return Mage_Core_Model_Abstract
*/
protected function _loadExistingModel($model, $attributeCode, $value)
{
foreach ($model->getCollection() as $singleModel) {
if ($singleModel->getData($attributeCode) == $value) {
$model->load($singleModel->getId());
return $model;
}
}
return $model;
}
示例6: getCollection
/**
* Retrieve resource collection instance wrapper
*
* @return Mage_Eav_Model_Mysql4_Form_Element_Collection
*/
public function getCollection()
{
return parent::getCollection();
}
示例7: getCollection
public function getCollection()
{
return parent::getCollection()->getAvailable();
}
示例8: loadByFewFields
/**
* Load Absctract Collection by few key fields
*
* @param Mage_Core_Model_Abstract $object
* @param array $data
* @return Magpleasure_Common_Model_Resource_Abstract
*/
public function loadByFewFields(Mage_Core_Model_Abstract $object, array $data)
{
/** @var $collection Mage_Core_Model_Resource_Db_Collection_Abstract */
$collection = $object->getCollection();
if ($collection) {
foreach ($data as $field => $value) {
$collection->addFieldToFilter($field, $value);
}
foreach ($collection as $item) {
/** @var $item Mage_Core_Model_Abstract */
if ($itemId = $item->getId()) {
$itemModel = Mage::getModel($object->getResourceName())->load($itemId);
$object->setData($itemModel->getData());
}
}
}
return $this;
}
示例9: _getObjectInstanceFromCollection
/**
* @param \Mage_Core_Model_Abstract $model
* @param array $columns
* @param array $values
* @return \Mage_Core_Model_Abstract
*/
private function _getObjectInstanceFromCollection(\Mage_Core_Model_Abstract $model, $columns, $values)
{
$collection = $model->getCollection();
$amountOfColumns = count($columns);
for ($i = 0; $i < $amountOfColumns; $i++) {
if (isset($columns[$i]) && isset($values[$i])) {
$collection->addFieldToFilter($columns[$i], $values[$i]);
} else {
return null;
}
}
$item = $collection->getFirstItem();
return !$item && !$item->getId() ? null : $item;
}