favorite icon
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!
Re: favorite icon
You can enable/disable them using this configuration:
https://aimeos.org/docs/2020.x/config/c ... ions/#list
Add new ones in your own version of this template:
https://github.com/aimeos/ai-client-htm ... andard.php
https://aimeos.org/docs/2020.x/config/c ... ions/#list
Add new ones in your own version of this template:
https://github.com/aimeos/ai-client-htm ... andard.php
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: favorite icon
I edited template. I'm interested in how to determine if a product is on the favorites list. For change icon in template.aimeos wrote: ↑16 Nov 2020, 10:41 You can enable/disable them using this configuration:
https://aimeos.org/docs/2020.x/config/c ... ions/#list
Add new ones in your own version of this template:
https://github.com/aimeos/ai-client-htm ... andard.php
Re: favorite icon
You may use the JSON REST API to check if the product is in the customers favorite list:
https://aimeos.org/docs/latest/frontend ... relations/
https://aimeos.org/docs/latest/frontend ... relations/
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: favorite icon
How get customers favorite list, in template?aimeos wrote: ↑18 Nov 2020, 08:05 You may use the JSON REST API to check if the product is in the customers favorite list:
https://aimeos.org/docs/latest/frontend ... relations/
Re: favorite icon
Use the jQuery example from the docs:
This requires the customer to be logged in. Contrary, pinned products are session based without the need to log in.
Code: Select all
var url = response['links']['customer/relationships']['href']; // from customer response
var args = {include: "product"};
var params = {};
if(options.meta.prefix) { // returned from OPTIONS call
params[options.meta.prefix] = args;
} else {
params = args
}
$.ajax({
url: url,
method: "GET",
dataType: "json",
data: params
}).done( function( result ) {
console.log( result.data );
});
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: favorite icon
aimeos wrote: ↑21 Nov 2020, 10:16 Use the jQuery example from the docs:This requires the customer to be logged in. Contrary, pinned products are session based without the need to log in.Code: Select all
var url = response['links']['customer/relationships']['href']; // from customer response var args = {include: "product"}; var params = {}; if(options.meta.prefix) { // returned from OPTIONS call params[options.meta.prefix] = args; } else { params = args } $.ajax({ url: url, method: "GET", dataType: "json", data: params }).done( function( result ) { console.log( result.data ); });
Code: Select all
const url = '/jsonapi/customer'
const params = {
related: 'relationships',
include: 'product',
filter: {
'==': {'customer.lists.type': 'favorite'}
},
fields: {
'customer/lists': 'id'
}
}
$.ajax({
url: url,
method: "GET",
dataType: "json",
data: params
}).done( function( result ) {
console.log( result.data )
})
Re: favorite icon
Yes, the endpoint doesn't support filtering but you can limit the returned fields using:
Code: Select all
const url = '/jsonapi/customer';
const params = {
related: 'relationships',
include: 'product',
fields: {
'customer/lists': 'customer.lists.refid,customer.lists.type'
}
};
$.ajax({
url: url,
method: "GET",
dataType: "json",
data: params
}).done( function( result ) {
console.log( result.data )
});
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: favorite icon
Thanks! Is it possible to exclude from the response "links"?aimeos wrote: ↑25 Nov 2020, 18:03 Yes, the endpoint doesn't support filtering but you can limit the returned fields using:Code: Select all
const url = '/jsonapi/customer'; const params = { related: 'relationships', include: 'product', fields: { 'customer/lists': 'customer.lists.refid,customer.lists.type' } }; $.ajax({ url: url, method: "GET", dataType: "json", data: params }).done( function( result ) { console.log( result.data ) });
I create action add product to cart "jsonapi/basket?Id=default&related=product". In response come a lot of unnecessary data. How to leave only data/attributes?
Re: favorite icon
No, the links section is required by the jsonapi.org standard which this API follows.
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