Create new product using aimeos manager
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 12
- Joined: 23 Feb 2020, 10:32
Create new product using aimeos manager
I created admin panel for uploading product CSV files. From there I am reading line by line the data and trying to create product table entries. Earlier I directly added entries to tables with mysql but now I want to use Manager.
All I've been able to do is
And this is the $itemArray I created by looping through data
Please help me as to how do I make this work. I know there are a lot of managers to be created but they aren't well documented.
I am using aimeos/aimeos-larave ~2019.10 on XAMPP (windows), running PHP 7.3.12
All I've been able to do is
Code: Select all
$context = \App::make('\Aimeos\Shop\Base\Context')->get(true);
$manager = \Aimeos\MShop::create( $context, "product" );
$item = $manager->createItem();
$item->fromArray($itemArray, true);
$manager->saveItem($item);
Code: Select all
[
"item[product.id]" => ""
"item[product.status]" => ""
"item[product.type]" => "select"
"item[product.datatype]" => ""
"item[product.code]" => "1"
"item[product.label]" => "adidasyeezyboost700v2vanta"
"item[product.datestart]" => ""
"item[product.dateend]" => ""
"item[product.ctime]" => ""
"item[product.target]" => ""
"item[product.tags]" => "adidas, yeezy, boost, 700, 700 v2, vanta, sneakers, kicks, luxury, streetwear, trainers"
"text[0][text.id]" => ""
"text[0][text.status]" => "1"
"text[0][text.languageid]" => "en"
"text[0][text.type]" => "name"
"text[0][text.label]" => ""
"text[0][text.content]" => "Adidas Yeezy Boost 700 V2 VANTA"
"text[1][text.id]" => ""
"text[1][text.status]" => "1"
"text[1][text.languageid]" => "en"
"text[1][text.type]" => "long"
"text[1][text.label]" => ""
"text[1][text.content]" => """
Make a statement with the adidas Yeezy Boost 700 V2 Vanta on your feet. This Yeezy Boost 700 V2 comes with a black upper, black midsole, and a black sole. These ▶
Size(EU): 36, 36.5, 37, 38, 38.5, 39, 40, 40.5, 41, 42, 42.5, 43, 44, 44.5, 45, 46, 46.5, 47, 48
"""
"category[default-0][catalog.lists.type]" => "default"
"category[default-0][catalog.lists.id]" => ""
"category[default-0][catalog.code]" => "default"
"category[default-0][catalog.label]" => "Default"
"category[default-0][catalog.id]" => "1"
"category[default-1][catalog.lists.type]" => "default"
"category[default-1][catalog.lists.id]" => ""
"category[default-1][catalog.code]" => "shoes"
"category[default-1][catalog.label]" => "Shoes"
"category[default-1][catalog.id]" => 2
"category[default-2][catalog.lists.type]" => "default"
"category[default-2][catalog.lists.id]" => ""
"category[default-2][catalog.code]" => "adidas"
"category[default-2][catalog.label]" => "Adidas"
"category[default-2][catalog.id]" => 3
"selection[0][product.id]" => ""
"selection[0][product.lists.id]" => ""
"selection[0][product.status]" => "1"
"selection[0][product.code]" => "p1s1"
"selection[0][product.label]" => "p1s1"
"selection[0][attr][0][product.lists.id]" => ""
"selection[0][attr][0][product.lists.siteid]" => "1"
"selection[0][attr][0][attribute.type]" => "size"
"selection[0][attr][0][attribute.label]" => "EU36"
"selection[0][attr][0][product.lists.refid]" => 2
"selection[1][product.id]" => ""
"selection[1][product.lists.id]" => ""
"selection[1][product.status]" => "1"
"selection[1][product.code]" => "p1s2"
"selection[1][product.label]" => "p1s2"
"selection[1][attr][0][product.lists.id]" => ""
"selection[1][attr][0][product.lists.siteid]" => "1"
"selection[1][attr][0][attribute.type]" => "size"
"selection[1][attr][0][attribute.label]" => "EU36.5"
"selection[1][attr][0][product.lists.refid]" => 3
"selection[2][product.id]" => ""
"selection[2][product.lists.id]" => ""
"selection[2][product.status]" => "1"
"selection[2][product.code]" => "p1s3"
"selection[2][product.label]" => "p1s3"
"selection[2][attr][0][product.lists.id]" => ""
"selection[2][attr][0][product.lists.siteid]" => "1"
"selection[2][attr][0][attribute.type]" => "size"
"selection[2][attr][0][attribute.label]" => "EU37"
"selection[2][attr][0][product.lists.refid]" => 4
"selection[3][product.id]" => ""
"selection[3][product.lists.id]" => ""
"selection[3][product.status]" => "1"
"selection[3][product.code]" => "p1s4"
"selection[3][product.label]" => "p1s4"
"selection[3][attr][0][product.lists.id]" => ""
"selection[3][attr][0][product.lists.siteid]" => "1"
"selection[3][attr][0][attribute.type]" => "size"
"selection[3][attr][0][attribute.label]" => "EU38"
"selection[3][attr][0][product.lists.refid]" => 5
"selection[4][product.id]" => ""
"selection[4][product.lists.id]" => ""
"selection[4][product.status]" => "1"
"selection[4][product.code]" => "p1s5"
"selection[4][product.label]" => "p1s5"
"selection[4][attr][0][product.lists.id]" => ""
"selection[4][attr][0][product.lists.siteid]" => "1"
"selection[4][attr][0][attribute.type]" => "size"
"selection[4][attr][0][attribute.label]" => "EU38.5"
"selection[4][attr][0][product.lists.refid]" => 6
"selection[5][product.id]" => ""
"selection[5][product.lists.id]" => ""
"selection[5][product.status]" => "1"
"selection[5][product.code]" => "p1s6"
"selection[5][product.label]" => "p1s6"
"selection[5][attr][0][product.lists.id]" => ""
"selection[5][attr][0][product.lists.siteid]" => "1"
"selection[5][attr][0][attribute.type]" => "size"
"selection[5][attr][0][attribute.label]" => "EU39"
"selection[5][attr][0][product.lists.refid]" => 7
"selection[6][product.id]" => ""
"selection[6][product.lists.id]" => ""
"selection[6][product.status]" => "1"
"selection[6][product.code]" => "p1s7"
"selection[6][product.label]" => "p1s7"
"selection[6][attr][0][product.lists.id]" => ""
"selection[6][attr][0][product.lists.siteid]" => "1"
"selection[6][attr][0][attribute.type]" => "size"
"selection[6][attr][0][attribute.label]" => "EU40"
"selection[6][attr][0][product.lists.refid]" => 8
"selection[7][product.id]" => ""
"selection[7][product.lists.id]" => ""
"selection[7][product.status]" => "1"
"selection[7][product.code]" => "p1s8"
"selection[7][product.label]" => "p1s8"
"selection[7][attr][0][product.lists.id]" => ""
"selection[7][attr][0][product.lists.siteid]" => "1"
"selection[7][attr][0][attribute.type]" => "size"
"selection[7][attr][0][attribute.label]" => "EU40.5"
"selection[7][attr][0][product.lists.refid]" => 9
"selection[8][product.id]" => ""
"selection[8][product.lists.id]" => ""
"selection[8][product.status]" => "1"
"selection[8][product.code]" => "p1s9"
"selection[8][product.label]" => "p1s9"
"selection[8][attr][0][product.lists.id]" => ""
"selection[8][attr][0][product.lists.siteid]" => "1"
"selection[8][attr][0][attribute.type]" => "size"
"selection[8][attr][0][attribute.label]" => "EU41"
"selection[8][attr][0][product.lists.refid]" => 10
"selection[9][product.id]" => ""
"selection[9][product.lists.id]" => ""
"selection[9][product.status]" => "1"
"selection[9][product.code]" => "p1s10"
"selection[9][product.label]" => "p1s10"
"selection[9][attr][0][product.lists.id]" => ""
"selection[9][attr][0][product.lists.siteid]" => "1"
"selection[9][attr][0][attribute.type]" => "size"
"selection[9][attr][0][attribute.label]" => "EU42"
"selection[9][attr][0][product.lists.refid]" => 11
"selection[10][product.id]" => ""
"selection[10][product.lists.id]" => ""
"selection[10][product.status]" => "1"
"selection[10][product.code]" => "p1s11"
"selection[10][product.label]" => "p1s11"
"selection[10][attr][0][product.lists.id]" => ""
"selection[10][attr][0][product.lists.siteid]" => "1"
"selection[10][attr][0][attribute.type]" => "size"
"selection[10][attr][0][attribute.label]" => "EU42.5"
"selection[10][attr][0][product.lists.refid]" => 12
"selection[11][product.id]" => ""
"selection[11][product.lists.id]" => ""
"selection[11][product.status]" => "1"
"selection[11][product.code]" => "p1s12"
"selection[11][product.label]" => "p1s12"
"selection[11][attr][0][product.lists.id]" => ""
"selection[11][attr][0][product.lists.siteid]" => "1"
"selection[11][attr][0][attribute.type]" => "size"
"selection[11][attr][0][attribute.label]" => "EU43"
"selection[11][attr][0][product.lists.refid]" => 13
"selection[12][product.id]" => ""
"selection[12][product.lists.id]" => ""
"selection[12][product.status]" => "1"
"selection[12][product.code]" => "p1s13"
"selection[12][product.label]" => "p1s13"
"selection[12][attr][0][product.lists.id]" => ""
"selection[12][attr][0][product.lists.siteid]" => "1"
"selection[12][attr][0][attribute.type]" => "size"
"selection[12][attr][0][attribute.label]" => "EU44"
"selection[12][attr][0][product.lists.refid]" => 14
"selection[13][product.id]" => ""
"selection[13][product.lists.id]" => ""
"selection[13][product.status]" => "1"
"selection[13][product.code]" => "p1s14"
"selection[13][product.label]" => "p1s14"
"selection[13][attr][0][product.lists.id]" => ""
"selection[13][attr][0][product.lists.siteid]" => "1"
"selection[13][attr][0][attribute.type]" => "size"
"selection[13][attr][0][attribute.label]" => "EU44.5"
"selection[13][attr][0][product.lists.refid]" => 15
"selection[14][product.id]" => ""
"selection[14][product.lists.id]" => ""
"selection[14][product.status]" => "1"
"selection[14][product.code]" => "p1s15"
"selection[14][product.label]" => "p1s15"
"selection[14][attr][0][product.lists.id]" => ""
"selection[14][attr][0][product.lists.siteid]" => "1"
"selection[14][attr][0][attribute.type]" => "size"
"selection[14][attr][0][attribute.label]" => "EU45"
"selection[14][attr][0][product.lists.refid]" => 16
"selection[15][product.id]" => ""
"selection[15][product.lists.id]" => ""
"selection[15][product.status]" => "1"
"selection[15][product.code]" => "p1s16"
"selection[15][product.label]" => "p1s16"
"selection[15][attr][0][product.lists.id]" => ""
"selection[15][attr][0][product.lists.siteid]" => "1"
"selection[15][attr][0][attribute.type]" => "size"
"selection[15][attr][0][attribute.label]" => "EU46"
"selection[15][attr][0][product.lists.refid]" => 17
"selection[16][product.id]" => ""
"selection[16][product.lists.id]" => ""
"selection[16][product.status]" => "1"
"selection[16][product.code]" => "p1s17"
"selection[16][product.label]" => "p1s17"
"selection[16][attr][0][product.lists.id]" => ""
"selection[16][attr][0][product.lists.siteid]" => "1"
"selection[16][attr][0][attribute.type]" => "size"
"selection[16][attr][0][attribute.label]" => "EU46.5"
"selection[16][attr][0][product.lists.refid]" => 18
"selection[17][product.id]" => ""
"selection[17][product.lists.id]" => ""
"selection[17][product.status]" => "1"
"selection[17][product.code]" => "p1s18"
"selection[17][product.label]" => "p1s18"
"selection[17][attr][0][product.lists.id]" => ""
"selection[17][attr][0][product.lists.siteid]" => "1"
"selection[17][attr][0][attribute.type]" => "size"
"selection[17][attr][0][attribute.label]" => "EU47"
"selection[17][attr][0][product.lists.refid]" => 19
"selection[18][product.id]" => ""
"selection[18][product.lists.id]" => ""
"selection[18][product.status]" => "1"
"selection[18][product.code]" => "p1s19"
"selection[18][product.label]" => "p1s19"
"selection[18][attr][0][product.lists.id]" => ""
"selection[18][attr][0][product.lists.siteid]" => "1"
"selection[18][attr][0][attribute.type]" => "size"
"selection[18][attr][0][attribute.label]" => "EU48"
"selection[18][attr][0][product.lists.refid]" => 20
"price[0][price.taxrates]" => "{"":"0.00"}"
"price[0][price.status]" => "1"
"price[0][price.currencyid]" => "USD"
"price[0][price.type]" => "default"
"price[0][price.quantity]" => "1"
"price[0][price.lists.type]" => "default"
"price[0][price.lists.datestart]" => ""
"price[0][price.lists.dateend]" => ""
"price[0][price.id]" => ""
"price[0][price.value]" => "239.00"
]
I am using aimeos/aimeos-larave ~2019.10 on XAMPP (windows), running PHP 7.3.12
Re: Create new product using aimeos manager
Your keys are wrong, they have to look like:
For the additional data, you have to use e.g.
You should have a look at the JQAdm classes which do the same for all product related data:
https://github.com/aimeos/ai-admin-jqad ... dm/Product
e.g. for adding new, updating existing and removing old text data:
https://github.com/aimeos/ai-admin-jqad ... #L309-L350
Code: Select all
$item->fromArray( [
"product.id" => ""
"product.status" => ""
"product.type" => "select"
"product.datatype" => ""
"product.code" => "1"
"product.label" => "adidasyeezyboost700v2vanta"
"product.datestart" => ""
"product.dateend" => ""
"product.ctime" => ""
"product.target" => ""
], true );
Code: Select all
$priceArray = [[
'price.value' => '239.00',
'price.lists.type' => 'default',
// ...
], [
// ...
]];
$priceManager = \Aimeos\MShop::create( $context, 'price );
foreach( $priceArray as $priceData )
{
$listItem = $manager->createListItem()->fromArray( $priceData );
$priceItem = $priceManager->createItem()->fromArray( $priceData );
$item->addListItem( 'price', $listItem, $priceItem );
}
$manager->saveItem( $item );
https://github.com/aimeos/ai-admin-jqad ... dm/Product
e.g. for adding new, updating existing and removing old text data:
https://github.com/aimeos/ai-admin-jqad ... #L309-L350
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 12
- Joined: 23 Feb 2020, 10:32
Re: Create new product using aimeos manager
Thanks it works. However I am having trouble with product variants (selections).
This is the code I am using
And this is the $selectionArray, (output using laravel's dd() function)
It all gets saved and all but when I use $this->get('selectionData') , it just doesn't contain "attr" key in any of array item.
Please help me
This is the code I am using
Code: Select all
foreach ($selectionArray as $idx => $selectionData) {
$litem = $listManager->createItem()->setType( 'default' );
$refItem = $manager->createItem()->setType( 'default' );
$litem->fromArray( $selectionData, true );
$litem->setPosition( $idx );
$refItem->fromArray( $selectionData, true );
$item->addListItem( 'product', $litem, $refItem );
}
$manager->saveItem( $item );
Code: Select all
array:2 [▼
0 => array:6 [▼
"product.id" => "11"
"product.lists.id" => "95"
"product.status" => "1"
"product.code" => "p4s1"
"product.label" => "p4s1"
"attr" => array:2 [▼
0 => array:5 [▼
"product.lists.id" => "93"
"product.lists.siteid" => "1"
"attribute.type" => "color"
"attribute.label" => "Beige"
"product.lists.refid" => "10"
]
1 => array:5 [▼
"product.lists.id" => "94"
"product.lists.siteid" => "1"
"attribute.type" => "size"
"attribute.label" => "EU36"
"product.lists.refid" => "18"
]
]
]
1 => array:6 [▼
"product.id" => "12"
"product.lists.id" => "98"
"product.status" => "1"
"product.code" => "p4s2"
"product.label" => "p4s2"
"attr" => array:2 [▼
0 => array:5 [▼
"product.lists.id" => "96"
"product.lists.siteid" => "1"
"attribute.type" => "color"
"attribute.label" => "Blue"
"product.lists.refid" => "7"
]
1 => array:5 [▼
"product.lists.id" => "97"
"product.lists.siteid" => "1"
"attribute.type" => "size"
"attribute.label" => "EU38"
"product.lists.refid" => "19"
]
]
]
]
Please help me
Re: Create new product using aimeos manager
For adding the attributes to your selection products, you have to also use code like this:
Code: Select all
$attrManager = \MShop\Factory::create( $context, 'attribute' );
foreach ($selectionArray as $idx => $selectionData) {
$litem = $listManager->createItem()->setType( 'default' );
$refItem = $manager->createItem()->setType( 'default' );
$litem->fromArray( $selectionData, true )->setPosition( $idx );
$refItem->fromArray( $selectionData, true );
foreach( $selectionData['attr'] ?? [] as $attrData ) {
$attrListItem = $listManager->createItem()->setType( 'variant' );
$attrItem = $attrManager->createItem();
$litem->fromArray( $attrData, true );
$attrItem->fromArray( $attrData, true );
$refItem->addListItem( 'attribute', $attrListItem, $attrItem );
}
$item->addListItem( 'product', $litem, $refItem );
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 12
- Joined: 23 Feb 2020, 10:32
Re: Create new product using aimeos manager
The code above gives this error
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-product--' for key 'unq_msatt_sid_dom_type_code': INSERT INTO "mshop_attribute" ( "key", "type", "domain", "code", "status", "pos", "label", "mtime", "editor", "siteid", "ctime" ) VALUES ( 'd3b698f836c4e27f66b9631495227027', '', 'product', '', 1, 0, 'red', '2020-02-27 15:53:00', '', 1, '2020-02-27 15:53:00' )
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-product--' for key 'unq_msatt_sid_dom_type_code': INSERT INTO "mshop_attribute" ( "key", "type", "domain", "code", "status", "pos", "label", "mtime", "editor", "siteid", "ctime" ) VALUES ( 'd3b698f836c4e27f66b9631495227027', '', 'product', '', 1, 0, 'red', '2020-02-27 15:53:00', '', 1, '2020-02-27 15:53:00' )
Re: Create new product using aimeos manager
All your attributes need an "attribute.type" (e.g. "color", "size", etc.) and an "attribute.code" value (for size: 36, 38 or 40). Make sure your data you want to import contains that keys and appropriate values.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Create new product using aimeos manager
Hello
This article is helpful to import product
Product basic/price/text detail import successfully no issue
I need 3 more point detail
1. how i import category, i try with this
$context = \App::make('\Aimeos\Shop\Base\Context')->get(true);
$manager = \Aimeos\MShop::create( $context, 'product' );
$item = $manager->create()->fromArray($data['item'], true);
$catalogManager = \Aimeos\MShop::create( $context, 'catalog' );
foreach($data['catalog'] as $value){
$listItem = $manager->createListItem()->fromArray( $value );
$textItem = $catalogManager->create()->fromArray( $value );
$item->addListItem( 'catalog', $listItem, $textItem );
}
$product = $manager->save($item);
but not create category
2. For media
$mediaManager = \Aimeos\MShop::create( $context, 'media' );
foreach($data['media'] as $value){
$listItem = $manager->createListItem()->fromArray( $value );
$textItem = $mediaManager->create()->fromArray( $value );
$item->addListItem( 'media', $listItem, $textItem );
}
it create media but not upload image i add media url as another website, i want to it will copy from that website to our server by url
where $data is
$data = array();
$data['item']['product.id'] = "";
$data['item']['product.code'] = "demo-api-11111111";
$data['item']['product.label'] = "Demo API Product 1234";
$data['item']['product.type'] = "default";
$data['item']['product.status'] = "1";
$data['catalog']['0']['catalog.id'] = "2";
$data['catalog']['0']['catalog.lists.type'] = "default";
$data['media']['0']['media.url'] = "https://aimeos.org/fileadmin/aimeos.org ... neshop.png";
3. When i update this product
basic detail updated on given product id
but other detail like price and text will create another record
thanks
This article is helpful to import product
Product basic/price/text detail import successfully no issue
I need 3 more point detail
1. how i import category, i try with this
$context = \App::make('\Aimeos\Shop\Base\Context')->get(true);
$manager = \Aimeos\MShop::create( $context, 'product' );
$item = $manager->create()->fromArray($data['item'], true);
$catalogManager = \Aimeos\MShop::create( $context, 'catalog' );
foreach($data['catalog'] as $value){
$listItem = $manager->createListItem()->fromArray( $value );
$textItem = $catalogManager->create()->fromArray( $value );
$item->addListItem( 'catalog', $listItem, $textItem );
}
$product = $manager->save($item);
but not create category
2. For media
$mediaManager = \Aimeos\MShop::create( $context, 'media' );
foreach($data['media'] as $value){
$listItem = $manager->createListItem()->fromArray( $value );
$textItem = $mediaManager->create()->fromArray( $value );
$item->addListItem( 'media', $listItem, $textItem );
}
it create media but not upload image i add media url as another website, i want to it will copy from that website to our server by url
where $data is
$data = array();
$data['item']['product.id'] = "";
$data['item']['product.code'] = "demo-api-11111111";
$data['item']['product.label'] = "Demo API Product 1234";
$data['item']['product.type'] = "default";
$data['item']['product.status'] = "1";
$data['catalog']['0']['catalog.id'] = "2";
$data['catalog']['0']['catalog.lists.type'] = "default";
$data['media']['0']['media.url'] = "https://aimeos.org/fileadmin/aimeos.org ... neshop.png";
3. When i update this product
basic detail updated on given product id
but other detail like price and text will create another record
thanks
Re: Create new product using aimeos manager
No, because the products are attached to categories. Furthermore, it's more efficient to use the catalog/lists manager instead. If you also want to update the product <-> category relations, you have to check for existing relations first. The catalog processor of the product XML importer has implemented the most efficient way for referencing products and categories:agatq wrote: ↑09 May 2021, 13:10 1. how i import category, i try with this
but not create categoryCode: Select all
$context = \App::make('\Aimeos\Shop\Base\Context')->get(true); $manager = \Aimeos\MShop::create( $context, 'product' ); $item = $manager->create()->fromArray($data['item'], true); $catalogManager = \Aimeos\MShop::create( $context, 'catalog' ); foreach($data['catalog'] as $value){ $listItem = $manager->createListItem()->fromArray( $value ); $textItem = $catalogManager->create()->fromArray( $value ); $item->addListItem( 'catalog', $listItem, $textItem ); } $product = $manager->save($item);
https://github.com/aimeos/ai-controller ... andard.php
Use the media controller to create the preview files from the original product image:agatq wrote: ↑09 May 2021, 13:10 2. For mediait create media but not upload image i add media url as another website, i want to it will copy from that website to our server by urlCode: Select all
$mediaManager = \Aimeos\MShop::create( $context, 'media' ); foreach($data['media'] as $value){ $listItem = $manager->createListItem()->fromArray( $value ); $textItem = $mediaManager->create()->fromArray( $value ); $item->addListItem( 'media', $listItem, $textItem ); }
Code: Select all
$data['media']['0']['media.url'] = "https://aimeos.org/fileadmin/aimeos.org/images/screen-onlineshop.png";
Code: Select all
$cntl = \Aimeos\Controller\Common\Media\Factory::create( $context );
$mediaManager = \Aimeos\MShop::create( $context, 'media' );
$item = $mediaManager->create()->setUrl("https://aimeos.org/fileadmin/aimeos.org/images/screen-onlineshop.png");
$item = $cntl->scale( $item );
You have to check if the referenced items are already there, e.g. for attribute items. For text, price and media items which doesn't have a unique code, it's more efficient to use the existing ones you can retrieve together with the products like:
Code: Select all
$manager = \Aimeos\MShop::create($context, 'product');
$items = $manager->search( $manager->filter(), ['text', 'price', 'media', 'attribute'] );
https://aimeos.org/docs/latest/infrastr ... fficiently
Then, overwrite the existing text, price and media items and update them with new content. Again, the product XML importer has a very well optimized algorithm for that, e.g. for media items:
https://github.com/aimeos/ai-controller ... andard.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Create new product using aimeos manager
Is there a limitation to creating products with custom IDs?
If I try for example to setId(999) or pass "product.id" 999 to the product array, the product is not saved with the custom ID.
If I try for example to setId(999) or pass "product.id" 999 to the product array, the product is not saved with the custom ID.
Re: Create new product using aimeos manager
setId() clears the "modified" flag so you have to call this method before all other item methods or call setModified() afterwards. Otherwise, the manager doesn't save the item data because it doesn't seem to have changed.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star