Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
	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;
	}
Exemplo n.º 3
0
 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();
 }
Exemplo n.º 4
0
 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();
 }
 /**
  * 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);
         }
     }
 }
Exemplo n.º 6
0
 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;
 }
Exemplo n.º 7
0
 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();
 }
 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;
 }
Exemplo n.º 9
0
 /**
  * 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;
 }
Exemplo n.º 10
0
 /**
  * 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();
 }
Exemplo n.º 11
0
 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'));
 }
Exemplo n.º 12
0
 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;
 }
Exemplo n.º 13
0
 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;
 }
Exemplo n.º 14
0
 /**
  * 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);
 }
Exemplo n.º 15
0
 /**
  * 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();
 }
Exemplo n.º 16
0
 /**
  * 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;
 }
Exemplo n.º 17
0
 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;
 }
Exemplo n.º 18
0
 /**
  * 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;
 }
Exemplo n.º 19
0
 /**
  * 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;
 }
Exemplo n.º 20
0
 /**
  * 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();
 }
Exemplo n.º 21
0
 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();
 }
Exemplo n.º 22
0
 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();
 }
Exemplo n.º 23
0
 /**
  * {@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();
 }
Exemplo n.º 24
0
 /**
  * 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');
 }
Exemplo n.º 25
0
 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();
 }
 /**
  * Scenario: Get tracking data
  * Given a ROM order object
  * And shipment id
  * And tracking number
  * When getting tracking data
  * Then get the specified shipment from the ROM order object
  * And extract tracking data for it.
  *
  * @param Mage_Sales_Model_Order
  * @param EbayEnterprise_Order_Model_Detail_Process_Response_Shipment
  * @param string
  * @param string
  * @dataProvider providerTrackingInfo
  */
 public function testGetTrackingData(Mage_Sales_Model_Order $order, EbayEnterprise_Order_Model_Detail_Process_Response_Shipment $shipment, $shipmentId, $trackingNumber)
 {
     /** @var Varien_Data_Collection */
     $shipments = new Varien_Data_Collection();
     $shipments->addItem($shipment);
     EcomDev_Utils_Reflection::setRestrictedPropertyValues($order, ['_shipments' => $shipments]);
     /** @var EbayEnterprise_Order_Model_Tracking */
     $tracking = $this->getModelMock('ebayenterprise_order/tracking', ['extractTrackingDataFromShipment'], false, [['order' => $order, 'shipment_id' => $shipmentId, 'tracking_number' => $trackingNumber]]);
     $tracking->expects($this->once())->method('extractTrackingDataFromShipment')->with($this->identicalTo($shipment))->will($this->returnValue([]));
     $this->assertCount(1, $tracking->getTrackingData());
 }
Exemplo n.º 27
0
 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' => $index, 'title' => $item['title'], 'path' => $item['path'], 'xsd_hash' => $item['xsd_hash'], 'node_hash' => $item['node_hash'], 'item_types' => json_decode($item['item_types'], true), 'browsenode_id' => $item['browsenode_id']);
         $results->addItem(new Varien_Object($temp));
     }
     $this->setCollection($results);
     return parent::_prepareCollection();
 }
Exemplo n.º 28
0
 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;
 }
Exemplo n.º 29
0
 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();
 }
Exemplo n.º 30
0
 protected function _prepareCollection()
 {
     $collection = new Varien_Data_Collection();
     $data = array(array('id' => 'sales', 'report' => Mage::helper('sales')->__('Orders'), 'comment' => Mage::helper('sales')->__('Total Ordered Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_ORDER_FLAG_CODE)), array('id' => 'tax', 'report' => Mage::helper('sales')->__('Tax'), 'comment' => Mage::helper('sales')->__('Order Taxes Report Grouped by Tax Rates'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_TAX_FLAG_CODE)), array('id' => 'shipping', 'report' => Mage::helper('sales')->__('Shipping'), 'comment' => Mage::helper('sales')->__('Total Shipped Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_SHIPPING_FLAG_CODE)), array('id' => 'invoiced', 'report' => Mage::helper('sales')->__('Total Invoiced'), 'comment' => Mage::helper('sales')->__('Total Invoiced VS Paid Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_INVOICE_FLAG_CODE)), array('id' => 'refunded', 'report' => Mage::helper('sales')->__('Total Refunded'), 'comment' => Mage::helper('sales')->__('Total Refunded Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_REFUNDED_FLAG_CODE)), array('id' => 'coupons', 'report' => Mage::helper('sales')->__('Coupons'), 'comment' => Mage::helper('sales')->__('Promotion Coupons Usage Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_COUPONS_FLAG_CODE)), array('id' => 'bestsellers', 'report' => Mage::helper('sales')->__('Bestsellers'), 'comment' => Mage::helper('sales')->__('Products Bestsellers Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_BESTSELLERS_FLAG_CODE)), array('id' => 'viewed', 'report' => Mage::helper('sales')->__('Most Viewed'), 'comment' => Mage::helper('sales')->__('Most Viewed Products Report'), 'updated_at' => $this->_getUpdatedAt(Mage_Reports_Model_Flag::REPORT_PRODUCT_VIEWED_FLAG_CODE)));
     foreach ($data as $value) {
         $item = new Varien_Object();
         $item->setData($value);
         $collection->addItem($item);
     }
     $this->setCollection($collection);
     return parent::_prepareCollection();
 }