Ability to add products to Suggested products by ID

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!
santfather
Posts: 27
Joined: 02 Feb 2022, 10:43

Ability to add products to Suggested products by ID

Post by santfather » 14 Mar 2022, 11:11

Laravel version: 8.80
Aimeos version: 2021.10
PHP version: 8.0.8
In the product catalog in the admin panel, we have column CODE. While importing products using CSV in Suggested products by CODE everything works fine. But when I try to add products manually, I cannot use CODE but only LABEL.
Is it possible to add products not by LABEL?
Attachments
Screenshot_30.png
Screenshot_30.png (26.3 KiB) Viewed 2397 times
Last edited by santfather on 16 Mar 2022, 08:15, edited 1 time in total.

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

Re: Ability to add products to Suggested products by ID

Post by aimeos » 15 Mar 2022, 17:55

Can you explain in more detail? Don't know what's the problem and maybe describing the problem step by step helps.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

santfather
Posts: 27
Joined: 02 Feb 2022, 10:43

Re: Ability to add products to Suggested products by ID

Post by santfather » 16 Mar 2022, 08:14

the product catalog contains a large number of products (more than 250,000).
some SELECT-type products contain additional products that can be added to the Suggested products, Products bought together and Stylization blocks (made for an online store). To add products to these areas, you can use LABEL (or drop down list)or CODE (when importing products using CSV). the question is to be able to add products not by LABEL but by CODE
Screenshot_32.png
Screenshot_32.png (15.13 KiB) Viewed 2344 times
it doesn't work that way
Screenshot_33.png
Screenshot_33.png (113.15 KiB) Viewed 2344 times

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

Re: Ability to add products to Suggested products by ID

Post by aimeos » 16 Mar 2022, 08:30

The suggested items are fetched here:
https://github.com/aimeos/ai-admin-jqad ... ct.js#L677

If the "key" can be a list of keys too, then it's possible to do add OR condition here:
https://github.com/aimeos/ai-admin-jqad ... #L206-L212

Required change in product.js:

Code: Select all

Aimeos.getOptions(request, response, element, 'product', ['product.label', 'product.code'], 'product.label', null, labelFcn);
Required change in admin.js:

Code: Select all

var compare = {'||': []};
keys = Array.isArray(key) ? key : [key];

for(entry of keys) {
	let term = {};
	term[entry] = request.term;
	compare['||'].push({'=~': term});
}
list = criteria ? [compare, criteria] : compare;
Something like this. If you create a PR, we will merge it into the core so you don't have to overwrite and maintain it yourself :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

santfather
Posts: 27
Joined: 02 Feb 2022, 10:43

Re: Ability to add products to Suggested products by ID

Post by santfather » 16 Mar 2022, 08:37

Thanks for the reply. I will try

santfather
Posts: 27
Joined: 02 Feb 2022, 10:43

Re: Ability to add products to Suggested products by ID

Post by santfather » 16 Mar 2022, 09:11

yes. it helped. thank you very much

Post Reply