Skip to content

ericmason/mage-mod-extended-attributes-fd

 
 

Repository files navigation

Magento Extended Attributes (mage-extended-attributes)

A magento custom adapter that converts key-value pairs into a simple HTML table. Useful for cases where custom attributes might become too cumbersome.

Overview

This custom Dataflow Import Profile leverages the Magento Dataflow Module to create custom logic for your Dataflow imports. In this case the pipe-seperated key value paris are converted into a two column table and added to the custom attribute named "extended_attribute". I developed this for use cases where some products needed additional tabular data to be displayed on the product page without the need for addding and managing a large number of custom attributes.

Installation Using Modgit

#### You can use the slug of your choice, but I prefer using the repo name for best results. 
modgit add mage-mod-extended-attributes-fd git@github.com:flintdigital/mage-mod-extended-attributes-fd.git

CSV Raw Data

There is a sample file in the repo, however to give you an idea of how it works the csv data should look something like this:

"store","sku","name","extended_attribute"
"admin","dyn-cham127skis1213","Dynastar Cham 127 Skis","Radius | 22m, Sidecut | 149/127/141 mm, Camber Profile | Rocker/Camber, Core | Wood Fiber, Construction | Sandwich"

XML Snippet

<action type="dataflow/convert_adapter_io" method="load">
    <var name="type">file</var>
    <var name="path">var/import/extended_attribute</var>
    <var name="filename"><![CDATA[extended_attribute_import.csv]]></var>
    <var name="format"><![CDATA[csv]]></var>
</action>
<action type="dataflow/convert_parser_csv" method="parse">
    <var name="delimiter"><![CDATA[\t]]></var>
    <var name="enclose"><![CDATA["]]></var>
    <var name="fieldnames">true</var>
    <var name="store"><![CDATA[0]]></var>
    <var name="number_of_records">1</var>
    <var name="decimal_separator"><![CDATA[.]]></var>
    <var name="adapter">catalog/convert_adapter_productimport</var>
    <var name="method">parse</var>
</action>

Configuration Instructions

  • Go to System->Import/Export->Dataflow - Advanced Profiles
  • Create a new Custom Adapter Import Profile
  • Call it Extended Attributes Import
  • Add (copy/paste) the Above XML snippet into you the Actions XML Input Area
  • Create the directory var/import/extended_attribute
  • Create the custom attribute with an id of "extended_attribute" it should be of the type text area
  • Create a CSV file called extended_attribute_import.csv
  • Make sure that at a minimum you have the following headers for the csv: sku, name, extended_attribute - The upload will not work otherwise. You can have the type and store columns but they must be set to configurable and store respectively.
  • Save/Export to a csv - comma delimited and text wrapped in double quotes. (Google docs should do this auto-magically, so I always recommend using google docs to manage the spreadsheet)
  • Upload file to var/import/extended_attribute
  • Login into magento and go System -> Import/Export -> Dataflow - Advanced Profiles
  • Click the run tab and run the profile in the pop-up (orange button)
  • You should see your results in that window.

Notes

  • A sample data file and the path to the var/export file is included. You can use the data for testing or a template.
  • You can tweak the XML snippet to change the file name and location as needed.
  • About

    A magento custom adapter that converts key-value pairs into a simple HTML table. Useful for cases where custom attributes might become too cumbersome.

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages

    • PHP 100.0%