function main() { $stream = fopen("php://output", 'w'); $exporter = new VF_Import_ProductFitments_CSV_Export(); $exporter->setProductTable($this->opt->getOption('product-table')); $exporter->export($stream); }
function indexAction() { if (isset($_GET['go'])) { $stream = fopen("php://output", 'w'); $exporter = new \VF_Import_ProductFitments_CSV_Export(); $shoppingCartEnvironment = $this->shoppingCartEnvironment(); $dbInfo = $shoppingCartEnvironment->databaseDetails(); $exporter->setProductTable($dbInfo['product_table'])->setProductSkuField($dbInfo['product_sku_field'])->setProductIdField($dbInfo['product_id_field']); header(sprintf('Content-Disposition: attachment;filename="vaf-export-%s.csv"', time())); header('Content-Type: text/csv'); $exporter->export($stream); exit; } }
function testExport() { $stream = fopen("php://temp", 'w'); $exporter = new VF_Import_ProductFitments_CSV_Export(); $exporter->setProductTable('test_catalog_product_entity'); $exporter->export($stream); rewind($stream); $data = stream_get_contents($stream); $output = explode("\n", $data); $this->assertEquals('sku,universal,make,model,year,notes', $output[0]); $this->assertEquals('sku123,0,honda,civic,2001,""', $output[1]); $this->assertEquals('sku456,0,honda,civic,2000,""', $output[2]); $this->assertEquals('sku456,0,acura,integra,2000,""', $output[3]); $this->assertEquals('sku123,0,acura,integra,2004,""', $output[4]); $this->assertEquals('sku123,0,acura,test,2002,""', $output[5]); }
function mappingsexportAction() { $this->checkVersion(); if (isset($_GET['go'])) { header(sprintf('Content-Disposition: attachment;filename="vaf-export-%s.csv"', time())); header('Content-Type: text/csv'); $stream = fopen("php://output", 'w'); $exporter = new VF_Import_ProductFitments_CSV_Export(); $exporter->export($stream); exit; } $this->loadLayout(); $this->_setActiveMenu('vaf/export'); $block = $this->getLayout()->createBlock('core/template')->setTemplate('vf/vafimporter/mappings_export.phtml'); $this->_addContent($block); $this->renderLayout(); }
<?php /** * Vehicle Fits * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to sales@vehiclefits.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Vehicle Fits to newer * versions in the future. If you wish to customize Vehicle Fits for your * needs please refer to http://www.vehiclefits.com for more information. * @copyright Copyright (c) 2013 Vehicle Fits, llc * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ require_once 'config.php'; $stream = fopen("php://output", 'w'); $exporter = new VF_Import_ProductFitments_CSV_Export(); $exporter->export($stream);