当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Io_File::streamOpen方法代码示例

本文整理汇总了PHP中Varien_Io_File::streamOpen方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Io_File::streamOpen方法的具体用法?PHP Varien_Io_File::streamOpen怎么用?PHP Varien_Io_File::streamOpen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Varien_Io_File的用法示例。


在下文中一共展示了Varien_Io_File::streamOpen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _printList

 private function _printList($cards, $path)
 {
     try {
         $io = new Varien_Io_File();
         $fullPath = Mage::getBaseDir() . $path;
         $parts = pathinfo($fullPath);
         if (!isset($parts['extension']) || strtolower($parts['extension']) != 'csv') {
             Mage::throwException('Error in file extension. Only *.csv files are supported');
         }
         $delimiter = ';';
         $enclosure = '"';
         $io->open(array('path' => $parts['dirname']));
         $io->streamOpen($fullPath, 'w+');
         $io->streamLock(true);
         $header = array('card_id' => 'Gift Card Code', 'amount' => 'Card Amount');
         $io->streamWriteCsv($header, $delimiter, $enclosure);
         $content = array();
         foreach ($cards as $card) {
             $content['card_id'] = $card['code'];
             $content['amount'] = $card['amount'];
             $io->streamWriteCsv($content, $delimiter, $enclosure);
         }
         $io->streamUnlock();
         $io->streamClose();
         $list = Mage::getModel('giftcards/cardslist')->load($fullPath, 'file_path');
         $list->setFilePath($fullPath)->save();
     } catch (Mage_Core_Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('giftcards')->__('An error occurred while save cards list.'));
     }
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:32,代码来源:CardscreateController.php

示例2: _generateStoreCss

 protected function _generateStoreCss($type, $storeCode)
 {
     if (!Mage::app()->getStore($storeCode)->getIsActive()) {
         return false;
     }
     $fileName = $type . '_' . $storeCode . '.css';
     $file = Mage::helper('legenda/config')->getGeneratedCssDir() . $fileName;
     $templateFile = 'smartwave/legenda/css/' . $type . '.phtml';
     Mage::register('legenda_css_generate_store', $storeCode);
     try {
         $tempalte = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($templateFile)->toHtml();
         if (empty($tempalte)) {
             throw new Exception(Mage::helper('legenda')->__("Template file is empty or doesn't exist: %s", $templateFile));
             return false;
         }
         $io = new Varien_Io_File();
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => Mage::helper('legenda/config')->getGeneratedCssDir()));
         $io->streamOpen($file, 'w+');
         $io->streamLock(true);
         $io->streamWrite($tempalte);
         $io->streamUnlock();
         $io->streamClose();
     } catch (Exception $exception) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('legenda')->__('Failed generating CSS file: %s in %s', $fileName, Mage::helper('legenda/config')->getGeneratedCssDir()) . '<br/>Message: ' . $exception->getMessage());
         Mage::logException($exception);
         return false;
     }
     Mage::unregister('legenda_css_generate_store');
     return true;
 }
开发者ID:EagleSH,项目名称:besttoy,代码行数:31,代码来源:Generator.php

示例3: createIndexSitemapFile

 /**
  * Create additional xml index file with links to other xml files (if number of them more than 1)
  */
 public function createIndexSitemapFile()
 {
     if (sizeof($this->filenamesForIndexSitemap) > 1) {
         $io = new Varien_Io_File();
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => $this->getPath()));
         $fileToCreate = Mage::helper('ascurl')->insertStringToFilename($this->getSitemapFilename(), '_index');
         if ($io->fileExists($fileToCreate) && !$io->isWriteable($fileToCreate)) {
             Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $fileToCreate, $this->getPath()));
         }
         $io->streamOpen($fileToCreate);
         $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
         $io->streamWrite('<sitemapindex ' . self::URLSET . '>');
         $storeId = $this->getStoreId();
         $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
         $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
         $path = $this->getSitemapPath();
         $fullPath = preg_replace('/(?<=[^:])\\/{2,}/', '/', $baseUrl . $path);
         foreach ($this->filenamesForIndexSitemap as $item) {
             $xml = sprintf('<sitemap><loc>%s</loc><lastmod>%s</lastmod></sitemap>', htmlspecialchars($fullPath . $item), $date);
             $io->streamWrite($xml);
         }
         $io->streamWrite('</sitemapindex>');
         $io->streamClose();
     }
 }
