Version Notes
- Support for store specific data export
Download this release
Release Info
Developer | Digital Pianism |
Extension | DigitalPianism_ProductExport |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.2.0
- app/code/community/DigitalPianism/ProductExport/Model/Observer.php +1 -1
- app/code/community/DigitalPianism/ProductExport/Test/Config/Main.php +1 -1
- app/code/community/DigitalPianism/ProductExport/controllers/Adminhtml/ProductexportController.php +45 -6
- app/code/community/DigitalPianism/ProductExport/etc/config.xml +1 -1
- package.xml +5 -5
app/code/community/DigitalPianism/ProductExport/Model/Observer.php
CHANGED
@@ -12,7 +12,7 @@ class DigitalPianism_ProductExport_Model_Observer
|
|
12 |
|
13 |
$block->getMassactionBlock()->addItem('productexport', array(
|
14 |
'label' => 'Export to CSV',
|
15 |
-
'url' => $block->getUrl('adminhtml/productexport/massExport')
|
16 |
));
|
17 |
}
|
18 |
}
|
12 |
|
13 |
$block->getMassactionBlock()->addItem('productexport', array(
|
14 |
'label' => 'Export to CSV',
|
15 |
+
'url' => $block->getUrl('adminhtml/productexport/massExport',array('store' => Mage::app()->getRequest()->getParam('store')))
|
16 |
));
|
17 |
}
|
18 |
}
|
app/code/community/DigitalPianism/ProductExport/Test/Config/Main.php
CHANGED
@@ -12,7 +12,7 @@ class DigitalPianism_ProductExport_Test_Config_Main extends EcomDev_PHPUnit_Test
|
|
12 |
{
|
13 |
// Testing configuration
|
14 |
$this->assertModuleCodePool('local');
|
15 |
-
$this->assertModuleVersion("1.
|
16 |
$this->assertModuleDepends('Mage_Adminhtml');
|
17 |
}
|
18 |
|
12 |
{
|
13 |
// Testing configuration
|
14 |
$this->assertModuleCodePool('local');
|
15 |
+
$this->assertModuleVersion("1.2.0");
|
16 |
$this->assertModuleDepends('Mage_Adminhtml');
|
17 |
}
|
18 |
|
app/code/community/DigitalPianism/ProductExport/controllers/Adminhtml/ProductexportController.php
CHANGED
@@ -15,6 +15,7 @@ class DigitalPianism_ProductExport_Adminhtml_ProductexportController extends Mag
|
|
15 |
public function massExportAction()
|
16 |
{
|
17 |
$productIds = $this->getRequest()->getParam('product');
|
|
|
18 |
if (!is_array($productIds)) {
|
19 |
$this->_getSession()->addError($this->__('Please select product(s).'));
|
20 |
$this->_redirect('adminhtml/catalog_product/index');
|
@@ -23,13 +24,45 @@ class DigitalPianism_ProductExport_Adminhtml_ProductexportController extends Mag
|
|
23 |
//write headers to the csv file
|
24 |
$content = "id,name,url,sku,price,special_price\n";
|
25 |
try {
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
foreach ($collection as $product) {
|
32 |
-
$content .= "\"{$product->getId()}\",\"{$product->getName()}\",\"{$product->getProductUrl()}\",\"{$product->getSku()}\",\"{$product->getPrice()}\",\"{$product->getSpecialPrice()}\"\n";
|
33 |
}
|
34 |
} catch (Exception $e) {
|
35 |
$this->_getSession()->addError($e->getMessage());
|
@@ -39,4 +72,10 @@ class DigitalPianism_ProductExport_Adminhtml_ProductexportController extends Mag
|
|
39 |
}
|
40 |
|
41 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
}
|
15 |
public function massExportAction()
|
16 |
{
|
17 |
$productIds = $this->getRequest()->getParam('product');
|
18 |
+
$store = $this->_getStore();
|
19 |
if (!is_array($productIds)) {
|
20 |
$this->_getSession()->addError($this->__('Please select product(s).'));
|
21 |
$this->_redirect('adminhtml/catalog_product/index');
|
24 |
//write headers to the csv file
|
25 |
$content = "id,name,url,sku,price,special_price\n";
|
26 |
try {
|
27 |
+
|
28 |
+
$collection = Mage::getResourceModel('catalog/product_collection')
|
29 |
+
->addFieldToFilter('entity_id', array($productIds))
|
30 |
+
->addAttributeToSelect('entity_id')
|
31 |
+
->addAttributeToSelect('sku')
|
32 |
+
->addAttributeToSelect('product_url');
|
33 |
+
|
34 |
+
if ($store->getId()) {
|
35 |
+
$collection->addStoreFilter($store);
|
36 |
+
$collection->joinAttribute(
|
37 |
+
'name',
|
38 |
+
'catalog_product/name',
|
39 |
+
'entity_id',
|
40 |
+
null,
|
41 |
+
'inner',
|
42 |
+
$store->getId()
|
43 |
+
);
|
44 |
+
$collection->joinAttribute(
|
45 |
+
'price',
|
46 |
+
'catalog_product/price',
|
47 |
+
'entity_id',
|
48 |
+
null,
|
49 |
+
'left',
|
50 |
+
$store->getId()
|
51 |
+
);
|
52 |
+
$collection->joinAttribute(
|
53 |
+
'special_price',
|
54 |
+
'catalog_product/price',
|
55 |
+
'entity_id',
|
56 |
+
null,
|
57 |
+
'left',
|
58 |
+
$store->getId()
|
59 |
+
);
|
60 |
+
} else {
|
61 |
+
$collection->addAttributeToSelect(array('name','price','special_price'));
|
62 |
+
}
|
63 |
+
|
64 |
foreach ($collection as $product) {
|
65 |
+
$content .= "\"{$product->getId()}\",\"{$product->getName()}\",\"{$product->setStoreId($store->getId())->getProductUrl()}\",\"{$product->getSku()}\",\"{$product->getPrice()}\",\"{$product->getSpecialPrice()}\"\n";
|
66 |
}
|
67 |
} catch (Exception $e) {
|
68 |
$this->_getSession()->addError($e->getMessage());
|
72 |
}
|
73 |
|
74 |
}
|
75 |
+
|
76 |
+
protected function _getStore()
|
77 |
+
{
|
78 |
+
$storeId = (int) $this->getRequest()->getParam('store', 0);
|
79 |
+
return Mage::app()->getStore($storeId);
|
80 |
+
}
|
81 |
}
|
app/code/community/DigitalPianism/ProductExport/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<DigitalPianism_ProductExport>
|
5 |
-
<version>1.
|
6 |
</DigitalPianism_ProductExport>
|
7 |
</modules>
|
8 |
<global>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<DigitalPianism_ProductExport>
|
5 |
+
<version>1.2.0</version>
|
6 |
</DigitalPianism_ProductExport>
|
7 |
</modules>
|
8 |
<global>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>DigitalPianism_ProductExport</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
@@ -24,11 +24,11 @@
|
|
24 |

|
25 |
<p>Install the module manually or via Magento Connect</p>
|
26 |
<p>Then login to the backend and flush your cache</p></description>
|
27 |
-
<notes>-
|
28 |
<authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
|
29 |
-
<date>
|
30 |
-
<time>
|
31 |
-
<contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="ProductExport"><dir name="Model"><file name="Observer.php" hash="
|
32 |
<compatible/>
|
33 |
<dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
|
34 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>DigitalPianism_ProductExport</name>
|
4 |
+
<version>1.2.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
24 |

|
25 |
<p>Install the module manually or via Magento Connect</p>
|
26 |
<p>Then login to the backend and flush your cache</p></description>
|
27 |
+
<notes>- Support for store specific data export</notes>
|
28 |
<authors><author><name>Digital Pianism</name><user>digitalpianism</user><email>contact@digital-pianism.com</email></author></authors>
|
29 |
+
<date>2016-03-23</date>
|
30 |
+
<time>09:54:17</time>
|
31 |
+
<contents><target name="magecommunity"><dir name="DigitalPianism"><dir name="ProductExport"><dir name="Model"><file name="Observer.php" hash="8c252797bb368a36c0ac09afe55a5394"/></dir><dir name="Test"><dir name="Config"><file name="Main.php" hash="015b51901e97af52d641c088a4d799ce"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="ProductexportController.php" hash="efc22ee69391282e419f2138df2f55ca"/></dir></dir><dir name="etc"><file name="config.xml" hash="b8356f4331d01ef9d806f7171bf9feff"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="DigitalPianism_ProductExport.xml" hash="6cdbc2897d42c0d1d4d682ad613e244f"/></dir></target></contents>
|
32 |
<compatible/>
|
33 |
<dependencies><required><php><min>4.1.0</min><max>6.0.0</max></php></required></dependencies>
|
34 |
</package>
|