function exportAction() { $this->checkVersion(); if (isset($_REQUEST['go'])) { if (isset($_REQUEST['format']) && 'csv' == $_REQUEST['format']) { header(sprintf('Content-Disposition: attachment;filename="vaf-export-%s.csv"', time())); $stream = fopen("php://output", 'w'); $sitemap = new Elite_Vafsitemap_Model_Sitemap_Product_GoogleBase($this->config()); $sitemap->csv($_GET['store'], $stream); exit; } else { $sitemap = new Elite_Vafsitemap_Model_Sitemap_Product_XML($this->config()); $size = $sitemap->productCount(); $files = array(); $chunkSize = 50000; $basePath = Mage::getBaseDir() . '/var/vaf-sitemap-xml'; if (file_exists($basePath)) { $this->recursiveDelete($basePath); } mkdir($basePath); for ($i = 0; $i <= $size; $i += $chunkSize) { $xml = $sitemap->xml($_GET['store'], $i == 0 ? 0 : $i + 1, $i + $chunkSize); $file = $basePath . '/' . floor($i / $chunkSize) . '.xml'; array_push($files, basename($file)); file_put_contents($file, $xml); } file_put_contents($basePath . '/sitemap-index.xml', $sitemap->sitemapIndex($files)); echo 'Sitemap created to ' . $basePath; exit; } } $this->loadLayout(); $this->_setActiveMenu('vaf/export'); $block = $this->getLayout()->createBlock('adminhtml/template', 'vafsitemap_export')->setTemplate('vf/vafsitemap/export.phtml'); $this->_addContent($block); $this->renderLayout(); }
* 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'; // Edit: set to store ID to run export for $storeId = 1; // DO NOT EDIT BELOW HERE $sitemap = new Elite_Vafsitemap_Model_Sitemap_Product_XML(); $size = $sitemap->fitmentCount($storeId); $files = array(); $chunkSize = 50000; $basePath = Mage::getBaseDir() . '/var/vaf-sitemap-xml'; @mkdir($basePath); for ($i = 0; $i <= $size; $i += $chunkSize) { $xml = $sitemap->xml($storeId, $i == 0 ? 0 : $i + 1, $i + $chunkSize); $file = $basePath . '/' . floor($i / $chunkSize) . '.xml'; array_push($files, basename($file)); file_put_contents($file, $xml); } file_put_contents($basePath . '/sitemap-index.xml', $sitemap->sitemapIndex($files)); echo 'Sitemap created to ' . $basePath; exit;