POST

get_categories

This allows you to export item categories from your shop system to the Shopgate Categories XML Format.

Query parameters

action
string

Requested method

required
default : get_categories
shop_number
string

Your shop number. Example: “11413”

required
trace_id
string

Unique request trace ID. Example: “sma-9412”

required

Response

application/json
file

Plugin Example

<?
    class MyPlugin extends ShopgatePlugin
    {
        ......

        protected function createCategories($limit = null, $offset = null, array $uids = array ())
        {
            /**
             * init category model
             */
            $categoryItem = new Shopgate_Model_Catalog_Category();

            $categoryItem->setUid(10);									        /** required */
            $categoryItem->setName('Example Category');						    /** required */
            $categoryItem->setParentUid(4);								        /** optional */
            $categoryItem->setIsActive(true);								    /** optional | default false */
            $categoryItem->setDeeplink('http://example-shop/category/id/10');   /** optional */
            $categoryItem->setIsAnchor(true);								    /** optional | default false */
            $categoryItem->setSortOrder(10);								    /** optional */

            /**
             * init image model
             */
            $imageItem = new Shopgate_Model_Media_Image();

            $imageItem->setUid(10);											        /** required */
            $imageItem->setSortOrder(10);									        /** optional */
            $imageItem->setAlt('Example Alt 1');								    /** optional */
            $imageItem->setUrl('http://example-shop/category/id/10/image/id/10');	/** optional */
            $imageItem->setTitle('Example Title 1');								/** required */

            /**
             * add to category model
             */
            $categoryItem->setImage($imageItem);
            $this->addCategoryModel($categoryItem);
        }

Plugin Example Result

<categories xsi:noNamespaceSchemaLocation="http://files.shopgate.com/xml/xsd/catalog/categories.xsd">
    <category uid="10" sort_order="10" parent_uid="4" is_active="1" is_anchor="1">
        <name>
            <![CDATA[
            Example Category
            ]]>
        </name>
        <deeplink>http://example-shop/category/id/10</deeplink>
        <image uid="10" sort_order="10">
            <url>
                <![CDATA[
                http://example-shop/category/id/10/image/id/10
                ]]>
            </url>
            <title>
                <![CDATA[
                Example Title 1
                ]]>
            </title>
            <alt>
                <![CDATA[
                Example Alt 1
                ]]>
            </alt>
        </image>
    </category>
</categories>