POST
get_items
This item allows you to export item information from your shop system to the Shopgate Items XML Format.
Query parameters
Response
application/json
Error Codes
Code | Description |
---|---|
2 | cannot open/create logfile(s) |
10 | invalid value in configuration |
11 | error reading or writing configuration |
20 | no action specified |
21 | unknown action requested |
22 | disabled action requested |
23 | wrong response format |
80 | file not found |
81 | cannot open file |
82 | buffer is empty |
83 | database error |
100 | no connection to server |
101 | Unknown action |
102 | error code received from merchant API |
120 | authentication failed |
999 | Unknown error |
Plugin Examples
class MyPlugin extends ShopgatePlugin
{
protected function createItems($limit = null, $offset = null, array $uids = array ())
{
/**
* init product model
*/
$productItem = new Shopgate_Model_Catalog_Product();
$productItem->setUid(10);
$productItem->setName('Example Product 1');
$productItem->setTaxPercent(19);
$productItem->setTaxClass('19% MwSt DE');
$productItem->setCurrency('EUR');
$productItem->setDescription('Example Description');
$productItem->setDeeplink('http://example-shop/product/id/10/');
$productItem->setPromotionSortOrder(10);
$productItem->setInternalOrderInfo('Example Order Info');
$productItem->setAgeRating(18);
$productItem->setWeight(10);
$productItem->setWeightUnit(Shopgate_Model_Catalog_Product::DEFAULT_WEIGHT_UNIT_GRAMM);
...........
/**
* add item
*/
$this->addItemModel($productItem);
Plugin Example Price
/**
* init price model
*/
$priceItem = new Shopgate_Model_Catalog_Price();
$priceItem->setPrice(22.99);
$priceItem->setCost(12.99);
$priceItem->setMinimumOrderAmount(1);
$priceItem->setMsrp(18.99);
$priceItem->setSalePrice(21.99);
/**
* init tier price (optional)
*/
$tierPriceItem = new Shopgate_Model_Catalog_TierPrice();
$tierPriceItem->setAggregateChildren(true);
$tierPriceItem->setCustomerGroupUid(1);
$tierPriceItem->setFromQuantity(10);
$tierPriceItem->setToQuantity(20);
$tierPriceItem->setReduction(5.99);
$tierPriceItem->setReductionType(Shopgate_Model_Catalog_TierPrice::DEFAULT_TIER_PRICE_TYPE_FIXED);
/**
* add to price model
*/
$priceItem->addTierPriceGroup($tierPriceItem);
/**
* init tier price (optional)
*/
$tierPriceItem = new Shopgate_Model_Catalog_TierPrice();
$tierPriceItem->setCustomerGroupUid(1);
$tierPriceItem->setFromQuantity(20);
$tierPriceItem->setToQuantity(30);
$tierPriceItem->setReduction(8.99);
$tierPriceItem->setReductionType(Shopgate_Model_Catalog_TierPrice::DEFAULT_TIER_PRICE_TYPE_FIXED);
/**
* add to price model
*/
$priceItem->addTierPriceGroup($tierPriceItem);
/**
* add to product model
*/
$productItem->setPrice($priceItem);
........
$this->addItemModel($productItem);
Plugin Example Images
/**
* init image model
*/
$imageItem = new Shopgate_Model_Media_Image();
$imageItem->setUid(10);
$imageItem->setIsCover(true);
$imageItem->setSortOrder(10);
$imageItem->setAlt('Example Alt 1');
$imageItem->setTitle('Example Title 1');
$imageItem->setUrl('http://example-shop/product/id/10/image/id/10');
/**
* add to product model
*/
$productItem->addImage($imageItem);
/**
* init image model
*/
$imageItem = new Shopgate_Model_Media_Image();
$imageItem->setUid(20);
$imageItem->setIsCover(false);
$imageItem->setSortOrder(20);
$imageItem->setAlt('Example Alt 2');
$imageItem->setTitle('Example Title 1');
$imageItem->setUrl('http://example-shop/product/id/10/image/id/20');
/**
* add to product model
*/
$productItem->addImage($imageItem);
Plugin Example Categories
/**
* init category path model
*/
$categoryPathItem = new Shopgate_Model_Catalog_CategoryPath();
$categoryPathItem->setUid(10);
$categoryPathItem->setSortOrder(10);
/**
* add to product item
*/
$productItem->addCategoryPath($categoryPathItem);
/**
* init category path model
*/
$categoryPathItem = new Shopgate_Model_Catalog_CategoryPath();
$categoryPathItem->setUid(20);
$categoryPathItem->setSortOrder(20);
/**
* add to product item
*/
$productItem->addCategoryPath($categoryPathItem);
Plugin Example Shipping
/**
* init shipping model
*/
$shippingItem = new Shopgate_Model_Catalog_Shipping();
$shippingItem->setIsFree(false);
$shippingItem->setAdditionalCostsPerUnit(1.99);
$shippingItem->setCostsPerOrder(0.99);
/**
* add to product model
*/
$productItem->setShipping($shippingItem);
Plugin Example Manufacturer
/**
* init manufacturer model
*/
$manufacturerItem = new Shopgate_Model_Catalog_Manufacturer();
$manufacturerItem->setUid(10);
$manufacturerItem->setTitle('Shopgate');
$manufacturerItem->setItemNumber('sg');
/**
* add to product
*/
$productItem->setManufacturer($manufacturerItem);
Plugin Example Visibility
/**
* init visibility model
*/
$visibilityItem = new Shopgate_Model_Catalog_Visibility();
$visibilityItem->setLevel(Shopgate_Model_Catalog_Visibility::DEFAULT_VISIBILITY_CATALOG_AND_SEARCH);
$visibilityItem->setMarketplace(false);
/**
* add to product model
*/
$productItem->setVisibility($visibilityItem);
Plugin Example Properties
/**
* init property model
*/
$propertyItem = new Shopgate_Model_Catalog_Property();
$propertyItem->setUid(10);
$propertyItem->setLabel('Example Property 1');
$propertyItem->setValue('example value 1');
/**
* add to product model
*/
$productItem->addProperty($propertyItem);
/**
* init property model
*/
$propertyItem = new Shopgate_Model_Catalog_Property();
$propertyItem->setUid(20);
$propertyItem->setLabel('Example Property 2');
$propertyItem->setValue('example value 2');
/**
* add to product model
*/
$productItem->addProperty($propertyItem);
Plugin Example Stock
/**
* init stock model
*/
$stockItem = new Shopgate_Model_Catalog_Stock();
$stockItem->setStockQuantity(100);
$stockItem->setAvailabilityText('in stock');
$stockItem->setBackorders(true);
$stockItem->setIsSaleable(true);
$stockItem->setUseStock(true);
$stockItem->setMinimumOrderQuantity(1);
$stockItem->setMaximumOrderQuantity(10);
/**
* add to product
*/
$productItem->setStock($stockItem);
Plugin Example Identifiers
/**
* init identifier model
*/
$identifierItem = new Shopgate_Model_Catalog_Identifier();
$identifierItem->setUid(10);
$identifierItem->setType('EAN');
$identifierItem->setValue('00000001');
/**
* add to product
*/
$productItem->addIdentifier($identifierItem);
/**
* init identifier model
*/
$identifierItem = new Shopgate_Model_Catalog_Identifier();
$identifierItem->setUid(20);
$identifierItem->setType('EXAMPLE');
$identifierItem->setValue('e_2004_001');
/**
* add to product
*/
$productItem->addIdentifier($identifierItem);
Plugin Example Tags
/**
* init tag model
*/
$tagItem = new Shopgate_Model_Catalog_Tag();
$tagItem->setUid(10);
$tagItem->setValue('Example Tag 1');
/**
* add to product model
*/
$productItem->addTag($tagItem);
/**
* init tag model
*/
$tagItem = new Shopgate_Model_Catalog_Tag();
$tagItem->setUid(20);
$tagItem->setValue('Example Tag 2');
/**
* add to product model
*/
$productItem->addTag($tagItem);
Plugin Example Relations
/**
* init relation model
*/
$relationItem = new Shopgate_Model_Catalog_Relation();
$relationItem->setType(Shopgate_Model_Catalog_Relation::DEFAULT_RELATION_TYPE_CROSSSELL);
$relationItem->addValue(100);
$relationItem->addValue(102);
/**
* add to product
*/
$productItem->addRelation($relationItem);
/**
* init relation model
*/
$relationItem = new Shopgate_Model_Catalog_Relation();
$relationItem->setType(Shopgate_Model_Catalog_Relation::DEFAULT_RELATION_TYPE_CUSTOM);
$relationItem->setLabel('Custom Relation');
$relationItem->addValue(105);
$relationItem->addValue(109);
/**
* add to product
*/
$productItem->addRelation($relationItem);
Plugin Example Attributes Group
/**
* init attribute group model
*/
$attributeGroupItem = new Shopgate_Model_Catalog_AttributeGroup();
$attributeGroupItem->setUid('10');
$attributeGroupItem->setLabel('Color');
/**
* add to product model
*/
$productItem->addAttributeGroup($attributeGroupItem);
/**
* init attribute group model
*/
$attributeGroupItem = new Shopgate_Model_Catalog_AttributeGroup();
$attributeGroupItem->setUid('20');
$attributeGroupItem->setLabel('Size');
/**
* add to product model
*/
$productItem->addAttributeGroup($attributeGroupItem);
Plugin Example Inputs
/**
* init inputs model
*/
$inputItem = new Shopgate_Model_Catalog_Input();
$inputItem->setUid(10);
$inputItem->setLabel('PDF upload');
$inputItem->setInfoText('Please select a pdf file');
$inputItem->setType(Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_FILE);
/**
* validation
* init validation model
*/
$validationItem = new Shopgate_Model_Catalog_Validation();
$validationItem->setValidationType(Shopgate_Model_Catalog_Validation::DEFAULT_VALIDATION_FILE_PDF);
/**
* add to input item
*/
$inputItem->setValidation($validationItem);
/**
* add to product
*/
$productItem->addInput($inputItem);
/**
* init inputs model
*/
$inputItem = new Shopgate_Model_Catalog_Input();
$inputItem->setUid(20);
$inputItem->setLabel('Select some Item');
$inputItem->setInfoText('Please select');
$inputItem->setType(Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_SELECT);
/**
* options
*
* init option model
*/
$optionModel = new Shopgate_Model_Catalog_Option();
$optionModel->setUid(10);
$optionModel->setLabel('Item 1');
$optionModel->setValue(1);
$optionModel->setAdditionalPrice(1.99);
/**
* add to input model
*/
$inputItem->addOption($optionModel);
/**
* init option model
*/
$optionModel = new Shopgate_Model_Catalog_Option();
$optionModel->setUid(20);
$optionModel->setLabel('Item 2');
$optionModel->setValue(2);
$optionModel->setAdditionalPrice(1.49);
/**
* add to input model
*/
$inputItem->addOption($optionModel);
/**
* validation
* init validation model
*/
$validationItem = new Shopgate_Model_Catalog_Validation();
$validationItem->setValidationType(Shopgate_Model_Catalog_Validation::DEFAULT_VALIDATION_VARIABLE_INT);
/**
* add to input item
*/
$inputItem->setValidation($validationItem);
/**
* add to product
*/
$productItem->addInput($inputItem);
/**
* init inputs model
*/
$inputItem = new Shopgate_Model_Catalog_Input();
$inputItem->setUid(20);
$inputItem->setLabel('Insert som text');
$inputItem->setInfoText('only numbers allowed');
$inputItem->setType(Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_TEXT);
/**
* init validation model
*/
$validationItem = new Shopgate_Model_Catalog_Validation();
$validationItem->setValidationType(Shopgate_Model_Catalog_Validation::DEFAULT_VALIDATION_TYPE_REGEX);
$validationItem->setValue('^[0-9]+$');
/**
* add to input item
*/
$inputItem->setValidation($validationItem);
/**
* add to product
*/
$productItem->addInput($inputItem);
Plugin Example Children
/**
* init children model (product model)
*/
$childItem = new Shopgate_Model_Catalog_Product();
$childItem->setIsChild(true);
/**
* attributes
* init attribute model
*/
$attributeItem = new Shopgate_Model_Catalog_Attribute();
$attributeItem->setUid(10);
$attributeItem->setGroupUid(10);
$attributeItem->setLabel('red');
/**
* add to child item
*/
$childItem->addAttribute($attributeItem);
/**
* init attribute model
*/
$attributeItem = new Shopgate_Model_Catalog_Attribute();
$attributeItem->setUid(10);
$attributeItem->setGroupUid(20);
$attributeItem->setLabel('XXL');
/**
* price
* init price model
*/
$priceItem = new Shopgate_Model_Catalog_Price();
$priceItem->setPrice(18.88);
/**
* add to child product
*/
$childItem->setPrice($priceItem);
/**
* add to child item
*/
$childItem->addAttribute($attributeItem);
/**
* you can extend / rewrite every property from the parent product
* uid example
*/
$childItem->setUid('10_1');
/**
* example name
*/
$childItem->setName('Example Product 1 (Child)');
/**
* example identifier
* init identifier model
*/
$identifierItem = new Shopgate_Model_Catalog_Identifier();
/**
* uid from the parent identifier id
*/
$identifierItem->setUid(10);
$identifierItem->setValue('00000002');
/**
* add to the child product
*/
$childItem->addIdentifier($identifierItem);
$productItem->addChild($childItem);