Magento – Dataflow advanced export filter by category

dataflowexport

I want to filter the exported products by category, but what I have isn't working:

<action type="catalog/convert_adapter_product" method="load">
    <var name="store"><![CDATA[0]]></var>
    <var name="filter/type"><![CDATA[simple]]></var>
    <var name="filter/category"><![CDATA[my-category]]></var>
</action>

<action type="catalog/convert_parser_product" method="unparse">
    <var name="store"><![CDATA[0]]></var>
    <var name="url_field"><![CDATA[0]]></var>
</action>

<action type="dataflow/convert_mapper_column" method="map">
    <var name="map">
        <map name="sku"><![CDATA[MPN/UPC]]></map>
        <map name="brand"><![CDATA[Manufacturer]]></map>
        <map name="name"><![CDATA[Product Name]]></map>
        <map name="product_link"><![CDATA[product_link]]></map>
        <map name="condition"><![CDATA[Product Condition]]></map>
        <map name="price"><![CDATA[Selling Price]]></map>
        <map name="shipping_costs"><![CDATA[Shipping costs]]></map>
        <map name="weight_box1"><![CDATA[Weight]]></map>
    </var>
    <var name="_only_specified">true</var>
</action>

<action type="dataflow/convert_parser_csv" method="unparse">
    <var name="delimiter"><![CDATA[,]]></var>
    <var name="enclose"><![CDATA["]]></var>
    <var name="fieldnames">true</var>
</action>

<action type="dataflow/convert_adapter_io" method="save">
    <var name="type">file</var>
    <var name="path">var/export</var>
    <var name="filename"><![CDATA[catonly.csv]]></var>
</action>

Looks like <var name="filter/category"><![CDATA[my-category]]></var> doesn't work.

Best Answer

From this Magento KB article, it seems that we are limited to a set of predefined filters (name, sku, type, attribute_set, price/from, price/to, qty/from, qty/to, visibility, status)

To use another filter, you must create a small extension, example here: https://stackoverflow.com/a/7342066/729440

For categories, you'll want to load your category using Mage::getModel('catalog/category')->load($your_cat_id_here); and then use addCategoryFilter

Related Topic