table mshop_index_price empty
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!
- RyadShaker
- Posts: 5
- Joined: 06 Mar 2023, 10:07
table mshop_index_price empty
Aimeos version 2023
PHP version 8
environment (Win)
I use the manager to add products with prices and when I add the product via cron
The table named mshop_index_price remains empty
my code
$context= $this->context();
$manager = \Aimeos\MShop::create( $context, "product" );
$item = $manager->createItem();
$item->fromArray( [
"product.id" => ""
"product.status" => ""
"product.type" => "select"
"product.datatype" => ""
"product.code" => "1"
"product.label" => "test"
], true );
$priceArray = [
'price.value' => '56740',
'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 );
PHP version 8
environment (Win)
I use the manager to add products with prices and when I add the product via cron
The table named mshop_index_price remains empty
my code
$context= $this->context();
$manager = \Aimeos\MShop::create( $context, "product" );
$item = $manager->createItem();
$item->fromArray( [
"product.id" => ""
"product.status" => ""
"product.type" => "select"
"product.datatype" => ""
"product.code" => "1"
"product.label" => "test"
], true );
$priceArray = [
'price.value' => '56740',
'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 );
Re: table mshop_index_price empty
Use the index manager instead of the product manager to save products. Then, they will be also added to the index tables automatically.
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
- RyadShaker
- Posts: 5
- Joined: 06 Mar 2023, 10:07
Re: table mshop_index_price empty
Only for saving the product item, please!
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
- RyadShaker
- Posts: 5
- Joined: 06 Mar 2023, 10:07