How can I create a new field in the "BASIC" section of the product card?
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: 27
- Joined: 02 Feb 2022, 10:43
How can I create a new field in the "BASIC" section of the product card?
Laravel version: 8.80
Aimeos version: 2021.10
PHP version: 8.0.8
WIN user
How can I create a new field in the "BASIC" section of the product card (in the admin panel), so that I can then filter products by this field? I duplicated the code of one component. based on it, I want to make my own field by which I can filter products. Where and in what area do you need to make changes?
Aimeos version: 2021.10
PHP version: 8.0.8
WIN user
How can I create a new field in the "BASIC" section of the product card (in the admin panel), so that I can then filter products by this field? I duplicated the code of one component. based on it, I want to make my own field by which I can filter products. Where and in what area do you need to make changes?
Re: How can I create a new field in the "BASIC" section of the product card?
First, you need to add a new column to the mshop_product table and create a decorator for the product manager so it will know how to save and search your new property:
https://aimeos.org/docs/latest/models/extend-managers/
Then, you can use that property in the list template:
- https://github.com/aimeos/ai-admin-jqad ... #L530-L548
- https://github.com/aimeos/ai-admin-jqad ... #L644-L668
- https://github.com/aimeos/ai-admin-jqad ... d.php#L512
Add the property in the item template too so editors can change it:
https://github.com/aimeos/ai-admin-jqad ... #L343-L357
That's all.
https://aimeos.org/docs/latest/models/extend-managers/
Then, you can use that property in the list template:
- https://github.com/aimeos/ai-admin-jqad ... #L530-L548
- https://github.com/aimeos/ai-admin-jqad ... #L644-L668
- https://github.com/aimeos/ai-admin-jqad ... d.php#L512
Add the property in the item template too so editors can change it:
https://github.com/aimeos/ai-admin-jqad ... #L343-L357
That's all.
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: 27
- Joined: 02 Feb 2022, 10:43
Re: How can I create a new field in the "BASIC" section of the product card?
I took "product.code" as a basis
and added my "product.modelfamily" field to the files:
1. aimeos\vendor\aimeos\ai-admin-jqadm\admin\jqadm\templates\product\list-standard.php
2. aimeos\vendor\aimeos\ai-admin-jqadm\admin\jqadm\templates\product\item-standard.php
3. aimeos\vendor\aimeos\ai-admin-jqadm\admin\jqadm\templates\product\item-selection-standard.php
4. aimeos\vendor\aimeos\aimeos-core\lib\mshoplib\config\mshop\product.php
5. aimeos\vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Product\Item\Iface.php
6. aimeos\vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Product\Item\Standard.php
7. aimeos\vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Product\Manager\Standard.php
after all the manipulations, I see a new column and the values in it. moreover, sorting in descending and ascending order works, as well as searching by ID
BUT, I can't enter data (correct, add or delete) in the product.modelfamily field from the admin panel. Only through the database. although a message about a successful operation appears
and added my "product.modelfamily" field to the files:
1. aimeos\vendor\aimeos\ai-admin-jqadm\admin\jqadm\templates\product\list-standard.php
2. aimeos\vendor\aimeos\ai-admin-jqadm\admin\jqadm\templates\product\item-standard.php
3. aimeos\vendor\aimeos\ai-admin-jqadm\admin\jqadm\templates\product\item-selection-standard.php
4. aimeos\vendor\aimeos\aimeos-core\lib\mshoplib\config\mshop\product.php
5. aimeos\vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Product\Item\Iface.php
6. aimeos\vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Product\Item\Standard.php
7. aimeos\vendor\aimeos\aimeos-core\lib\mshoplib\src\MShop\Product\Manager\Standard.php
after all the manipulations, I see a new column and the values in it. moreover, sorting in descending and ascending order works, as well as searching by ID
BUT, I can't enter data (correct, add or delete) in the product.modelfamily field from the admin panel. Only through the database. although a message about a successful operation appears
Re: How can I create a new field in the "BASIC" section of the product card?
Don't change the files in the Aimeos core or the Aimeos extensions!
You will loose all your changes when running "composer update"!
Instead, create your own extension:
https://aimeos.org/docs/latest/developer/extensions/
Implement a decorator to extend the product manager:
https://aimeos.org/docs/latest/models/extend-managers/
Copy and adapt the product/item-standard.php template in your own extension:
https://aimeos.org/docs/latest/admin/jq ... templates/
You will loose all your changes when running "composer update"!
Instead, create your own extension:
https://aimeos.org/docs/latest/developer/extensions/
Implement a decorator to extend the product manager:
https://aimeos.org/docs/latest/models/extend-managers/
Copy and adapt the product/item-standard.php template in your own extension:
https://aimeos.org/docs/latest/admin/jq ... templates/
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