Product customization
This allows you manually set product data from XML
Customization file is located in: custom/custom.php
Explanation of $product_data array:
$product_data = array(
'model' => STRING,
'sku' => STRING,
'upc' => STRING,
'ean' => STRING,
'jan' => STRING,
'isbn' => STRING,
'mpn' => STRING,
'location' => STRING,
'quantity' => INTEGER,
'stock_status_id' => INTEGER,
'manufacturer_id' => INTEGER,
'price' => FLOAT,
'special' => FLOAT,
'tax_class_id' => INTEGER,
'weight_class_id' => INTEGER,
'length_class_id' => INTEGER,
'weight' => FLOAT,
'length' => FLOAT,
'width' => FLOAT,
'height' => FLOAT,
'minimum' => INTEGER,
'subtract' => INTEGER,
'shipping' => INTEGER,
'status' => INTEGER,
'images' => ARRAY,
'attributes' => ARRAY,
'options' => ARRAY,
'categories' => ARRAY,
'description' => ARRAY
);
Example of $product_data array:
$product_data = array(
'model' => 'example-123',
'sku' => 'example-123',
'upc' => 'example-123',
'ean' => 'example-123',
'jan' => 'example-123',
'isbn' => 'example-123',
'mpn' => 'example-123',
'location' => '',
'quantity' => 99,
'stock_status_id' => 1,
'manufacturer_id' => 8,
'price' => 59.99,
'special' => 49.99,
'tax_class_id' => 2,
'weight_class_id' => 1,
'length_class_id' => 1,
'weight' => 10,
'length' => 20,
'width' => 30,
'height' => 40,
'minimum' => 2,
'subtract' => 1,
'shipping' => 1,
'status' => 1,
'images' => array(
'http://www.domain.com/image-01.jpg',
'http://www.domain.com/image-02.jpg',
'http://www.domain.com/image-03.jpg'
),
'attributes' => array(
0 => array(
1 => array( // 1 = language_id
'group' => 'Specifications EN',
'name' => 'Size EN',
'text' => '55 cm EN'
),
2 => array( // 2 = language_id
'group' => 'Specifications DE',
'name' => 'Size DE',
'text' => '55 cm DE'
)
),
1 => array(
1 => array( // 1 = language_id
'group' => 'Specifications EN',
'name' => 'Package EN',
'text' => 'Yes EN'
),
2 => array( // 2 = language_id
'group' => 'Specifications DE',
'name' => 'PACKAGE DE',
'text' => 'Yes DE'
)
)
),
'options' => array(
0 => array(
1 => array( // 1 = language_id
'name' => 'Color EN',
'value' => 'Red EN',
'price' => 9.99,
'quantity' => 5,
'type' => 'select',
'required' => 1,
'subtract' => 1
),
2 => array( // 2 = language_id
'name' => 'Color DE',
'value' => 'Red DE',
'price' => 9.99,
'quantity' => 5,
'type' => 'select',
'required' => 1,
'subtract' => 1
)
),
1 => array(
1 => array( // 1 = language_id
'name' => 'Color EN',
'value' => 'Green EN',
'price' => 4.99,
'quantity' => 9,
'type' => 'select',
'required' => 1,
'subtract' => 1
),
2 => array( // 2 = language_id
'name' => 'Color DE',
'value' => 'Green DE',
'price' => 4.99,
'quantity' => 9,
'type' => 'select',
'required' => 1,
'subtract' => 1
)
)
),
'categories' => array(
0 = array(
1 => 'CategoryA | CategoryB | CategoryC'
),
1 = array(
1 => 'CategoryD | CategoryE | CategoryF'
)
),
'description' => array(
1 = array( // 1 = language_id
'name' => 'Example productA',
'description' => 'full product description',
'tag' => 'tag1, tag2, tag3',
'meta_title' => 'Example productA meta title',
'meta_description' => 'Example productA meta description',
'meta_keyword' => 'Example productA meta keyword',
)
),
);
Example 01:
Set all imported products with 999 quantity:
if(isset($product_data['quantity'])){
$product_data['quantity'] = 999;
}
Example 02:
Set product name with prefix:
if(isset($product_data['description'][(int)$language_id]['name'])){
$product_data['description'][(int)$language_id]['name'] = 'ProductPrefix - '.(string)$product_data['description'][(int)$language_id]['name'];
}
Example 03:
Set fixed price if is zero:
if(isset($product_data['price']) && (float)$product_data['price'] == 0){
$product_data['price'] = 55.46;
}
Example 04:
Replace product description:
if(isset($product_data['description'][$language_id]['description'])){
$product_description = (string)$product_data['description'][$language_id]['description'];
$product_description = str_replace('SEARCH','REPLACE',$product_description);
$product_data['description'][$language_id]['description'] = $product_description;
}
Example 05:
Change fixed quantity only in feed_id 3:
if($feed_id == 3){
$product_data['quantity'] = 99;
}