protected function _getProductCollection() { $page = Mage::getBlockSingleton('page/html_pager')->getCurrentPage(); date_default_timezone_set(Mage::getStoreConfig('general/locale/timezone')); $todayDate = strftime("%Y-%m-%d", Mage::app()->getLocale()->storeTimeStamp(Mage::app()->getStore()->getId())); $storeId = Mage::app()->getStore()->getId(); $product = Mage::getModel('catalog/product'); $this->_productCollection = $product->setStoreId($storeId)->getCollection()->addAttributeToSelect(array('name', 'status', 'price', 'special_price', 'small_image', 'required_options', 'special_from_date', 'special_to_date'), 'inner')->joinField('stock_status', 'cataloginventory/stock_status', 'stock_status', 'product_id=entity_id', array('stock_status' => Mage_CatalogInventory_Model_Stock_Status::STATUS_IN_STOCK, 'website_id' => Mage::app()->getWebsite()->getWebsiteId()))->addAttributeToFilter('special_price', array('gt' => 0), 'left')->addAttributeToFilter('special_from_date', array('date' => true, 'to' => $todayDate))->addAttributeToFilter('special_to_date', array('or' => array(0 => array('date' => true, 'from' => $todayDate), 1 => array('is' => new Zend_Db_Expr('null')))), 'left')->addAttributeToSort('created_at', 'desc')->addFinalPrice()->addStoreFilter()->setPageSize($this->getProductsLimit())->setCurPage($page)->addAttributeToFilter('status', 1)->addUrlRewrite(); Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($this->_productCollection); Mage::getSingleton('catalog/product_visibility')->addVisibleInSearchFilterToCollection($this->_productCollection); $checkedProducts = new Varien_Data_Collection(); foreach ($this->_productCollection as $k => $p) { $p = $p->loadParentProductIds(); $parentIds = $p->getData('parent_product_ids'); if (is_array($parentIds) && !empty($parentIds)) { if (!$checkedProducts->getItemById($parentIds[0])) { $parentProduct = Mage::getModel('catalog/product')->setStoreId($storeId)->load($parentIds[0]); if ($parentProduct->isVisibleInCatalog()) { $checkedProducts->addItem($parentProduct); } } } else { if (!$checkedProducts->getItemById($k)) { $checkedProducts->addItem($p); } } if (count($checkedProducts) >= $this->getProductsLimit()) { break; } } return $this->_productCollection; }
protected function _getProductCollection() { $storeId = Mage::app()->getStore()->getId(); $product = Mage::getModel('catalog/product'); $visibility = array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH, Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG); $this->_productCollection = $product->setStoreId($storeId)->getCollection()->addAttributeToSelect(array('name', 'price', 'small_image'), 'inner')->addAttributeToSelect(array('special_price'), 'left')->setOrder('created_at', 'desc')->addFieldToFilter('type_id', 'bundle')->setPageSize($this->getProductsLimit())->addAttributeToFilter('visibility', $visibility); $checkedProducts = new Varien_Data_Collection(); foreach ($this->_productCollection as $k => $p) { $p = $p->loadParentProductIds(); $parentIds = $p->getData('parent_product_ids'); if (is_array($parentIds) && !empty($parentIds)) { if (!$checkedProducts->getItemById($parentIds[0])) { $parentProduct = Mage::getModel('catalog/product')->setStoreId($storeId)->load($parentIds[0]); if ($parentProduct->isVisibleInCatalog()) { $checkedProducts->addItem($parentProduct); } } } else { if (!$checkedProducts->getItemById($k)) { $checkedProducts->addItem($p); } } if (count($checkedProducts) >= $this->getProductsLimit()) { break; } } return $this->_productCollection; }
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()); }
private function _processPeriod($collection, $period) { switch ($period) { case 'day': return $collection; break; case 'month': $index = 1; break; case 'year': $index = 0; break; } $fields = array('abandoned_carts_num', 'abandoned_carts_price', 'abandoned_items_num', 'recovered_carts_num', 'ordered_carts_num', 'ordered_carts_price', 'ordered_items_num', 'av_back_time', 'target_letter_step'); $date = $collection->getFirstItem()->getDate(); $dateArray = explode('-', $date); $val = $dateArray[$index]; $returnCollection = new Varien_Data_Collection(); $object = new Varien_Object(); //$counterABT=0; $counterTLS = 0; foreach ($collection as $item) { $dateArray = explode('-', $item->getDate()); if ($dateArray[$index] != $val) { $val = $dateArray[$index]; /*if($counterABT) { $object->setData('av_back_time',$object->getData('av_back_time')/$counterABT); }*/ if ($counterTLS) { $object->setData('target_letter_step', $object->getData('target_letter_step') / $counterTLS); } $returnCollection->addItem($object); $object = new Varien_Object(); $counterABT = 0; $counterTLS = 0; } $object->setDate($item->getDate()); //if($item->getData('av_back_time'))$counterABT++; if ($item->getData('target_letter_step')) { $counterTLS++; } foreach ($fields as $field) { $object->setData($field, $object->getData($field) + $item->getData($field)); } } /*if($counterABT) { $object->setData('av_back_time',$object->getData('av_back_time')/$counterABT); }*/ if ($counterTLS) { $object->setData('target_letter_step', $object->getData('target_letter_step') / $counterTLS); } $returnCollection->addItem($object); return $returnCollection; }
protected function _prepareCollection() { // Build a collection representing each data feed for each website $collection = new Varien_Data_Collection(); // Iterate websites and check configuration $websites = Mage::app()->getWebsites(false, true); foreach ($websites as $website) { // Grab id from website $websiteId = $website->getId(); // Create Website Row in Grid if (Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/general/allfeedsenabled') == 'enabled') { // Lookup configuration for this site $feedTypes = ''; foreach (Mybuys_Connector_Model_Generatefeeds::getFeedTypes() as $curFeedType) { if (Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/feedsenabled/' . $curFeedType) == 'enabled') { if (strlen($feedTypes) > 0) { $feedTypes .= ', '; } $feedTypes .= $curFeedType; } } $sftpUser = Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/connect/username'); $sftpDestination = Mage::app()->getWebsite($websiteId)->getConfig('mybuys_datafeeds/connect/hostname'); // Create and save grid item $newItem = $collection->getNewEmptyItem(); $newItem->setData(array('id' => $website->getId(), 'website_name' => $website->getName(), 'website_code' => $website->getCode(), 'feeds' => $feedTypes, 'sftp_destination' => $sftpDestination, 'sftp_user' => $sftpUser)); $collection->addItem($newItem); } } $this->setCollection($collection); return $this; }
/** * List all Cache types * * @return MageHack_MageConsole_Model_Abstract */ public function listing() { $collection = new Varien_Data_Collection(); foreach (Mage::app()->getCacheInstance()->getTypes() as $type) { $collection->addItem($type); } if (!$collection->count()) { $message = 'This is strange, we did not find any cache types.'; $this->setType(self::RESPONSE_TYPE_MESSAGE); $this->setMessage($message); } else { if ($collection->count() > 0) { $values = $collection->toArray(); if (is_array($values) && $values['totalRecords'] > 0) { foreach ($values['items'] as $row) { if (is_array($row)) { $_values[] = array_intersect_key($row, $this->_attrToShow); } } if (Mage::getStoreConfig('admin/mageconsole/html_tables') != 1) { $this->setType(self::RESPONSE_TYPE_MESSAGE); $message = Mage::helper('mageconsole')->createTable($_values, true, $this->_columnWidths); $this->setMessage($message); } else { $this->setMessage($_values); $this->setType(self::RESPONSE_TYPE_LIST); } } } } return $this; }
/** * Prepare grid collection */ protected function _prepareCollection() { $collection = new Varien_Data_Collection(); $layout = $this->getLayout(); $update = $layout->getUpdate(); $design = Mage::getSingleton('core/design_package'); $layoutXML = $update->getFileLayoutUpdatesXml('frontend', $design->getPackageName(), $design->getTheme('layout'), 0); $xpath = $layoutXML->xpath('//action[@method="setEsi"]'); foreach ($xpath as $x) { $esi = new Varien_Object(); $handle = $x->xpath('ancestor::node()[last()-2]'); $handleName = $handle[0]->label ? $handle[0]->label : $handle[0]->getName(); $parentBlock = $x->xpath('parent::*'); $parentBlockName = $parentBlock[0]->getAttribute('name'); $parentBlockDescription = $parentBlock[0]->getAttribute('description'); $cacheType = $x->params->cache_type ? $x->params->cache_type : "global"; $esi->setId($parentBlockName); $esi->setHandle($handleName); $esi->setBlockName($parentBlockName); $esi->setDescription($parentBlockDescription); $esi->setCacheType($cacheType); try { $collection->addItem($esi); } catch (Exception $e) { Mage::logException($e); } } $this->setCollection($collection); return parent::_prepareCollection(); }
public function __construct() { parent::__construct(); $this->setTemplate('order-approval/cart.phtml'); $approverId = Mage::getSingleton('customer/session')->getCustomer()->getId(); $groups = Mage::getResourceModel('customer/group_collection')->addFieldToFilter('approver_id', $approverId)->load(); $_customers = array(); foreach ($groups as $group) { $_customers += Mage::getResourceModel('customer/customer_collection')->addNameToSelect()->addAttributeToFilter('group_id', $group->getId())->getItems(); } $_customers += Mage::getResourceModel('customer/customer_collection')->addNameToSelect()->addAttributeToFilter('approver', $approverId)->getItems(); $customers = new Varien_Data_Collection(); foreach ($_customers as $customer) { $quote = Mage::getModel('sales/quote')->setStoreId(Mage::app()->getStore()->getId())->loadByCustomer($customer->getId()); $declinedItems = Mage::getModel('sales/quote_item')->getCollection()->addFieldToFilter('approved', 2)->setQuote($quote); $approvedItems = Mage::getModel('sales/quote_item')->getCollection()->addFieldToFilter('approved', 1)->setQuote($quote); $unapprovedItemsNumber = count($quote->getItemsCollection()) - count($approvedItems) - count($declinedItems); if ($unapprovedItemsNumber) { $customer->setUnapprovedItemsNumber($unapprovedItemsNumber); $customers->addItem($customer); } } $this->setCustomers($customers); Mage::app()->getFrontController()->getAction()->getLayout()->getBlock('root')->setHeaderTitle(Mage::helper('orderapproval')->__('Carts of customers')); }
public function processGroup($collection) { $items = null; if ($collection && $collection->getSize() > 0) { $items = new Varien_Data_Collection(); //$items->clear(); $_groupId = 0; $_item = null; $_groupItem = array(); $_groupQty = array(); foreach ($collection as $item) { $product = Mage::getModel('catalog/product')->load($item->getProductId()); $_groupItem = array('product_name' => $product->getName(), 'product_id' => $item->getProductId(), 'sku' => $item->getSku(), 'product_qty' => $item->getQty(), 'product_qty_invoiced' => $item->getQtyInvoiced(), 'product_qty_shipped' => $item->getQtyShipped(), 'product_qty_refunded' => $item->getQtyRefunded(), 'price' => $item->getPrice(), 'wrap_id' => $item->getId()); $_groupItem = $this->_appendItem($_groupItem, $item); if ($_groupId != $item->getGroupId()) { $_item = clone $item; $_groupId = $item->getGroupId(); $_item->setGroupItem(array($_groupItem)); $items->addItem($_item); } else { $_groupItem = $_item->getGroupItem(); $_groupItem[] = $_groupItem; $_item->setGroupItem($_groupItem); } } } return $items; }
public function getGalleryImages() { if ($this->_all === null) { if (class_exists('FlintDigital_SimpleProductData_Block_Product_View_Media')) { $block = new FlintDigital_SimpleProductData_Block_Product_View_Media(); $collection = $block->getGalleryImages(); } else { $collection = parent::getGalleryImages(); } if (empty($collection) || $collection->getSize() == 0) { $productMediaConfig = Mage::getModel('catalog/product_media_config'); $image = $this->getProduct()->getImage(); if ($image != 'no_selection') { $img['url'] = $productMediaConfig->getMediaUrl($image); $img['id'] = null; $img['path'] = $productMediaConfig->getMediaPath($image); $collection = new Varien_Data_Collection(); $collection->addItem(new Varien_Object($img)); } } $videosInit = new IWD_Productvideo_Block_Frontend_Init(); $this->_all = new Varien_Data_Collection(); if ($videosInit->getThumbnailsPosition() == 'before') { $this->_completeCollectionWithVideo(); } foreach ($collection as $item) { $this->_all->addItem($item); } if ($videosInit->getThumbnailsPosition() == 'after') { $this->_completeCollectionWithVideo(); } } return $this->_all; }
protected function _prepareCollection() { $sort = $this->getParam('sort', $this->_defaultSort); $dir = $this->getParam('dir', $this->_defaultDir); $files = $this->_helper->getLogFiles(); if (isset($sort) && !empty($files) && isset($files[0][$sort])) { usort($files, function ($a, $b) use($sort, $dir) { $a = $a[$sort]; $b = $b[$sort]; if (is_numeric($a)) { return $dir == 'asc' ? $a - $b : $b - $a; } else { return $dir == 'asc' ? strcmp($a, $b) : -strcmp($a, $b); } }); } $collection = new Varien_Data_Collection(); foreach ($files as $file) { $item = new Varien_Object(); $item->setIdFieldName('filename'); $item->setFilename($file['filename']); $item->setFilesize($this->_helper->humanFilesize($file['filesize'])); $item->setLines($file['lines']); $collection->addItem($item); } $this->setCollection($collection); return parent::_prepareCollection(); }
public function _prepareCollection() { /*Vamos a crear los campos que futuramente va a almacenar, pero aun no los vamos a tomar de la BBDD * por comodidad y ver como queda y tener algunos datos de ejemplo*/ /*Creamos los datos de ejemplo*/ $thing_1 = new Varien_Object(); $thing_1->setCampaignId(1)->setNumReg(200)->setNombreLista('Lista de chicas')->setFechaCreacion('2012-03-14')->setDescripcion('Descripción de la primera lista')->setNameList('SMS_linstachicas_388232.csv'); $thing_2 = new Varien_Object(); $thing_2->setCampaignId(2); $thing_2->setNumReg(200); $thing_2->setNombreLista('Lista de chicos'); $thing_2->setFechaCreacion('2012-03-13'); $thing_2->setDescripcion('Descripción de la segunda lista'); $thing_2->setNameList('SMS_linstachicos_384562.csv'); $thing_3 = new Varien_Object(); $thing_3->setCampaignId(3); $thing_3->setNumReg(200); $thing_3->setNombreLista('Lista de compradores'); $thing_3->setFechaCreacion('2012-03-12'); $thing_3->setDescripcion('Descripción de la tercera lista'); $thing_3->setNameList('SMS_linstacompradores_198232.csv'); $collectionDemo = new Varien_Data_Collection(); $collectionDemo->addItem($thing_1)->addItem($thing_2)->addItem($thing_3); /* Fin de los datos de ejemplo*/ $this->setCollection($collectionDemo); return parent::_prepareCollection(); }
public function getTestResultsCollection() { if (is_null($this->_testResultsCollection)) { $collection = new Varien_Data_Collection(); foreach($this->_getCheckMethods() as $method => $title) { $statusClass = 'success-msg'; try { $response = $this->_performCheck($method); } catch (Exception $e) { $response = $e->getMessage(); $statusClass = 'error-msg'; } $collection->addItem( new Varien_Object(array('title' => $title, 'response' => $response, 'result' => $statusClass)) ); } $this->_testResultsCollection = $collection; } return $this->_testResultsCollection; }
/** * Apply the Vimeo short code * * @param string &$content * @param Fishpig_Wordpress_Model_Post_Abstract $object * @return void */ protected function _apply(&$content, Fishpig_Wordpress_Model_Post_Abstract $object) { if (($shortcodes = $this->_getShortcodes($content)) !== false) { foreach ($shortcodes as $it => $shortcode) { $args = $shortcode->getParams(); if (!$args->getColumns()) { $args->setColumns(3); } if (!$args->getSize()) { $args->setSize('thumbnail'); } if (!$args->getLink()) { $args->setLink('attachment'); } if ($args->getPostId()) { if ($args->getPostId() !== $params['object']->getId()) { $post = Mage::getModel('catalog/post')->load($args->getPostId()); } } if (($ids = trim($args->getIds(), ',')) !== '') { $images = new Varien_Data_Collection(); foreach (explode(',', $ids) as $imageId) { $image = Mage::getModel('wordpress/image')->load($imageId); if ($image->getId()) { $images->addItem($image); } } } else { $images = $object->getImages(); } $html = $this->_createBlock('wordpress/template')->setImageCollection($images)->setColumns($args->getColumns())->setPost($object)->setSize($args->getSize())->setLink($args->getLink())->setGalleryIt($it + 1)->setTemplate('wordpress/shortcode/gallery.phtml')->setAfterGalleryScript(Mage::helper('wp_addon_lightboxgallery')->getAfterGalleryScript($it + 1))->toHtml(); $content = str_replace($shortcode->getHtml(), $html, $content); } } }
private function getSearchResultCollection() { $collection = new Varien_Data_Collection(); $index = Mage::helper('searchindex/index')->getIndex('mage_catalog_product'); $storeId = $this->getStoreId(); if (($query = $this->getRequest()->getParam('q')) && $index) { $engine = Mage::helper('searchindex')->getSearchEngine(); $start = microtime(true); try { $result = $engine->query($query, $storeId, $index); } catch (Exception $e) { try { $engine = Mage::getModel('searchsphinx/engine_fulltext'); $result = $engine->query($query, $storeId, $index); } catch (Exception $e) { Mage::getSingleton('adminhtml/session')->addError($e->getMessage()); $result = array(); } } $end = microtime(true); $this->searchTime = round($end - $start, 4); foreach ($result as $productId => $relevance) { $varienObject = new Varien_Object(); $varienObject->addData(array('id' => $productId, 'relevance' => $relevance)); $collection->addItem($varienObject); } $this->resultSize = $collection->getSize(); } return $collection; }
/** * Retrieve a collection of all rewrites * * @author FireGento Team <*****@*****.**> * @copyright 2013 FireGento Team (http://firegento.com). All rights served. * @license http://opensource.org/licenses/gpl-3.0 GNU General Public License, version 3 (GPLv3) */ public function getRewriteCollection() { $collection = new Varien_Data_Collection(); $rewrites = $this->_loadRewrites(); foreach ($rewrites as $rewriteNodes) { foreach ($rewriteNodes as $n) { $nParent = $n->xpath('..'); $module = (string) $nParent[0]->getName(); $nSubParent = $nParent[0]->xpath('..'); $component = (string) $nSubParent[0]->getName(); if (!in_array($component, array('blocks', 'helpers', 'models'))) { continue; } $pathNodes = $n->children(); foreach ($pathNodes as $pathNode) { $path = (string) $pathNode->getName(); $completePath = $module . '/' . $path; $rewriteClassName = (string) $pathNode; $instance = Mage::getConfig()->getGroupedClassName(substr($component, 0, -1), $completePath); $collection->addItem(new Varien_Object(array('path' => $completePath, 'rewrite_class' => $rewriteClassName, 'active_class' => $instance, 'status' => $instance == $rewriteClassName))); } } } return $collection; }
/** * Collection object set up */ protected function _prepareCollection() { $collection = new Varien_Data_Collection(); foreach (Mage_Api2_Model_Auth_User::getUserTypes() as $type => $label) { $collection->addItem(new Varien_Object(array('user_type_name' => $label, 'user_type_code' => $type))); } $this->setCollection($collection); }
/** * Retrieve a collection of integration results * * @return Varien_Data_Collection */ public function getIntegrationTestResults() { if (!Mage::helper('wordpress')->isEnabled()) { return false; } if (!$this->_isCached('integration_results')) { $results = new Varien_Data_Collection(); $results->addItem($this->_isConnected()); if (Mage::helper('wordpress')->isFullyIntegrated()) { $validWpUrls = $this->_hasValidWordPressUrls(); $results->addItem($validWpUrls); if ($validWpUrls->getIsError()) { $results->addItem($this->_createErrorTestResultObject($this->__('Blog Route'))); } else { $results->addItem($this->_hasValidBlogRoute()); } if (($result = $this->_hasIndexDotPhpUrl()) !== false) { $results->addItem($result); } $results->addItem($this->_hasValidWordPressPath()); } if (!Mage::helper('wordpress')->isWordPressMUInstalled() && !Mage::app()->isSingleStoreMode()) { $results->addItem($this->_getWpMuItem()); } Mage::dispatchEvent('wordpress_integration_test_results_after', array('results' => $results)); $this->_cache('integration_results', $results); } return $this->_cached('integration_results'); }
/** * Prepare grid collection object * * @return Examples_AdminGridAndForm_Block_Adminhtml_Thing_Grid */ protected function _prepareCollection() { # normally you would use a resource collection model to supply a # database-derived collection, but we're using a static collection # so that we don't have to use a real collection $item1 = new Varien_Object(); $item1->setData(array('thing_id' => 1, 'name' => 'Item 1', 'short_description' => 'A very nice shiny thing', 'quantity' => 10)); $item2 = new Varien_Object(); $item2->setData(array('thing_id' => 2, 'name' => 'Item 2', 'short_description' => 'A very nice dull matte black thing', 'quantity' => 2)); $item3 = new Varien_Object(); $item3->setData(array('thing_id' => 3, 'name' => 'Item 3', 'short_description' => 'A paticularly obnoxious peice of wood', 'quantity' => 90)); $collection = new Varien_Data_Collection(); $collection->addItem($item1); $collection->addItem($item2); $collection->addItem($item3); $this->setCollection($collection); return parent::_prepareCollection(); }
/** * Prepare grid collection */ protected function _prepareCollection() { $collection = new Varien_Data_Collection(); foreach (Mage::app()->getCacheInstance()->getTypes() as $type) { $collection->addItem($type); } $this->setCollection($collection); return parent::_prepareCollection(); }
/** * Retrieve test collection * * @return Varien_Data_Collection */ protected function _getTestCollection() { $collection = new Varien_Data_Collection(); $items = array(new Varien_Object(array('test1' => '1', 'test2' => '2'))); foreach ($items as $item) { $collection->addItem($item); } return $collection; }
/** * {@inheritdoc} */ protected function _prepareCollection() { $collection = new Varien_Data_Collection(); $files = Mage::helper('nicovogelaar_nedisimport/catalog')->getFiles(); foreach ($files as $file) { $collection->addItem($file); } $this->setCollection($collection); return parent::_prepareCollection(); }
/** * Returns Varien data collection * * @param array $items * * @return Varien_Data_Collection */ public function getVarienDataCollection($items) { $collection = new Varien_Data_Collection(); foreach ($items as $item) { $_Varien = new Varien_Object(); $_Varien->setData($item); $collection->addItem($_Varien); } return $collection; }
/** * Prepare collection for grid * * @return Mage_Adminhtml_Block_Widget_Grid */ protected function _prepareCollection() { $collection = new Varien_Data_Collection(); foreach ($this->getTransactionAdditionalInfo() as $key => $value) { $data = new Varien_Object(array('key' => $key, 'value' => $value)); $collection->addItem($data); } $this->setCollection($collection); return parent::_prepareCollection(); }
/** * Retrieve new invoice collection from an array of invoices' data * * @param array $invoicesData * @return Varien_Data_Collection */ protected function _getInvoiceCollection(array $invoicesData) { $result = new Varien_Data_Collection(); foreach ($invoicesData as $oneInvoiceData) { /** @var $prevInvoice Mage_Sales_Model_Order_Invoice */ $prevInvoice = $this->getMock('Mage_Sales_Model_Order_Invoice', array('_init'), array($oneInvoiceData)); $result->addItem($prevInvoice); } return $result; }
protected function _prepareCollection() { $collection = new Varien_Data_Collection(); foreach (array_slice($this->getData('Charities'), 0, 10) as $index) { $temp = array('id' => $index['id'], 'name' => $index['name']); $collection->addItem(new Varien_Object($temp)); } $this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareCollection() { $results = new Varien_Data_Collection(); foreach ($this->getBidsData() as $index => $item) { $temp = array('user_id' => $item['user']['user_id'], 'email' => $item['user']['email'], 'price' => $item['price'], 'time' => $item['time']); $results->addItem(new Varien_Object($temp)); } $this->setCollection($results); return parent::_prepareCollection(); }
protected function _prepareCollection() { $data = Mage::helper('M2ePro/Data_Global')->getValue('temp_data'); $results = new Varien_Data_Collection(); foreach ($data['data'] as $index => $item) { $temp = array('id' => $index, 'general_id' => isset($item['general_id']) ? $item['general_id'] : null, 'title' => $item['title'], 'image_url' => $item['image_url'], 'price' => isset($item['price']) ? $item['price'] : null, 'variations' => isset($item['variations']) ? $item['variations'] : null); $results->addItem(new Varien_Object($temp)); } $this->setCollection($results); return parent::_prepareCollection(); }
protected function _prepareCollection() { $data = Mage::helper('M2ePro/Data_Global')->getValue('temp_data'); $results = new Varien_Data_Collection(); foreach ($data as $index => $item) { $temp = array('id' => $item['category_id'], 'title' => $item['title'], 'path' => $item['path'], 'node_id' => $item['node_id'], 'native_id' => $item['native_id']); $results->addItem(new Varien_Object($temp)); } $this->setCollection($results); return parent::_prepareCollection(); }
public function getCustomerCollection() { $collection = new Varien_Data_Collection(); $collectionForOrders = Mage::getModel('sales/order')->getCollection(); foreach ($collectionForOrders as $orderOBJ) { $varienObject = new Varien_Object(); $varienObject->setData('customerOrder', array('customer' => empty($orderOBJ->getData("customer_id")) ? "" : $this->getChildrenForCustomer($orderOBJ->getData("customer_id")), 'grossTotalOrderValue' => $this->getChildrenForGrossTotalOrderValue($orderOBJ), 'CustomerOrderHead' => $this->getChildrenForCustomerOrderHead($orderOBJ), 'customerOrderPositions' => $this->getChildrenForcustomerOrderPositions($orderOBJ))); $collection->addItem($varienObject); } return $collection; }