[Magento] How export and import are implemented?
2012-12-26 18:53
260 查看
|
in ecommerce world. Flexibility of this interface definescapability of the application to communicate with the outsideworld, be it legacy systems, 3rd party applications, priceaggregators, external order sources, fulfillment systems,accounting, etc.
Thus we took it very seriously and, as with everything elsein Magento wentone
or more steps further than most systems. Effectivelyany import orexport
is a conversion.From one medium to another. From database to local file,from FTP serverto
database, from parsed HTML pageto
Excel spreadsheet, from Google Spreadsheet to catalog.
Basically, it boils down to loading data from one resource,applying unlimited alterations/reformatting, and saving it toanother resource.
Welcome to the world of conversion.
|
Load records from database
Convert internal identificators into human understandabletext
Map database fields to our custom file headings (sku ⇒ PartNumber)
Format data array as Excel XML
Save resulting text as local or remote file
This sequence of actions we call a Profile.
Here we have 4 categories of components:
Adapter (input/output)
Mapper (data value processing)
Parser (data format conversion)
Validator (data validation)
|
Local files
FTP,
SFTP servers
Database table
Soap services
Standard input/output
HTTP interface
HTML source
Google Spreadsheets
Custom resources (specialized db interface, cache repository,etc.)
Adapters can have 2 methods:
load- extract datafrom resource into internal container.
save- save data intoresource.
|
Mappers can run one method:
map
|
CSV text ⇒ Grid array
Excel XML text⇒
Grid array
Grid array ⇒ Product model collection
Parsers can have 2 methods:
parse- usually convertfrom more human readable data to machine
friendly format
unparse- the opposite,into human readable format
You might notice that Parsers are separated from Adapters, whenusually they are associated as one thing (export to CSV file).
|
Validators can only
validate.
|
<action type="catalog/convert_adapter_product" method="load">
<var name="store">base</var>
</action>
<action type="catalog/convert_parser_product" method="unparse">
</action>
<action type="varien/convert_mapper_column" method="map">
<var name="sku">Part#</var>
</action>
<action type="core/convert_parser_csv" method="unparse">
<var name="delimiter">,</var>
<var name="enclose"><![CDATA["]]></var>
<var name="fieldnames">true</var>
</action>
<action type="core/convert_adapter_io" method="save">
<var name="type">file</var>
<var name="path"></var>
<var name="filename">products.csv</var>
<var name="link">/dev/moshe/magento/var/export/products.csv</var>
</action>
相关文章推荐
- How blocks are implemented (and the consequences)
- How to Export and Import Oracle Database Statistics Information
- How to Export and Import the AWR Repository From One Database to Another (文档 ID 785730.1)
- [转]How blocks are implemented (and the consequences)
- Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data ? [ID 552424.1]
- Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data ? [ID 552424.1]
- 103.Which two statements are true regarding the Oracle Data Pump export and import operations? (Choo
- Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data ? [ID 552424.1]
- Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data ? [ID 552424.1]
- Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data ? [ID 552424.1]
- Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data ? [ID 552424.1]
- Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data ? [ID 552424.1]
- Export/Import DataPump Parameter ACCESS_METHOD - How to Enforce a Method of Loading and Unloading Data ?
- How to solve problem caused when the CRT library and MFC libraries are linked in the wrong order
- How to Cluster Magento, nginx and MySQL on Multiple Servers for High Availability
- Oracle Import and Export
- How about xlogs are missing and xlogs are deleted
- Fast Excel import and export
- how websites are perceived by their visitors and the basic ways in which websites can be constructed.
- babel & browserify 报错 'import' and 'export' may appear only with 'sourceType: module' (2:0)