开发者ID:rubenjohne,项目名称:ts-echo,代码行数:29,代码来源:Sitemap.php

示例4: loadData

 /**
  * Load the import data from the csv files
  *
  * @return array
  */
 public function loadData()
 {
     $ioHandler = new Varien_Io_File();
     $ioHandler->open(array('path' => $this->getImportDir()));
     $debitFiles = $ioHandler->ls(Varien_Io_File::GREP_FILES);
     $import = array();
     foreach ($debitFiles as $debitFile) {
         if ($debitFile['filetype'] != 'csv') {
             continue;
         }
         $country = str_replace('.csv', '', $debitFile['text']);
         $country = strtoupper($country);
         $import[$country] = array();
         $i = 1;
         $ioHandler->streamOpen($debitFile['text'], 'r');
         while (($line = $ioHandler->streamReadCsv()) !== false) {
             if ($i == 1) {
                 $i++;
                 continue;
             }
             // Check if routing number already exists
             $swiftCode = trim($line[2]);
             if (array_key_exists($swiftCode, $import[$country]) || empty($swiftCode)) {
                 continue;
             }
             // Add bank to array
             $import[$country][$swiftCode] = array('routing_number' => trim($line[0]), 'swift_code' => $swiftCode, 'bank_name' => trim($line[1]));
         }
         $ioHandler->streamClose();
     }
     return $import;
 }
开发者ID:pette87,项目名称:Magento-DebitPayment,代码行数:37,代码来源:Bankdata.php

示例5: getCSVFile

 public function getCSVFile()
 {
     $data = $this->dataExport;
     if ($this->isVersion13) {
         $content = '';
         foreach ($data as $val) {
             $content .= implode(',', $val) . "\r\n";
         }
         return $content;
     } else {
         $io = new Varien_Io_File();
         $path = Mage::getBaseDir('var') . DS . 'export' . DS;
         $name = md5(microtime());
         $file = $path . DS . $name . '.csv';
         $io->setAllowCreateFolders(true);
         $io->open(array('path' => $path));
         $io->streamOpen($file, 'w+');
         $io->streamLock(true);
         // $this->dataExport[0] == csvHeader
         $io->streamWriteCsv($data[0]);
         unset($data[0]);
         //$delimiter = Mage::getSingleton('core/session')->getExportSeperator();
         foreach ($data as $val) {
             $io->streamWriteCsv($val);
         }
         return array('type' => 'filename', 'value' => $file, 'rm' => false);
     }
 }
开发者ID:xiaoguizhidao,项目名称:storebaby.it,代码行数:28,代码来源:Export.php

