Doesn't indexing the attribute or category models through this url: admin/default/jsonadm/index/catalog
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Doesn't indexing the attribute or category models through this url: admin/default/jsonadm/index/catalog
Laravel framework version: 10.8.0
Aimeos Laravel version: 2023.04.*
PHP Version: 8.1.18 (cli)
Environment: Linux (Ubuntu)
Every product contains a minimum of 6 different attribute values, and overall there are over 300 attributes and each has min 5 value. But in the catalog page shows up just 9 attributes with their values. Then I've searched a bit in the codes and found out that the js automatically gives disabled class when none of the products contain that attribute. And thought that's the problem, but that wasn't the problem. I've dumped all the attributes that is got, they were 12 ((.
Eventually, I've tried to index them. And got this error:
And this is my '/ai-admin-jsonadm/src/Admin/JsonAdm/Base.php' file:
Aimeos Laravel version: 2023.04.*
PHP Version: 8.1.18 (cli)
Environment: Linux (Ubuntu)
Every product contains a minimum of 6 different attribute values, and overall there are over 300 attributes and each has min 5 value. But in the catalog page shows up just 9 attributes with their values. Then I've searched a bit in the codes and found out that the js automatically gives disabled class when none of the products contain that attribute. And thought that's the problem, but that wasn't the problem. I've dumped all the attributes that is got, they were 12 ((.
Eventually, I've tried to index them. And got this error:
Code: Select all
TypeError: Aimeos\Admin\JsonAdm\Base::saveEntry(): Argument #2 ($entry) must be of type stdClass, string given, called in /var/www/project/vendor/aimeos/ai-admin-jsonadm/src/Admin/JsonAdm/Base.php on line 286 in file /var/www/project/vendor/aimeos/ai-admin-jsonadm/src/Admin/JsonAdm/Base.php on line 301
Code: Select all
/**
* Creates of updates several items at once
*
* @param \Aimeos\MShop\Common\Manager\Iface $manager Manager responsible for the items
* @param \stdClass $request Object with request body data
* @return \Aimeos\Map List of items
*/
protected function saveData( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $request ) : \Aimeos\Map
{
$data = [];
if( isset( $request->data ) )
{
foreach( (array) $request->data as $entry ) {
$data[] = $this->saveEntry( $manager, $entry ); // this is the line 286
}
}
return map( $data );
}
/**
* Saves and returns the new or updated item
*
* @param \Aimeos\MShop\Common\Manager\Iface $manager Manager responsible for the items
* @param \stdClass $entry Object including "id" and "attributes" elements
* @return \Aimeos\MShop\Common\Item\Iface New or updated item
*/
protected function saveEntry( \Aimeos\MShop\Common\Manager\Iface $manager, \stdClass $entry ) : \Aimeos\MShop\Common\Item\Iface // this is the line 301
{
if( isset( $entry->id ) ) {
$item = $manager->get( $entry->id );
} else {
$item = $manager->create();
}
if( isset( $entry->attributes ) && ( $attr = (array) $entry->attributes ) )
{
if( $item instanceof \Aimeos\MShop\Common\Item\Config\Iface )
{
$key = str_replace( '/', '.', $this->path ) . '.config';
$attr[$key] = (array) ( $attr[$key] ?? [] );
}
$item = $item->fromArray( $attr, true );
}
$item = $manager->save( $item );
if( isset( $entry->relationships ) ) {
$this->saveRelationships( $manager, $item, $entry->relationships );
}
return $manager->get( $item->getId() );
}
Last edited by Ashley23 on 22 Dec 2023, 12:03, edited 1 time in total.
Re: Doesn't indexing the attribute or category models through this url: admin/default/jsonadm/index/catalog
Seems like you've sent a request with wrong data in the body.
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: Doesn't indexing the attribute or category models through this url: admin/default/jsonadm/index/catalog
Thanks for the response !
In the request body, there was:
Code: Select all
{"data": ["172"]}
And even I've tried with this:
Code: Select all
{"data": [172]}
Error: Attempt to assign property "id" on string in file ...aimeos/ai-admin-jsonadm/src/Admin/JsonAdm/Standard.php on line 653
Re: Doesn't indexing the attribute or category models through this url: admin/default/jsonadm/index/catalog
Do you use an endpoint different from admin/default/jsonadm/index for your request?
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: Doesn't indexing the attribute or category models through this url: admin/default/jsonadm/index/catalog
I've tried with this request (I think it's for indexing attributes?) which gives error:
Code: Select all
/admin/default/jsonadm/index/attribute?_token=.....
Code: Select all
/admin/default/jsonadm/index?_token=.....
Re: Doesn't indexing the attribute or category models through this url: admin/default/jsonadm/index/catalog
There is no specialized endpoint for indexing attributes and thus, the fallback to the standard endpoint is used. If you want to index a product attribute, you have to pass the product instead to the /index endpoint.
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