Add a column in jqadm "product list" with a caracteristic of product

Help for integrating the Laravel package
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!
Stefanki
Posts: 9
Joined: 02 Feb 2022, 16:12

Add a column in jqadm "product list" with a caracteristic of product

Post by Stefanki » 14 Dec 2024, 09:35

Hello,

Here is my environnement (edit):
Aimeos: latest aimeos/aimeos(2024.10.2
php 8.3
linux ubuntu

The intention:
I added a "property" first in Product Property Types in jqadm, so i can edit it in every product, and for ease of use (it is just a Yes/No flag), i would like to add it to the html output (JQADM) in Catalog -> Product so we can check the value of this caracteristic for each product and sort by it.

The problem:
The value of the caracteristic displays but if i can't sort (by clicking on the column):
From the admin log it outputs:
Invalid name "product.property.mypropertytypecode"
aimeos-base/src/Criteria/SQL.php(190): Aimeos\Base\Criteria\Expression\Sort\SQL->toSource()

What i did:
I modified and overriden in list.php:

1) copied vendor list.php to packages/myextension/templates/admin/jqadm/product/list.php
2) added 'product.property.value' to $default
3) added 'product.property.mypropertytypecode' => $this->translate( 'admin', 'Test' ) to $columnList
4) in <?= $this->partial(
$this->config( 'admin/jqadm/partial/listsearch', 'listsearch' ), [
...
'product.property' => [
'op' => '=~',
'type' => 'attribute',
'val' => [
'mypropertytypecode:1' => $this->translate( 'admin', 'Test: Yes' ),
'mypropertytypecode:0' => $this->translate( 'admin', 'Test: No' ),
],
'type:property' => 'mypropertytypecode'
],
5) i also added this trying to respect the structure of html
<?php if( in_array( 'product.property.value', $fields ) ) : ?>
<td class="product-property-someclass">
<a class="items-field" href="<?= $url ?>">
<?php
$propertyItems = $item->getPropertyItems('mypropertytypecode');
if($propertyItems->first()) {
echo $enc->html($propertyItems->first()->getValue() == 1 ? 'Yes' : 'No');
} else {
echo '-';
}
?>
</a>
</td>
<?php endif ?>

Thank you in advance !

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

Re: Add a column in jqadm "product list" with a caracteristic of product

Post by aimeos » 16 Dec 2024, 13:50

You can only sort by column of the mshop_product table, not values of the mshop_product_property table in the list view.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Stefanki
Posts: 9
Joined: 02 Feb 2022, 16:12

Re: Add a column in jqadm "product list" with a caracteristic of product

Post by Stefanki » 16 Dec 2024, 22:55

So i was trying to do something impossible it is normal it did not work.



Thank you for answering !

Post Reply