示例6: _generateStoreCss

 protected function _generateStoreCss($storeCode)
 {
     $store = Mage::app()->getStore($storeCode);
     $store_id = $store->getId();
     $package_name = Mage::getStoreConfig('design/package/name', $store_id);
     $theme = Mage::getStoreConfig('design/theme/defaults', $store_id);
     if ($theme == '') {
         $theme = 'default';
     }
     if (!$store->getIsActive()) {
         return;
     }
     $cssFile = Mage::getBaseDir('skin') . DS . 'frontend' . DS . $package_name . DS . $theme . DS . 'themesettings' . DS . 'css' . DS . 'themesettings_' . $storeCode . '.css';
     $cssTemplate = 'ves/themesettings/themesettings_styles.phtml';
     Mage::register('ves_store', $store);
     try {
         $cssBlockHtml = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($cssTemplate)->toHtml();
         if (empty($cssBlockHtml)) {
             throw new Exception(Mage::helper('themesettings')->__("The system has an issue when create css file"));
         }
         $file = new Varien_Io_File();
         $file->setAllowCreateFolders(true);
         $file->open(array('path' => Mage::getBaseDir('skin') . DS . 'frontend' . DS . $package_name . DS . $theme . DS . 'themesettings' . DS . 'css'));
         $file->streamOpen($cssFile, 'w+', 0777);
         $file->streamLock(true);
         $file->streamWrite($cssBlockHtml);
         $file->streamUnlock();
         $file->streamClose();
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('themesettings')->__('The system has an issue when create css file') . '<br/>Message: ' . $e->getMessage());
         Mage::logException($e);
     }
     Mage::unregister('ves_store');
 }
开发者ID:TusharKDonda,项目名称:maruti,代码行数:34,代码来源:Generator.php

示例7: prepareFeed

 /**
  * Prepare the feed file and returns its path
  *
  * @param array $productsData
  * @param int $storeId
  * @return string
  */
 public function prepareFeed(array $productsData, $storeId)
 {
     $mId = $this->getVendorConfig('merchant_id', $storeId);
     if (!$mId) {
         Mage::throwException(Mage::helper('productfeed')->__('Rakuten Seller ID must be set.'));
     }
     $filename = 'rakuten_product_' . Mage::getModel('core/date')->date('Ymd') . '.txt';
     $filepath = $this->getFeedStorageDir() . $filename;
     try {
         $ioAdapter = new Varien_Io_File();
         $ioAdapter->setAllowCreateFolders(true);
         $ioAdapter->createDestinationDir($this->getFeedStorageDir());
         $ioAdapter->cd($this->getFeedStorageDir());
         $ioAdapter->streamOpen($filename);
         $ioAdapter->streamWrite(implode(self::DELIMITER, $this->getHeaders()) . "\n");
         foreach ($productsData as $productId => $row) {
             array_unshift($row, $mId);
             $this->prepareRow($row, $productId);
             $ioAdapter->streamWrite(implode(self::DELIMITER, $row) . "\n");
             // because a CSV enclosure is not supported
         }
         return $filepath;
     } catch (Exception $e) {
         Mage::throwException(Mage::helper('productfeed')->__('Could not write feed file to path: %s, %s', $filepath, $e->getMessage()));
     }
 }
开发者ID:adrian-green,项目名称:productfeed,代码行数:33,代码来源:Product.php

示例8: import

 /**
  * @$forceCreation true overwrites existing entities with the new values
  */
 public function import($forceCreation = false)
 {
     if (is_null($this->_entity)) {
         throw Mage::exception('Please specify a valid entity.');
     }
     if (!file_exists($this->_importFile)) {
         throw Mage::exception('Please specify a valid csv file.');
     }
     if (is_null($this->_storeId)) {
         throw Mage::exception('Please specify a valid store.');
     }
     $io = new Varien_Io_File();
     $io->streamOpen($this->_importFile, 'r');
     $io->streamLock(true);
     $firstLine = true;
     while (false !== ($line = $io->streamReadCsv())) {
         if ($firstLine) {
             $firstLine = false;
             $this->_headerColumns = $line;
             continue;
         }
         $data = array();
         foreach ($this->_headerColumns as $key => $val) {
             $data[$val] = $line[$key];
         }
         $this->_importEntity($data, $forceCreation);
     }
 }
开发者ID:aayushKhandpur,项目名称:aayush-renting,代码行数:31,代码来源:Import.php

