本文整理汇总了PHP中Varien_Data_Collection::getItems方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Collection::getItems方法的具体用法?PHP Varien_Data_Collection::getItems怎么用?PHP Varien_Data_Collection::getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Collection
的用法示例。
在下文中一共展示了Varien_Data_Collection::getItems方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRemoveAllItems
public function testRemoveAllItems()
{
$model = new Varien_Data_Collection();
$model->addItem(new Varien_Object());
$model->addItem(new Varien_Object());
$this->assertCount(2, $model->getItems());
$model->removeAllItems();
$this->assertEmpty($model->getItems());
}
示例2: _prepareColumns
protected function _prepareColumns()
{
try {
$collection = $this->_createCollection();
$collection->setPageSize(1);
$collection->load();
} catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($this->__('An error occured rendering the grid: ' . $e->getMessage()));
Mage::logException($e);
$collection = new Varien_Data_Collection();
}
$config = $this->_getReport()->getGridConfig();
$filterable = $config->getFilterable();
$items = $collection->getItems();
if (count($items)) {
$item = reset($items);
foreach ($item->getData() as $key => $val) {
$isFilterable = false;
if (isset($filterable[$key])) {
$isFilterable = $filterable[$key];
} elseif (in_array($key, $filterable)) {
$isFilterable = 'adminhtml/widget_grid_column_filter_text';
}
$this->addColumn($key, array('header' => Mage::helper('core')->__($key), 'index' => $key, 'filter' => $isFilterable, 'sortable' => true));
}
}
return parent::_prepareColumns();
}
示例3: _getAllParentConfigurableSkus
/**
* Get the skus of all potential configurable products that a simple product
* within the collection of products to be cleaned may need to be linked to.
* @param Varien_Data_Collection $productCollection
* @return array
*/
protected function _getAllParentConfigurableSkus(Varien_Data_Collection $productCollection)
{
$helper = $this->_helper;
$catalogId = $this->_config->catalogId;
return array_map(function ($product) use($helper, $catalogId) {
return $helper->normalizeSku($product->getStyleId(), $catalogId);
}, array_filter($productCollection->getItems(), array($this, '_filterProductWithConfigParent')));
}