Here is the script I use:
//Magento export tier price of all product to csv
require_once 'app/Mage.php';
umask(0);
Mage::app('default');
header("Content-type:text/octect-stream");
header("Content-Disposition:attachment;filename=data.csv");
$tableName = Mage::getSingleton('core/resource')
->getTableName('catalog_product_entity_tier_price');
$storeId = Mage::app()->getStore()->getId();
$product = Mage::getModel('catalog/product');
$products = $product->getCollection()->addStoreFilter($storeId)->getAllIds();
$fieldname = array("store","websites","attribute_set","type","sku","name","tier_price_website","tier_price_customer_group","tier_price_qty","tier_price_price");
print stripslashes(implode(',',$fieldname)) . "\n";
foreach($products as $productid)
{
$existingTierPrice = $product ->load($productid)->tier_price;
$sku = $product->getSku();
$name = $product->getName();
foreach($existingTierPrice as $key=>$value)
{
$tierarray = array("admin","base","Default","simple",$sku,$name,"all","all",$value['price_qty'],$value['price']);
print stripslashes(implode(',',$tierarray)) . "\n";
}
}
Courtesy of http://developerafroz.blogspot.com/2011/05/magento-export-tier-price.html
So what happens when the order csv is run is the following.
- The action
Mage_Adminhtml_Sales_OrderController::exportCsvAction
is called,
- This creates a grid block with
$this->getLayout()->createBlock('adminhtml/sales_order_grid');
,
- This grid is then used to fill the csv in
Mage_Adminhtml_Block_Widget_Grid::_exportIterateCollection
What you could do is rewrite the admin controller or make your own controller and then use this in the admin section. Then instead of simply getting a complete sales order grid you can build the grid with the correct collection including the filters selected by the user.
Best Answer
That's in our backlog ( ticket: MAGETWO-4026 ). Would be great if you could give us a PR for that functionality.