示例9: generateStoreCss

 protected function generateStoreCss($type, $storeCode)
 {
     if (!Mage::app()->getStore($storeCode)->getIsActive()) {
         return;
     }
     $str1 = '_' . $storeCode;
     $str2 = $type . $str1 . '.css';
     $str3 = Mage::helper('mango/cssconfig')->getCssConfigDir() . $str2;
     $str4 = 'mango/css/' . $type . '.phtml';
     Mage::register('cssgen_store', $storeCode);
     try {
         $block = Mage::app()->getLayout()->createBlock("core/template")->setData('area', 'frontend')->setTemplate($str4)->toHtml();
         if (empty($block)) {
             throw new Exception(Mage::helper('mango')->__("Template file is empty or doesn't exist: %s", $str4));
         }
         $file = new Varien_Io_File();
         $file->setAllowCreateFolders(true);
         $file->open(array('path' => Mage::helper('mango/cssconfig')->getCssConfigDir()));
         $file->streamOpen($str3, 'w+');
         $file->streamLock(true);
         $file->streamWrite($block);
         $file->streamUnlock();
         $file->streamClose();
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('mango')->__('Failed generating CSS file: %s in %s', $str2, Mage::helper('mango/cssconfig')->getCssConfigDir()) . '<br/>Message: ' . $e->getMessage());
         Mage::logException($e);
     }
     Mage::unregister('cssgen_store');
 }
开发者ID:perseusl,项目名称:kingdavid,代码行数:29,代码来源:Generator.php

示例10: generateCollectionList

 /**
  * Generates CSV file with product's list according to the collection in the $this->_list
  * @return array
  */
 public function generateCollectionList($filename)
 {
     if (!is_null($this->_list)) {
         $items = $this->_list->getItems();
         if (count($items) > 0) {
             $io = new Varien_Io_File();
             $path = Mage::getBaseDir('var') . DS . 'export' . DS . 'specialsubscription';
             $name = $filename;
             //   $name=md5(microtime());
             $file = $path . DS . $name . '.csv';
             $io->setAllowCreateFolders(true);
             $io->open(array('path' => $path));
             $io->streamOpen($file, 'w+');
             $io->streamLock(true);
             $io->streamWriteCsv($this->_getCsvHeaders($items));
             foreach ($items as $item) {
                 $io->streamWriteCsv($item->getData());
             }
             /*    return array(
                       'type'  => 'filename',
                       'value' => $file,
                       'rm'    => false // can delete file after use
                   );*/
             return $file;
         }
     }
 }
开发者ID:Ranjanivraman,项目名称:repository-1,代码行数:31,代码来源:Csv.php

示例11: generateXml

 /**
  * Generate XML file
  *
  * @return Mage_Sitemap_Model_Sitemap
  */
 public function generateXml()
 {
     $io = new Varien_Io_File();
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $this->getPath()));
     if ($io->fileExists($this->getSitemapFilename()) && !$io->isWriteable($this->getSitemapFilename())) {
         Mage::throwException(Mage::helper('sitemap')->__('File "%s" cannot be saved. Please, make sure the directory "%s" is writeable by web server.', $this->getSitemapFilename(), $this->getPath()));
     }
     $io->streamOpen($this->getSitemapFilename());
     $io->streamWrite('<?xml version="1.0" encoding="UTF-8"?>' . "\n");
     $io->streamWrite('<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:content="http://www.google.com/schemas/sitemap-content/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">' . "\n");
     $storeId = $this->getStoreId();
     $date = Mage::getSingleton('core/date')->gmtDate('Y-m-d');
     $baseUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
     // Hans2103 change -> set mediaUrl
     $mediaUrl = Mage::app()->getStore($storeId)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
     $mediaUrl = preg_replace('/^https/', 'http', $mediaUrl);
     /**
      * Generate categories sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/category/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/category/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_category')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
         $this->check_counter($io);
     }
     unset($collection);
     /**
      * Generate products sitemap
      */
     /**
      * override to include images in sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/product/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/product/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/catalog_product')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><image:image><image:loc>%s</image:loc><image:title>%s</image:title></image:image><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority><PageMap xmlns="http://www.google.com/schemas/sitemap-pagemap/1.0"><DataObject type="thumbnail"><Attribute name="name" value="%s"/><Attribute name="src" value="%s"/></DataObject></PageMap></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), htmlspecialchars($mediaUrl . 'catalog/product' . $item->getMedia()), htmlspecialchars($item->getName()), $date, $changefreq, $priority, htmlspecialchars($item->getName()), htmlspecialchars($mediaUrl . 'catalog/product' . $item->getMedia()));
         $io->streamWrite($xml);
     }
     unset($collection);
     /**
      * Generate cms pages sitemap
      */
     $changefreq = (string) Mage::getStoreConfig('sitemap/page/changefreq', $storeId);
     $priority = (string) Mage::getStoreConfig('sitemap/page/priority', $storeId);
     $collection = Mage::getResourceModel('sitemap/cms_page')->getCollection($storeId);
     foreach ($collection as $item) {
         $xml = sprintf('<url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%.1f</priority></url>' . "\n", htmlspecialchars($baseUrl . $item->getUrl()), $date, $changefreq, $priority);
         $io->streamWrite($xml);
     }
     unset($collection);
     $io->streamWrite('</urlset>');
     $io->streamClose();
     $this->setSitemapTime(Mage::getSingleton('core/date')->gmtDate('Y-m-d H:i:s'));
     $this->save();
     return $this;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:65,代码来源:Sitemap.php

