Version Notes
Magento 1.5 version.
Download this release
Release Info
Developer | Antonio Martinez |
Extension | AMartinez_CustomImportExport |
Version | 1.5.005 |
Comparing to | |
See all releases |
Code changes from version 1.5.004 to 1.5.005
- app/code/community/AMartinez/CustomImportExport/Model/Export.php +29 -0
- app/code/community/AMartinez/CustomImportExport/Model/Import/Entity/Product.php +2 -1
- app/code/community/AMartinez/CustomImportExport/etc/config.xml +3 -2
- app/code/community/AMartinez/CustomImportExport/shell/run.php +180 -71
- package.xml +37 -18
- var/customimportexport/productsexport.csv +19 -0
app/code/community/AMartinez/CustomImportExport/Model/Export.php
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Magento
|
4 |
+
*
|
5 |
+
* @category AMartinez
|
6 |
+
* @package AMartinez_CustomImportExport
|
7 |
+
* @author Antonio Martinez
|
8 |
+
* @copyright Copyright (c) 2011 Antonio Martínez (toniyecla@gmail.com)
|
9 |
+
* @license http://opensource.org/licenses/osl-3.0 Open Software License (OSL 3.0)
|
10 |
+
*/
|
11 |
+
|
12 |
+
/**
|
13 |
+
* Export model
|
14 |
+
*
|
15 |
+
*/
|
16 |
+
class AMartinez_CustomImportExport_Model_Export extends Mage_ImportExport_Model_Export
|
17 |
+
{
|
18 |
+
/**
|
19 |
+
* Export data.
|
20 |
+
*
|
21 |
+
* @return string
|
22 |
+
*/
|
23 |
+
public function export()
|
24 |
+
{
|
25 |
+
return $this->_getEntityAdapter()
|
26 |
+
->setWriter($this->_getWriter())
|
27 |
+
->export();
|
28 |
+
}
|
29 |
+
}
|
app/code/community/AMartinez/CustomImportExport/Model/Import/Entity/Product.php
CHANGED
@@ -65,7 +65,8 @@ class AMartinez_CustomImportExport_Model_Import_Entity_Product extends Mage_Impo
|
|
65 |
$val = trim($rowData[$attrCode]);
|
66 |
$valid = strtotime($val)
|
67 |
|| preg_match('/^\d{2}.\d{2}.\d{2,4}(?:\s+\d{1,2}.\d{1,2}(?:.\d{1,2})?)?$/', $val)
|
68 |
-
|| $val == "
|
|
|
69 |
break;
|
70 |
case 'text':
|
71 |
$val = Mage::helper('core/string')->cleanString($rowData[$attrCode]);
|
65 |
$val = trim($rowData[$attrCode]);
|
66 |
$valid = strtotime($val)
|
67 |
|| preg_match('/^\d{2}.\d{2}.\d{2,4}(?:\s+\d{1,2}.\d{1,2}(?:.\d{1,2})?)?$/', $val)
|
68 |
+
|| $val == "1970-01-01 00:00:00" // php null date
|
69 |
+
|| $val == "1899-12-31"; // firebird null date
|
70 |
break;
|
71 |
case 'text':
|
72 |
$val = Mage::helper('core/string')->cleanString($rowData[$attrCode]);
|
app/code/community/AMartinez/CustomImportExport/etc/config.xml
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
|
15 |
<modules>
|
16 |
<AMartinez_CustomImportExport>
|
17 |
-
<version>1.5.
|
18 |
<depends>
|
19 |
<!-- no dependencies -->
|
20 |
</depends>
|
@@ -58,7 +58,8 @@
|
|
58 |
<default>
|
59 |
<customimportexport>
|
60 |
<products>
|
61 |
-
<
|
|
|
62 |
</products>
|
63 |
</customimportexport>
|
64 |
</default>
|
14 |
|
15 |
<modules>
|
16 |
<AMartinez_CustomImportExport>
|
17 |
+
<version>1.5.005</version>
|
18 |
<depends>
|
19 |
<!-- no dependencies -->
|
20 |
</depends>
|
58 |
<default>
|
59 |
<customimportexport>
|
60 |
<products>
|
61 |
+
<sourcefile>var/customimportexport/productsimport.csv</sourcefile>
|
62 |
+
<outputfile>var/customimportexport/productsexport.csv</outputfile>
|
63 |
</products>
|
64 |
</customimportexport>
|
65 |
</default>
|
app/code/community/AMartinez/CustomImportExport/shell/run.php
CHANGED
@@ -22,48 +22,77 @@ class AMartinez_CustomImportExport extends Mage_Shell_Abstract
|
|
22 |
*/
|
23 |
public function run()
|
24 |
{
|
25 |
-
|
26 |
ini_set('display_errors', 1);
|
27 |
// ini_set("memory_limit","2048M");
|
28 |
|
29 |
-
$
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
$import = $this->processData();
|
34 |
-
$validationResult = $import->validateSource($file);
|
35 |
-
$processedRowsCount = $import->getProcessedRowsCount();
|
36 |
-
|
37 |
-
if ($processedRowsCount > 0)
|
38 |
{
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
{
|
42 |
-
if
|
|
|
43 |
{
|
44 |
-
$
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
48 |
}
|
49 |
-
|
50 |
-
|
51 |
-
if (!$validationResult)
|
52 |
-
{
|
53 |
-
$message = sprintf("File %s contains %s corrupt records (from a total of %s)",
|
54 |
-
$file, $import->getInvalidRowsCount(), $processedRowsCount
|
55 |
-
);
|
56 |
-
foreach ($import->getErrors() as $type => $lines)
|
57 |
{
|
58 |
-
$message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
67 |
if ($this->getArg('r') || $this->getArg('reindex'))
|
68 |
{
|
69 |
echo "Reindexing data...\n";
|
@@ -74,6 +103,7 @@ class AMartinez_CustomImportExport extends Mage_Shell_Abstract
|
|
74 |
catch (Exception $e) {}
|
75 |
}
|
76 |
|
|
|
77 |
if ($this->getArg('c') || $this->getArg('cleancache'))
|
78 |
{
|
79 |
echo "Cleaning cache...\n";
|
@@ -84,6 +114,7 @@ class AMartinez_CustomImportExport extends Mage_Shell_Abstract
|
|
84 |
catch (Exception $e) {}
|
85 |
}
|
86 |
|
|
|
87 |
if ($this->getArg('f') || $this->getArg('flushimages'))
|
88 |
{
|
89 |
echo "Erasing catalog images cache...\n";
|
@@ -94,6 +125,7 @@ class AMartinez_CustomImportExport extends Mage_Shell_Abstract
|
|
94 |
catch (Exception $e) {}
|
95 |
}
|
96 |
|
|
|
97 |
if ($this->getArg('p') || $this->getArg('applyrules'))
|
98 |
{
|
99 |
echo "Recalculating catalog price rules...\n";
|
@@ -105,58 +137,113 @@ class AMartinez_CustomImportExport extends Mage_Shell_Abstract
|
|
105 |
}
|
106 |
}
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
/**
|
109 |
* Return the specified source file
|
110 |
*
|
111 |
* @return string
|
112 |
*/
|
113 |
-
public function
|
114 |
{
|
115 |
-
|
|
|
|
|
116 |
{
|
117 |
-
if(
|
118 |
-
return $file;
|
119 |
-
}
|
120 |
-
else
|
121 |
{
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
|
|
129 |
}
|
130 |
-
|
131 |
{
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
139 |
}
|
140 |
else
|
141 |
{
|
142 |
-
echo "
|
143 |
}
|
144 |
}
|
145 |
-
die($this->usageHelp());
|
146 |
}
|
147 |
|
148 |
/**
|
149 |
-
* Initialize
|
150 |
*
|
151 |
-
* @return
|
152 |
*/
|
153 |
-
public function
|
154 |
{
|
155 |
-
$
|
156 |
-
$
|
157 |
-
$
|
158 |
|
159 |
-
return $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
|
162 |
/**
|
@@ -165,8 +252,7 @@ class AMartinez_CustomImportExport extends Mage_Shell_Abstract
|
|
165 |
public function usageHelp()
|
166 |
{
|
167 |
return <<<HELP
|
168 |
-
|
169 |
-
AMartinez_CustomImportExport script (v. 1.5.004)
|
170 |
|
171 |
NAME
|
172 |
run.php
|
@@ -176,20 +262,43 @@ SYNOPSIS
|
|
176 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php [-- [OPTIONS...]]
|
177 |
|
178 |
DESCRIPTION
|
179 |
-
Import products to
|
180 |
-
(more options soon...)
|
181 |
|
182 |
OPTIONS
|
183 |
-
-
|
184 |
-
-
|
185 |
-
|
186 |
-
|
187 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
|
189 |
EXAMPLES
|
190 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -source var/importexport/products.csv
|
191 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -reindex
|
192 |
-
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -
|
|
|
|
|
193 |
|
194 |
|
195 |
HELP;
|
22 |
*/
|
23 |
public function run()
|
24 |
{
|
25 |
+
Mage::setIsDeveloperMode(true);
|
26 |
ini_set('display_errors', 1);
|
27 |
// ini_set("memory_limit","2048M");
|
28 |
|
29 |
+
$import = $this->initImportModel();
|
30 |
+
|
31 |
+
// help
|
32 |
+
if ($this->getArg('h') || $this->getArg('help') || count($this->_args) == 0)
|
|
|
|
|
|
|
|
|
|
|
33 |
{
|
34 |
+
die($this->usageHelp());
|
35 |
+
}
|
36 |
+
|
37 |
+
// import
|
38 |
+
if ($file = $this->getSourceFile()) {
|
39 |
+
echo "Start import from source file $file\n";
|
40 |
+
Mage::log("Start import from source file $file", Zend_Log::DEBUG);
|
41 |
+
|
42 |
+
$validationResult = $import->validateSource($file);
|
43 |
+
$processedRowsCount = $import->getProcessedRowsCount();
|
44 |
+
|
45 |
+
if ($processedRowsCount > 0)
|
46 |
{
|
47 |
+
// if type 'select' attribute options added, revalidate source (not necessary for categories)
|
48 |
+
foreach ($import->getErrors() as $type => $lines)
|
49 |
{
|
50 |
+
if (strpos($type, "added"))
|
51 |
+
{
|
52 |
+
$import = $this->initImportModel();
|
53 |
+
$validationResult = $import->validateSource($file);
|
54 |
+
$processedRowsCount = $import->getProcessedRowsCount();
|
55 |
+
break;
|
56 |
+
}
|
57 |
}
|
58 |
+
|
59 |
+
if (!$validationResult)
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
{
|
61 |
+
$message = sprintf("File %s contains %s corrupt records (from a total of %s)",
|
62 |
+
$file, $import->getInvalidRowsCount(), $processedRowsCount
|
63 |
+
);
|
64 |
+
foreach ($import->getErrors() as $type => $lines)
|
65 |
+
{
|
66 |
+
$message .= "\n:::: " . $type . " ::::\nIn Line(s) " . implode(", ", $lines) . "\n";
|
67 |
+
}
|
68 |
+
Mage::throwException($message);
|
69 |
}
|
70 |
+
|
71 |
+
$import->importSource();
|
72 |
+
}
|
73 |
+
echo "Done (processed rows count: " . $processedRowsCount . ")\n";
|
74 |
+
}
|
75 |
+
|
76 |
+
// export
|
77 |
+
if ($file = $this->getOutputFile()) {
|
78 |
+
echo "Start output to file $file\n";
|
79 |
+
Mage::log("Start output to file $file", Zend_Log::DEBUG);
|
80 |
+
|
81 |
+
$export = $this->initExportModel();
|
82 |
+
if ($f = fopen($file, 'w'))
|
83 |
+
{
|
84 |
+
$result = $export->export();
|
85 |
+
fwrite($f, $result);
|
86 |
+
fclose($f);
|
87 |
+
echo "Done (processed rows count: " . substr_count($result, "\n") . ")\n";
|
88 |
}
|
89 |
+
else
|
90 |
+
{
|
91 |
+
echo "Cannot output to file $file\n";
|
92 |
+
};
|
93 |
+
}
|
94 |
+
|
95 |
+
// index
|
96 |
if ($this->getArg('r') || $this->getArg('reindex'))
|
97 |
{
|
98 |
echo "Reindexing data...\n";
|
103 |
catch (Exception $e) {}
|
104 |
}
|
105 |
|
106 |
+
// cache
|
107 |
if ($this->getArg('c') || $this->getArg('cleancache'))
|
108 |
{
|
109 |
echo "Cleaning cache...\n";
|
114 |
catch (Exception $e) {}
|
115 |
}
|
116 |
|
117 |
+
// image files
|
118 |
if ($this->getArg('f') || $this->getArg('flushimages'))
|
119 |
{
|
120 |
echo "Erasing catalog images cache...\n";
|
125 |
catch (Exception $e) {}
|
126 |
}
|
127 |
|
128 |
+
// price rules
|
129 |
if ($this->getArg('p') || $this->getArg('applyrules'))
|
130 |
{
|
131 |
echo "Recalculating catalog price rules...\n";
|
137 |
}
|
138 |
}
|
139 |
|
140 |
+
/**
|
141 |
+
* Initialize import model
|
142 |
+
*
|
143 |
+
* @return AMartinez_CustomImportExport_Model_Import
|
144 |
+
*/
|
145 |
+
public function initImportModel()
|
146 |
+
{
|
147 |
+
$import = Mage::getModel('customimportexport/import');
|
148 |
+
$import->setEntity('catalog_product');
|
149 |
+
$import->setBehavior('replace');
|
150 |
+
|
151 |
+
return $import;
|
152 |
+
}
|
153 |
+
|
154 |
/**
|
155 |
* Return the specified source file
|
156 |
*
|
157 |
* @return string
|
158 |
*/
|
159 |
+
public function getSourceFile()
|
160 |
{
|
161 |
+
$option1 = $this->getArg('i');
|
162 |
+
$option2 = $this->getArg('import');
|
163 |
+
if ($option1 || $option2)
|
164 |
{
|
165 |
+
if ($option1 && $option1 != 1)
|
|
|
|
|
|
|
166 |
{
|
167 |
+
if (file_exists($option1))
|
168 |
+
{
|
169 |
+
return $option1;
|
170 |
+
}
|
171 |
+
else
|
172 |
+
{
|
173 |
+
echo "Skipping source file $option1\n";
|
174 |
+
}
|
175 |
}
|
176 |
+
if ($option2 && $option2 != 1)
|
177 |
{
|
178 |
+
if (file_exists($option2))
|
179 |
+
{
|
180 |
+
return $option2;
|
181 |
+
}
|
182 |
+
else
|
183 |
+
{
|
184 |
+
echo "Skipping source file $option2\n";
|
185 |
+
}
|
186 |
}
|
187 |
+
if ($default = Mage::getStoreConfig('customimportexport/products/sourcefile'))
|
188 |
+
{
|
189 |
+
if(file_exists($default))
|
190 |
+
{
|
191 |
+
return $default;
|
192 |
+
}
|
193 |
+
else
|
194 |
+
{
|
195 |
+
echo "Skipping default source file $default\n";
|
196 |
+
}
|
197 |
}
|
198 |
else
|
199 |
{
|
200 |
+
echo "No default source file found in config.xml\n";
|
201 |
}
|
202 |
}
|
|
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
+
* Initialize export model
|
207 |
*
|
208 |
+
* @return AMartinez_CustomImportExport_Model_Export
|
209 |
*/
|
210 |
+
public function initExportModel()
|
211 |
{
|
212 |
+
$export = Mage::getModel('customimportexport/export');
|
213 |
+
$export->setEntity('catalog_product');
|
214 |
+
$export->setData('file_format', 'csv');
|
215 |
|
216 |
+
return $export;
|
217 |
+
}
|
218 |
+
|
219 |
+
/**
|
220 |
+
* Return the specified output file
|
221 |
+
*
|
222 |
+
* @return string
|
223 |
+
*/
|
224 |
+
public function getOutputFile()
|
225 |
+
{
|
226 |
+
$option1 = $this->getArg('e');
|
227 |
+
$option2 = $this->getArg('export');
|
228 |
+
if ($option1 || $option2)
|
229 |
+
{
|
230 |
+
if ($option1 && $option1 != 1)
|
231 |
+
{
|
232 |
+
return $option1;
|
233 |
+
}
|
234 |
+
if ($option2 && $option2 != 1)
|
235 |
+
{
|
236 |
+
return $option2;
|
237 |
+
}
|
238 |
+
if ($default = Mage::getStoreConfig('customimportexport/products/outputfile'))
|
239 |
+
{
|
240 |
+
return $default;
|
241 |
+
}
|
242 |
+
else
|
243 |
+
{
|
244 |
+
echo "No default output file found in config.xml\n";
|
245 |
+
}
|
246 |
+
}
|
247 |
}
|
248 |
|
249 |
/**
|
252 |
public function usageHelp()
|
253 |
{
|
254 |
return <<<HELP
|
255 |
+
AMartinez_CustomImportExport script (v. 1.5.005)
|
|
|
256 |
|
257 |
NAME
|
258 |
run.php
|
262 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php [-- [OPTIONS...]]
|
263 |
|
264 |
DESCRIPTION
|
265 |
+
Import/Export products from/to CSV file. Create categories, add attribute options, reindex, refresh cache, images and price rules automatically.
|
|
|
266 |
|
267 |
OPTIONS
|
268 |
+
-h
|
269 |
+
-help
|
270 |
+
print this usage and exit
|
271 |
+
|
272 |
+
-c
|
273 |
+
-cleancache
|
274 |
+
clean cache storage (html output, etc)
|
275 |
+
|
276 |
+
-e <file>
|
277 |
+
-export <file>
|
278 |
+
output products to csv file, if output file not specified uses defined in config.xml
|
279 |
+
|
280 |
+
-i <file>
|
281 |
+
-import <file>
|
282 |
+
import products from csv file, if source file not specified or not found uses defined in config.xml
|
283 |
+
|
284 |
+
-f
|
285 |
+
-flushimages
|
286 |
+
flush catalog images cache
|
287 |
+
|
288 |
+
-p
|
289 |
+
-applyrules
|
290 |
+
recalculate catalog price rules
|
291 |
+
|
292 |
+
-r
|
293 |
+
-reindex
|
294 |
+
reindex data by all indexers (attributes, prices, etc)
|
295 |
|
296 |
EXAMPLES
|
297 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -source var/importexport/products.csv
|
298 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -reindex
|
299 |
+
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -c -f -p -r -i var/importexport/products.csv
|
300 |
+
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -export
|
301 |
+
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -e var/importexport/products.csv
|
302 |
|
303 |
|
304 |
HELP;
|
package.xml
CHANGED
@@ -1,20 +1,22 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AMartinez_CustomImportExport</name>
|
4 |
-
<version>1.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Import products to Magento database from CSV file, creating categories and attribute options automatically.</summary>
|
10 |
-
<description>This extension can
|
11 |

|
12 |
-
It extends Mage_ImportExport class
|
13 |

|
14 |
-
|
15 |
-
|
|
|
16 |

|
17 |
-
|
|
|
18 |

|
19 |
To daily automatize imports, you must call "run.php" via crontab or similar.
|
20 |

|
@@ -24,31 +26,48 @@ USE:
|
|
24 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php [-- [OPTIONS...]]
|
25 |

|
26 |
OPTIONS
|
|
|
|
|
|
|
27 |

|
28 |
-
-
|
|
|
|
|
29 |

|
30 |
-
-
|
|
|
|
|
31 |

|
32 |
-
-
|
|
|
|
|
33 |

|
34 |
-
-f
|
|
|
|
|
35 |

|
36 |
-
-p
|
|
|
|
|
37 |

|
38 |
-
|
|
|
|
|
39 |

|
|
|
40 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -source var/importexport/products.csv
|
41 |
-

|
42 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -reindex
|
|
|
|
|
|
|
43 |

|
44 |
-
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -s var/importexport/products.csv -r -c -f -p
|
45 |

|
46 |
More options is coming soon!</description>
|
47 |
-
<notes>Magento 1.5 version
|
48 |
<authors><author><name>Antonio Martinez</name><user>amartinez</user><email>toniyecla@gmail.com</email></author></authors>
|
49 |
-
<date>2011-
|
50 |
-
<time>
|
51 |
-
<contents><target name="magecommunity"><dir name="AMartinez"><dir name="CustomImportExport"><dir name="Helper"><file name="Data.php" hash="0c8b64920ba9cf893513573bbbb55549"/></dir><dir name="Model"><dir name="Import"><dir name="Adapter"><file name="Csv1.php" hash="fa713ee0bc9034befd91eee758fc2d0a"/></dir><file name="Adapter.php" hash="6d7d568cc3dfe002763638513bc04b7f"/><dir name="Entity"><dir name="Product"><dir name="Type"><file name="Configurable.php" hash="3614bf1abe10bb500219c787c2a6ebcc"/><file name="Grouped.php" hash="b7c054303353d88e5d0c9fd303670ef5"/><file name="Simple.php" hash="48cdfdfc5c2e42b011e83483f50690c4"/></dir></dir><file name="Product.php" hash="
|
52 |
<compatible/>
|
53 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
54 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>AMartinez_CustomImportExport</name>
|
4 |
+
<version>1.5.005</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://opensource.org/licenses/osl-3.0">OSL v3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Import products to Magento database from CSV file, creating categories and attribute options automatically.</summary>
|
10 |
+
<description>This extension can Import/Export products from/to CSV file. Create categories, add attribute options, reindex, refresh cache, images and price rules automatically.
|
11 |

|
12 |
+
It extends Mage_ImportExport class, so it is the most SCALABLE, SAFER and FASTER method exists.
|
13 |

|
14 |
+
Imports:
|
15 |
+
with extension .csv: multiple-row new csv files
|
16 |
+
with extension .csv1: previous single-row with multiple values csv files ..."CAT1,CAT2,CAT3","ASSOCIATED1,ASSOCIATED2"...
|
17 |

|
18 |
+
Exports: 
|
19 |
+
with extension .csv: multiple-row new csv files
|
20 |

|
21 |
To daily automatize imports, you must call "run.php" via crontab or similar.
|
22 |

|
26 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php [-- [OPTIONS...]]
|
27 |

|
28 |
OPTIONS
|
29 |
+
-h
|
30 |
+
-help
|
31 |
+
print this usage and exit
|
32 |

|
33 |
+
-c
|
34 |
+
-cleancache
|
35 |
+
clean cache storage (html output, etc)
|
36 |

|
37 |
+
-e <file>
|
38 |
+
-export <file>
|
39 |
+
output products to csv file, if output file not specified uses defined in config.xml
|
40 |

|
41 |
+
-i <file>
|
42 |
+
-import <file>
|
43 |
+
import products from csv file, if source file not specified or not found uses defined in config.xml
|
44 |

|
45 |
+
-f
|
46 |
+
-flushimages
|
47 |
+
flush catalog images cache
|
48 |

|
49 |
+
-p
|
50 |
+
-applyrules
|
51 |
+
recalculate catalog price rules
|
52 |

|
53 |
+
-r
|
54 |
+
-reindex
|
55 |
+
reindex data by all indexers (attributes, prices, etc)
|
56 |

|
57 |
+
EXAMPLES
|
58 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -source var/importexport/products.csv
|
|
|
59 |
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -reindex
|
60 |
+
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -c -f -p -r -i var/importexport/products.csv
|
61 |
+
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -export
|
62 |
+
php -f app/code/community/AMartinez/CustomImportExport/shell/run.php -- -e var/importexport/products.csv
|
63 |

|
|
|
64 |

|
65 |
More options is coming soon!</description>
|
66 |
+
<notes>Magento 1.5 version.</notes>
|
67 |
<authors><author><name>Antonio Martinez</name><user>amartinez</user><email>toniyecla@gmail.com</email></author></authors>
|
68 |
+
<date>2011-05-05</date>
|
69 |
+
<time>11:35:43</time>
|
70 |
+
<contents><target name="magecommunity"><dir name="AMartinez"><dir name="CustomImportExport"><dir name="Helper"><file name="Data.php" hash="0c8b64920ba9cf893513573bbbb55549"/></dir><dir name="Model"><file name="Export.php" hash="010ef7eb6564b48a721dd32b0ee4c3e8"/><dir name="Import"><dir name="Adapter"><file name="Csv1.php" hash="fa713ee0bc9034befd91eee758fc2d0a"/></dir><file name="Adapter.php" hash="6d7d568cc3dfe002763638513bc04b7f"/><dir name="Entity"><dir name="Product"><dir name="Type"><file name="Configurable.php" hash="3614bf1abe10bb500219c787c2a6ebcc"/><file name="Grouped.php" hash="b7c054303353d88e5d0c9fd303670ef5"/><file name="Simple.php" hash="48cdfdfc5c2e42b011e83483f50690c4"/></dir></dir><file name="Product.php" hash="1a4bd575430a4e10af00045dc5c84fa9"/></dir></dir><file name="Import.php" hash="ac94315dc71c43dcbbd49146e4714723"/></dir><dir name="etc"><file name="config.xml" hash="4d6bd194380dbc4a5eb14c67c2ae1c56"/></dir><dir name="shell"><file name="run.php" hash="c90eb33d5a7bdc88184ef57967299d7b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="AMartinez_CustomImportExport.xml" hash="75ba4fbc265d1cf2b6ab61b8f3a3b95e"/></dir></target><target name="mage"><dir name="var"><dir name="customimportexport"><file name="productsexport.csv" hash="be786ce510a058241f16c17353efba47"/><file name="test_configurable.csv" hash="da1cb8fea77cc7ee591e3488d12ca6d8"/><file name="test_grouped.csv" hash="1281612b7e89e4681367e654631b2521"/><file name="test_single_row_style.csv1" hash="dfcd266cb65ab97e93f9402e4f32bffb"/></dir></dir></target></contents>
|
71 |
<compatible/>
|
72 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
73 |
</package>
|
var/customimportexport/productsexport.csv
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
sku,_store,_attribute_set,_type,_category,_product_websites,color,cost,created_at,custom_design,custom_design_from,custom_design_to,custom_layout_update,delivery_date,description,enable_googlecheckout,gallery,genero,gift_message_available,has_options,image,image_label,is_imported,manufacturer,media_gallery,meta_description,meta_keyword,meta_title,minimal_price,name,news_from_date,news_to_date,options_container,page_layout,price,required_options,short_description,size,small_image,small_image_label,special_from_date,special_price,special_to_date,status,tax_class_id,thumbnail,thumbnail_label,tipo_articulo,updated_at,url_key,url_path,visibility,weight,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,use_config_qty_increments,qty_increments,use_config_enable_qty_increments,enable_qty_increments,_links_related_sku,_links_related_position,_links_crosssell_sku,_links_crosssell_position,_links_upsell_sku,_links_upsell_position,_associated_sku,_associated_default_qty,_associated_position,_tier_price_website,_tier_price_customer_group,_tier_price_qty,_tier_price_price
|
2 |
+
test_1,,Default,simple,MALICIA,base,,,"2011-03-04 12:43:37",,,,,,testeando,1,,,,0,/m/_/m.373-r2_1.jpg,,No,,,,,,,"Test 1","2011-03-02 00:00:00",,"Block after Info Column",,10.0000,0,"test 1",,/m/_/m.373-r2_1.jpg,,,,,1,0,/m/_/m.373-r2_1.jpg,,,"2011-03-14 16:04:40",test-1,test-1.html,4,1.0000,100.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,0,1,1,0.0000,1,0,,,,,,,,,,,,,
|
3 |
+
,,,,"DARK METAL",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
4 |
+
test_2,,Default,simple,MALICIA,base,,,"2011-03-04 12:45:48",,,,,,testeando2,1,,,,0,/m/_/m.1468-s1_2.jpg,,No,,,,,,,Test2,"2011-03-09 00:00:00",,"Block after Info Column",,10.0000,0,test2,,/m/_/m.1468-s1_2.jpg,,,,,1,0,/m/_/m.1468-s1_2.jpg,,,"2011-03-14 16:04:21",test2,test2.html,4,2.0000,100.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,0,1,1,0.0000,1,0,,,,,,,,,,,,,
|
5 |
+
,,,,"DARK METAL",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
6 |
+
test,,Default,grouped,MALICIA,base,,,"2011-03-04 12:47:07",,,,,,test,1,,,,0,/m/_/m.punk001-c11_2.jpg,,No,,,,,,,test,"2011-03-04 00:00:00",,"Block after Info Column",,,0,test,,/m/_/m.punk001-c11_2.jpg,,,,,1,,/m/_/m.punk001-c11_2.jpg,,,"2011-03-04 15:49:35",test,test.html,4,,0.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,,1,0,1,1,0.0000,1,0,,,,,,,,,,,,,
|
7 |
+
,,,,"DARK METAL",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
8 |
+
ARMY1-S1-37,,Default,simple,"ARMY COLLECTION",base,,,"2011-03-14 11:30:44",,,,,,"blah blah",1,,,,0,,,,,,,,,,"ARMY1-S1 (37)","2011-03-09 00:00:00",,"Block after Info Column",,43.9000,0,"ARMY COLLECTION",,,,,,,1,0,,,Shoes,"2011-03-14 11:30:44",army1-s1-37,army1-s1-37.html,4,1.1000,999.0000,0.0000,1,0,0,1,1.0000,1,10000.0000,1,1,1.0000,1,1,1,1,0.0000,1,0,,,,,,,,,,,,,
|
9 |
+
test_10,,Default,simple,MALICIA,base,,,"2011-03-14 15:58:41",,,,,,testeando,1,,,,0,no_selection,,No,,,,,,,"Test 1","2011-03-05 00:00:00",,"Block after Info Column",,10.0000,0,"test 1",,no_selection,,,,,1,0,no_selection,,,"2011-03-14 16:02:55",test-1,test-2.html,4,1.0000,100.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,0.0000,1,0,1,1,0.0000,1,0,,,,,,,,,,,,,
|
10 |
+
,,,,"DARK METAL",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
11 |
+
test_20,,Default,simple,MALICIA,base,,,"2011-03-14 15:58:41",,,,,,testeando2,1,,,,0,no_selection,,No,,,,,,,Test2,"2011-03-13 00:00:00",,"Block after Info Column",,10.0000,0,test2,,no_selection,,,,,1,0,no_selection,,,"2011-03-14 16:02:34",test2,test2-1.html,4,2.0000,100.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,0.0000,1,0,1,1,0.0000,1,0,,,,,,,,,,,,,
|
12 |
+
,,,,"DARK METAL",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
13 |
+
test_test,,Default,grouped,MALICIA,base,,,"2011-03-14 15:58:41",,,,,,test,1,,,,0,no_selection,,No,,,,,,,test,"2011-03-04 00:00:00",,"Block after Info Column",,,0,test,,no_selection,,,,,1,,no_selection,,,"2011-03-14 18:58:20",test,test-3.html,4,,0.0000,0.0000,1,0,0,1,1.0000,1,0.0000,1,1,0.0000,1,0,1,1,0.0000,1,0,,,,,,,,,,,,,
|
14 |
+
,,,,"DARK METAL",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
15 |
+
TEST1-S1-35,,Default,simple,"TEST COLLECTION",base,,,"2011-04-28 10:15:42",,,,,"1970-01-01 00:00:00","TEST COLLECTION",1,,,,0,,,,,,,,,,"TEST1-S1 (35)","2011-04-08 00:00:00",,"Block after Info Column",,43.9000,0,"TEST COLLECTION",35,,,,,,1,2,,,Shoes,"2011-05-04 22:27:51",test1-s1-35,test1-s1-35.html,1,1.1000,999.0000,0.0000,1,0,0,1,1.0000,1,10000.0000,1,1,1.0000,1,1,1,1,0.0000,1,0,,,,,,,,,,,,,
|
16 |
+
TEST1-S1-36,,Default,simple,"TEST COLLECTION",base,,,"2011-04-28 10:15:42",,,,,"1970-01-01 00:00:00","TEST COLLECTION",1,,,,0,,,,,,,,,,"TEST1-S1 (36)","2011-04-08 00:00:00",,"Block after Info Column",,43.9000,0,"TEST COLLECTION",36,,,,,,1,2,,,Shoes,"2011-05-04 22:27:51",test1-s1-36,test1-s1-36.html,1,1.1000,999.0000,0.0000,1,0,0,1,1.0000,1,10000.0000,1,1,1.0000,1,1,1,1,0.0000,1,0,,,,,,,,,,,,,
|
17 |
+
TEST1-S1-37,,Default,simple,"TEST COLLECTION",base,,,"2011-04-28 10:15:42",,,,,"1970-01-01 00:00:00","TEST COLLECTION",1,,,,0,,,,,,,,,,"TEST1-S1 (37)","2011-04-08 00:00:00",,"Block after Info Column",,43.9000,0,"TEST COLLECTION",37,,,,,,1,2,,,Shoes,"2011-05-04 22:27:51",test1-s1-37,test1-s1-37.html,1,1.1000,999.0000,0.0000,1,0,0,1,1.0000,1,10000.0000,1,1,1.0000,1,1,1,1,0.0000,1,0,,,,,,,,,,,,,
|
18 |
+
TEST1-S1,,Default,grouped,MALICIA,base,,,"2011-04-28 10:15:42",,,,,"1970-01-01 00:00:00","TEST COLLECTION",1,,,,0,/img_articulos/TEST1-S1.jpg,,,,,,,,,"TEST 1 ANTIK NEGRO, PISO TEST test","2011-04-08 00:00:00",,"Block after Info Column",,,0,"TEST COLLECTION",,/img_articulos/TEST1-S1.jpg,,,,,1,,/img_articulos/TEST1-S1.jpg,,Shoes,"2011-05-04 22:27:51",test-1-antik-negro-piso-test-test,test-1-antik-negro-piso-test-test.html,4,,0.0000,0.0000,1,0,0,1,1.0000,1,10000.0000,1,1,1.0000,1,1,1,1,0.0000,1,0,,,,,,,,,,,,,
|
19 |
+
,,,,"TEST COLLECTION",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|