table mshop_index_price empty

How to configure and adapt Aimeos based shops as developer
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!
User avatar
RyadShaker
Posts: 5
Joined: 06 Mar 2023, 10:07

table mshop_index_price empty

Post by RyadShaker » 02 Jul 2023, 12:46

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 );

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: table mshop_index_price empty

Post by aimeos » 04 Jul 2023, 11:30

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, Image give us a star

User avatar
RyadShaker
Posts: 5
Joined: 06 Mar 2023, 10:07

Re: table mshop_index_price empty

Post by RyadShaker » 04 Jul 2023, 14:05

aimeos wrote: 04 Jul 2023, 11:30 Use the index manager instead of the product manager to save products. Then, they will be also added to the index tables automatically.
It gives me this error
Called unknown macro "createListItem" on class "Aimeos\MShop\Index\Manager\MySQL"

User avatar
aimeos
Administrator
Posts: 7894
Joined: 01 Jan 1970, 00:00

Re: table mshop_index_price empty

Post by aimeos » 04 Jul 2023, 14:29

Only for saving the product item, please!
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
RyadShaker
Posts: 5
Joined: 06 Mar 2023, 10:07

Re: table mshop_index_price empty

Post by RyadShaker » 04 Jul 2023, 14:37

aimeos wrote: 04 Jul 2023, 14:29 Only for saving the product item, please!
Thank you very much

Post Reply