示例12: getCsvFileEnhanced

 public function getCsvFileEnhanced()
 {
     $collectionData = $this->getCollection()->getData();
     $this->_isExport = true;
     $io = new Varien_Io_File();
     $path = Mage::getBaseDir('var') . DS . 'export' . DS;
     $name = md5(microtime());
     $file = $path . DS . $name . '.csv';
     while (file_exists($file)) {
         sleep(1);
         $name = md5(microtime());
         $file = $path . DS . $name . '.csv';
     }
     $io->setAllowCreateFolders(true);
     $io->open(array('path' => $path));
     $io->streamOpen($file, 'w+');
     $io->streamLock(true);
     if ($this->_columns) {
         $io->streamWriteCsv($this->_columns);
     }
     foreach ($collectionData as $item) {
         if ($this->_removeIndexes && is_array($this->_removeIndexes)) {
             foreach ($this->_removeIndexes as $index) {
                 unset($item[$index]);
             }
         }
         $io->streamWriteCsv($item);
     }
     $io->streamUnlock();
     $io->streamClose();
     return array('type' => 'filename', 'value' => $file, 'rm' => true);
 }
开发者ID:programmerrahul,项目名称:vastecom,代码行数:32,代码来源:Abstract.php

示例13: importAction

 public function importAction()
 {
     try {
         $productId = $this->getRequest()->getParam('id');
         $fileName = $this->getRequest()->getParam('Filename');
         $path = Mage::getBaseDir('var') . DS . 'import' . DS;
         $uploader = new Mage_Core_Model_File_Uploader('file');
         $uploader->setAllowedExtensions(array('csv'));
         $uploader->setAllowRenameFiles(false);
         $uploader->setFilesDispersion(false);
         $result = $uploader->save($path, $fileName);
         $io = new Varien_Io_File();
         $io->open(array('path' => $path));
         $io->streamOpen($path . $fileName, 'r');
         $io->streamLock(true);
         while ($data = $io->streamReadCsv(';', '"')) {
             if ($data[0]) {
                 $model = Mage::getModel('giftcards/pregenerated')->load($data[0], 'card_code');
                 if ($model->getId()) {
                     continue;
                 }
                 $model->setCardCode($data[0]);
                 $model->setCardStatus(1);
                 $model->setProductId($productId);
                 $model->save();
             } else {
                 continue;
             }
         }
     } catch (Exception $e) {
         $result = array('error' => $e->getMessage(), 'errorcode' => $e->getCode());
     }
     $this->getResponse()->setBody(Mage::helper('core')->jsonEncode($result));
 }
