Lengow_Export - Version 1.0.0

Version Notes

Version 1.0.0 stable

Download this release

Release Info

Developer Magento Core Team
Extension Lengow_Export
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/local/Lengow/Export/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Lengow_Export_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/local/Lengow/Export/controllers/IndexController.php ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Lengow_Export_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function IndexAction()
5
+ {
6
+ $this->GetHeader($this->getContent($_GET['format'],$_GET['storeID']),$_GET['format']);
7
+ }
8
+
9
+ protected function GetHeader($content, $format = 'csv', $contentType = 'text/plain', $contentLength = null)
10
+ {
11
+ if( ($format =='csv') || ($format =='txt'))
12
+ $contentType='text/plain';
13
+ elseif($format =='xml')
14
+ $contentType='text/xml';
15
+ else
16
+ exit();
17
+ $this->getResponse()
18
+ ->setHttpResponseCode(200)
19
+ ->setHeader('Pragma', 'public', true)
20
+ ->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true)
21
+ ->setHeader('Content-type', $contentType, true)
22
+ // ->setHeader('Content-Disposition', 'attachment; filename=test.xml')
23
+ ->setHeader('Content-Length', strlen($content))
24
+ ->setBody($content);
25
+ }
26
+
27
+ public function getContent($contentType = 'csv', $storeID = 0)
28
+ {
29
+ set_time_limit(0);
30
+ ini_set('display_errors', 1);
31
+ error_reporting(E_ALL ^ E_NOTICE);
32
+
33
+ require_once 'app/Mage.php';
34
+ Mage::app('default');
35
+ try
36
+ {
37
+ //---------------------- GET THE PRODUCTS
38
+ $products = Mage::getModel('catalog/product')->getCollection();
39
+ // $products
40
+ if($storeID != 0)
41
+ {
42
+ $products->addStoreFilter($storeID);
43
+ $products->joinAttribute('description', 'catalog_product/description', 'entity_id', null, 'inner', $storeID);
44
+ }
45
+ $products->addAttributeToFilter('status', 1);//enabled
46
+ $products->addAttributeToFilter('visibility', 4);//catalog, search
47
+ $products->addAttributeToSelect('*');
48
+ $prodIds=$products->getAllIds();
49
+
50
+ $product = Mage::getModel('catalog/product');
51
+
52
+ $heading = array('ID','WEIGHT','MANUFACTURER','NAME','DESCRIPTION','PRICE','PRICE_PROMO','PROMO_FROM','PROMO_TO','STOCK','QUANTITY','URL','IMAGE','FDP','CATEGORY');
53
+ if( ($contentType =='csv') || ($contentType =='txt'))
54
+ $feed_line=implode("|", $heading)."\r\n";
55
+ elseif($contentType =='xml')
56
+ $feed_line='<?xml version="1.0" encoding="utf-8"?>'.PHP_EOL.'<catalog>'.PHP_EOL;
57
+ else
58
+ exit();
59
+ $buffer = $feed_line;
60
+
61
+ foreach($prodIds as $productId)
62
+ {
63
+ $product->load($productId);
64
+ $weight = $product->getWeight();
65
+ $product_data = array();
66
+ $product_data['sku']=$product->getSku();
67
+ $product_data['weight']=$weight;
68
+ $product_data['brand']=$product->getResource()->getAttribute('manufacturer')->getFrontend()->getValue($product);
69
+ $product_data['title']=$product->getName();
70
+ $product_data['description']=$product->getDescription();
71
+ $product_data['price']=$product->getPrice();
72
+ $product_data['specialprice']=$product->getSpecialPrice();
73
+ $product_data['promo_from']=$product->getSpecialFromDate();
74
+ $product_data['promo_to']=$product->getSpecialToDate();
75
+ $product_data['availability']=$product->getStockItem()->getIsInStock();
76
+ $product_data['stock_descrip']=$product->getStockItem()->getQty();
77
+ $product_data['link']=$product->getProductUrl();
78
+ $product_data['image_link']=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).'catalog/product'.$product->getImage();
79
+ $product_data['shipping_rate']='voir site';
80
+
81
+ $product_type = '';
82
+ foreach($product->getCategoryIds() as $_categoryId)
83
+ {
84
+ $category = Mage::getModel('catalog/category')->load($_categoryId);
85
+ $product_type .= $category->getName().' > ';
86
+ }
87
+ $product_data['product_type']=rtrim($product_type,' > ');
88
+
89
+ foreach($product_data as $k=>$val)
90
+ {
91
+ $bad=array('"',"\r\n","\n","\r","\t");
92
+ $good=array(""," "," "," ","");
93
+ $product_data[$k] = '"'.str_replace($bad,$good,$val).'"';
94
+ }
95
+
96
+ if( ($contentType =='csv') || ($contentType =='txt'))
97
+ $feed_line = implode("|", $product_data)."\r\n";
98
+ elseif($contentType =='xml')
99
+ {
100
+ $feed_line = '<product> ';
101
+ foreach($product_data as $k=>$val)
102
+ {
103
+ $feed_line .= '<'.$k.'>![CDATA['.$val.']]</'.$k.'>'.PHP_EOL;
104
+ }
105
+ $feed_line .= '</product>'.PHP_EOL;
106
+ }
107
+ else
108
+ exit();
109
+ $buffer .= $feed_line;
110
+ }
111
+ if($contentType == 'xml')
112
+ $buffer .='</catalog>';
113
+ print $buffer;
114
+ }
115
+ catch(Exception $e)
116
+ {
117
+ die($e->getMessage());
118
+ }
119
+ }
120
+ }
app/code/local/Lengow/Export/etc/config.xml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Lengow_Export>
5
+ <version>1.0.0</version>
6
+ <depends>
7
+ <!-- no dependencies -->
8
+ </depends>
9
+ </Lengow_Export>
10
+ </modules>
11
+
12
+ <global>
13
+ <helpers>
14
+ <export>
15
+ <class>Lengow_Export_Helper</class>
16
+ </export>
17
+ </helpers>
18
+ </global>
19
+
20
+ <frontend>
21
+ <routers>
22
+ <export>
23
+ <use>standard</use>
24
+ <args>
25
+ <module>Lengow_Export</module>
26
+ <frontName>export</frontName>
27
+ </args>
28
+ </export>
29
+ </routers>
30
+ </frontend>
31
+ <adminhtml>
32
+ <acl>
33
+ <resources>
34
+ <all>
35
+ <title>Allow Everything</title>
36
+ </all>
37
+ <admin>
38
+ <children>
39
+ <system>
40
+ <children>
41
+ <config>
42
+ <children>
43
+ <export>
44
+ <title>LENGOW - Export Catalogue produit</title>
45
+ </export>
46
+ </children>
47
+ </config>
48
+ </children>
49
+ </system>
50
+ </children>
51
+ </admin>
52
+ </resources>
53
+ </acl>
54
+ </adminhtml>
55
+ </config>
app/code/local/Lengow/Export/etc/system.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <lengow translate="label" module="export">
5
+ <label>Solution Lengow</label>
6
+ <sort_order>100</sort_order>
7
+ </lengow>
8
+ </tabs>
9
+
10
+ <sections>
11
+ <export translate="label" module="export">
12
+ <label>Exportez votre Catalogue</label>
13
+ <tab>lengow</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>910</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <url translate="label">
21
+ <label>Exportez votre catalogue produits :</label>
22
+ <comment>
23
+ <![CDATA[<b>URL de votre catalogue produit :</b> <br /><br />
24
+ &bull; Format CSV : <span style="font-family:Courier;font-size:11px">http://www.votre-boutique.com/index.php/export/index?format=csv</span><br />
25
+ &bull; Format XML : <span style="font-family:Courier;font-size:11px">http://www.votre-boutique.com/index.php/export/index?format=xml</span><br />
26
+ <br />
27
+ <br />
28
+ <b>Multi Store :</b>
29
+ <br />
30
+ <br />
31
+ Dans le cas d'un multi store, vous pouvez exporter s&eacute;parement les catalogues en ajoutant la variable storeID &agrave; la fin de l'url catalogue, storeID correspondant &agrave; l'identifiant de votre store.
32
+ <br />exemple : <span style="font-family:Courier;font-size:11px">http://www.votre-boutique.com/index.php/export/index?format=csv<span style="color:red">&storeID=2</span></span>]]>
33
+ </comment>
34
+ <sort_order>200</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ </url>
38
+ </groups>
39
+ </export>
40
+ </sections>
41
+ </config>
app/code/local/Lengow/Information/Helper/Data.php ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+ class Lengow_Information_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ }
app/code/local/Lengow/Information/etc/config.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Lengow_Information>
5
+ <version>1.0.0</version>
6
+ <depends>
7
+ <!-- no dependencies -->
8
+ </depends>
9
+ </Lengow_Information>
10
+ </modules>
11
+ <global>
12
+ <helpers>
13
+ <information>
14
+ <class>Lengow_Information_Helper</class>
15
+ </information>
16
+ </helpers>
17
+ </global>
18
+
19
+ <adminhtml>
20
+ <acl>
21
+ <resources>
22
+ <all>
23
+ <title>Allow Everything</title>
24
+ </all>
25
+ <admin>
26
+ <children>
27
+ <system>
28
+ <children>
29
+ <config>
30
+ <children>
31
+ <information>
32
+ <title>LENGOW - Export Information</title>
33
+ </information>
34
+ </children>
35
+ </config>
36
+ </children>
37
+ </system>
38
+ </children>
39
+ </admin>
40
+ </resources>
41
+ </acl>
42
+ </adminhtml>
43
+ </config>
app/code/local/Lengow/Information/etc/system.xml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <lengow translate="label" module="information">
5
+ <label>Solution Lengow</label>
6
+ <sort_order>100</sort_order>
7
+ </lengow>
8
+ </tabs>
9
+
10
+ <sections>
11
+ <information translate="label" module="information">
12
+ <label>Informations Lengow</label>
13
+ <tab>lengow</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>110</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+ <groups>
20
+ <info translate="label">
21
+ <label>Informations :</label>
22
+ <comment>
23
+ <![CDATA[<b>Lengow</b> est une solution SaaS permettant &agrave; un e-commer&ccedil;ant d'optimiser ses catalogues produits vers les comparateurs de prix, r&eacute;gies d'affiliation mais aussi marketplaces et sites de Cashback.<br>
24
+ <br>Le principe est que la solution r&eacute;cup&egrave;re le catalogue produits du marchand, configure, optimise et tracke les informations des campagnes marchandes afin de restituer &agrave; l'e-commer&ccedil;ant les statistiques sous forme de tableaux de bords et graphiques.
25
+ <br>Ce processus permet aux e-commer&ccedil;ants d'optimiser leurs flux et leurs co&ucirc;ts d'acquisition sur chaque support de diffusion.
26
+ <br clear="all">
27
+ <br clear="all">
28
+ <a href="http://www.lengow.com" target="_blank"><img src="http://www.lengow.com/view/images/logo_transparant.png" alt="Solution Lengow" border="0"></a>
29
+ ]]>
30
+ </comment>
31
+ <sort_order>200</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ </info>
35
+ </groups>
36
+ </information>
37
+ </sections>
38
+ </config>
app/etc/modules/Lengow_All.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Lengow_Export>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Lengow_Export>
8
+ </modules>
9
+ <modules>
10
+ <Lengow_Information>
11
+ <active>true</active>
12
+ <codePool>local</codePool>
13
+ </Lengow_Information>
14
+ </modules>
15
+ </config>
app/locale/en_US/Lengow_Export.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ "Solution Lengow","Solution Lengow"
2
+ "Export your product catalog","Export your product catalog"
3
+ "URL of your Product Catalog","URL of your Product Catalog"
4
+ "Export your product catalog to Lengow.","Export your product catalog to Lengow."
app/locale/en_US/Lengow_Information.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ "Solution Lengow","Solution Lengow"
2
+ "Lengow Informations","Lengow Informations"
3
+ "Informations :","Informations :"
app/locale/fr_FR/Lengow_Export.csv ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ "Solution Lengow","Solution Lengow"
2
+ "Export your product catalog","Exportez votre Catalogue"
3
+ "URL of your Product Catalog","URL de votre catalogue produit"
4
+ "Export your product catalog to Lengow.","Exportez votre catalogue produits vers la solution Lengow."
app/locale/fr_FR/Lengow_Information.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ "Solution Lengow","Solution Lengow"
2
+ "Lengow Informations","Informations Lengow"
3
+ "Informations :","Informations :"
package.xml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Lengow_Export</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Ce module vous permettra d'exporter votre catalogue produits au format CSV ou XML &#xE0; destination de la solution Lengow afin de diffuser votre catalogue produits vers quelques 120 canaux possible.</summary>
10
+ <description>Lengow est une solution SaaS permettant &#xE0; un e-commer&#xE7;ant d'optimiser ses catalogues produits vers les comparateurs de prix, r&#xE9;gies d'affiliation mais aussi marketplaces et sites de Cashback.
11
+
12
+ Le principe est que la solution r&#xE9;cup&#xE8;re le catalogue produits du marchand, configure, optimise et tracke les informations des campagnes marchandes afin de restituer &#xE0; l'e-commer&#xE7;ant les statistiques sous forme de tableaux de bords et graphiques.
13
+ Ce processus permet aux e-commer&#xE7;ants d'optimiser leurs flux et leurs co&#xFB;ts d'acquisition sur chaque support de diffusion.</description>
14
+ <notes>Version 1.0.0 stable</notes>
15
+ <authors><author><name>Froger</name><user>auto-converted</user><email>mickael@mengow.com</email></author><author><name>Lengow</name><user>auto-converted</user><email>technique@lengow.com</email></author><author><name>Lengow</name><user>auto-converted</user><email>contact@lengow.com</email></author></authors>
16
+ <date>2010-03-15</date>
17
+ <time>09:43:22</time>
18
+ <contents><target name="magelocale"><dir name="en_US"><file name="Lengow_Export.csv" hash="abeaea80f731b4fa350091e0807cdbee"/><file name="Lengow_Information.csv" hash="86986a0717caed093e4178acf407f26c"/></dir><dir name="fr_FR"><file name="Lengow_Export.csv" hash="0bc75b767e6a51b07748f2362ff3f6f2"/><file name="Lengow_Information.csv" hash="cab993c6e862f67cef4a05229cbb2026"/></dir></target><target name="magelocal"><dir name="Lengow"><dir name="Export"><dir name="controllers"><file name="IndexController.php" hash="eeff7471a22a8d64aebb5b4ecb5cbac9"/></dir><dir name="etc"><file name="config.xml" hash="8210a1ad7fd08092b95a55de0498092c"/><file name="system.xml" hash="da7eb0bc7e16b26bae938a79fe4f5e05"/></dir><dir name="Helper"><file name="Data.php" hash="9bb8759af094885106efb1a53fe98b07"/></dir></dir><dir name="Information"><dir name="etc"><file name="config.xml" hash="c83d19a3acd4186b7b2ea4f92abc8104"/><file name="system.xml" hash="e16fa28f8249be84adf447c099adeb95"/></dir><dir name="Helper"><file name="Data.php" hash="8063a9cfe2cf944b1d1a6ac65a6b57d0"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Lengow_All.xml" hash="d212244e63e3d5dd55d33981a9d725bf"/></dir></target></contents>
19
+ <compatible/>
20
+ <dependencies/>
21
+ </package>