开发者ID:enjoy2000,项目名称:gemz,代码行数:34,代码来源:ProductController.php

示例14: export

 /**
  * Export function:
  * - Returns false, if an error occured or if there are no orders to export
  * - Returns array, containing the filename and the file contents
  *
  * @return bool|array
  */
 public function export()
 {
     $collection = $this->_hasOrdersToExport();
     if (!$collection) {
         return false;
     }
     $fileName = $this->getFileName();
     // Open file
     $file = new Varien_Io_File();
     $file->open(array('path' => Mage::getBaseDir('var')));
     $file->streamOpen($fileName);
     // Add headline
     $row = array('Kundenname', 'BLZ', 'Kontonummer', 'BIC/Swift-Code', 'IBAN', 'Betrag', 'Verwendungszweck');
     $file->streamWriteCsv($row);
     // Add rows
     foreach ($collection as $order) {
         /* @var $orderModel Mage_Sales_Model_Order */
         $orderModel = Mage::getModel('sales/order')->load($order->getData('entity_id'));
         /* @var $paymentMethod Itabs_Debit_Model_Debit */
         $paymentMethod = $orderModel->getPayment()->getMethodInstance();
         // Format order amount
         $amount = number_format($order->getData('grand_total'), 2, ',', '.');
         $row = array('name' => $paymentMethod->getAccountName(), 'bank_code' => $paymentMethod->getAccountBLZ(), 'account_number' => $paymentMethod->getAccountNumber(), 'account_swift' => $paymentMethod->getAccountSwift(), 'account_iban' => $paymentMethod->getAccountIban(), 'amount' => $amount . ' ' . $order->getData('order_currency_code'), 'purpose' => 'Bestellung Nr. ' . $order->getData('increment_id'));
         $file->streamWriteCsv($row);
         $this->_getDebitHelper()->setStatusAsExported($order->getId());
     }
     // Close file, get file contents and delete temporary file
     $file->close();
     $filePath = Mage::getBaseDir('var') . DS . $fileName;
     $fileContents = file_get_contents($filePath);
     $file->rm($fileName);
     $response = array('file_name' => $fileName, 'file_content' => $fileContents);
     return $response;
 }
开发者ID:thanakrit-promsiri,项目名称:GermanStoreConfig,代码行数:41,代码来源:Csv.php

示例15: getCsvData

 /**
  * Generates CSV file with product's list according to the collection in the $this->_list
  * @return array
  */
 public function getCsvData()
 {
     if (!is_null($this->_list)) {
         $items = $this->_list->getItems();
         if (count($items) > 0) {
             $io = new Varien_Io_File();
             $path = Mage::getBaseDir('var') . DS . 'export' . DS;
             $name = md5(microtime());
             $file = $path . DS . $name . '.csv';
             $io->setAllowCreateFolders(true);
             $io->open(array('path' => $path));
             $io->streamOpen($file, 'w+');
             $io->streamLock(true);
             $headers = $this->_getCsvHeaders($items);
             $notAllowedValues = array("currency", "base_grand_total", "base_total_paid", "grand_total", "total_paid");
             foreach ($headers as $key => $value) {
                 if (in_array($value, $notAllowedValues)) {
                     unset($headers[$key]);
                 }
             }
             $io->streamWriteCsv($headers);
             foreach ($items as $payment) {
                 $data = $payment->getData();
                 unset($data['currency']);
                 unset($data['base_grand_total']);
                 unset($data['grand_total']);
                 unset($data['total_paid']);
                 unset($data['base_total_paid']);
                 $io->streamWriteCsv($data);
             }
             return array('type' => 'filename', 'value' => $file, 'rm' => true);
         }
     }
 }
开发者ID:sixg,项目名称:mkAnagh,代码行数:38,代码来源:Order.php


注:本文中的Varien_Io_File::streamOpen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。