Price rules
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!
Price rules
Hi guys
Here's what I did:
1- Define a new price rule (-5%) for category=XXX in: admin/default/jqadm/search/rule
2- Added product Y to the XXX category
Now fetching 'jsonapi/product?id=Y&include=product.price,catalog' results with the subtracted price (-5%) present under the 'included' key in the response:
Is it normal that removing 'catalog' from the include (like 'jsonapi/product?id=Y&include=product.price') causes the price rule not to take effect? (No -5% subtracted)
Plus I needed to have dateStart of the price rule which is not present in the response, so I thought maybe it's restricted on the user side.
I tried fetching 'admin/default/jsonadm/product?include=price,catalog' which does not work the same way and the price rule is not effective anyway (the normal price is shown).
I think I'm doing something the wrong way there. How can I have the start/end dates of the price rule?
Thanks so much for any help in advance
Aimeos: 2023.10
PHP: 8.1.2
Env: Linux
Here's what I did:
1- Define a new price rule (-5%) for category=XXX in: admin/default/jqadm/search/rule
2- Added product Y to the XXX category
Now fetching 'jsonapi/product?id=Y&include=product.price,catalog' results with the subtracted price (-5%) present under the 'included' key in the response:
Code: Select all
{
"meta": {
},
"links": {
},
"data": {
"relationships": {
"price": {
"data": [
{
"id": "101",
"type": "price",
"attributes": {
"product.lists.id": "425",
"product.lists.domain": "price",
"product.lists.refid": "101",
"product.lists.datestart": null,
"product.lists.dateend": null,
"product.lists.config": [],
"product.lists.position": 0,
"product.lists.status": 1,
"product.lists.type": "default"
}
}
]
}
}
},
"included": [
{
"id": "101",
"type": "price",
"attributes": {
"price.id": "101",
"price.type": "default",
"price.currencyid": "IRR",
"price.domain": "product",
"price.quantity": 1,
"price.value": "120750.00",
Plus I needed to have dateStart of the price rule which is not present in the response, so I thought maybe it's restricted on the user side.
I tried fetching 'admin/default/jsonadm/product?include=price,catalog' which does not work the same way and the price rule is not effective anyway (the normal price is shown).
I think I'm doing something the wrong way there. How can I have the start/end dates of the price rule?
Thanks so much for any help in advance
Aimeos: 2023.10
PHP: 8.1.2
Env: Linux
Re: Price rules
Yes, because your price rule needs to know if your product is in that category and it doesn't fetch that information from the database itself for performance reasons.
The start/end dates of price rules are internal data only and not communicated to clients at any time. You will never get that dates attached to prices as long as you don't implement an own price rule that adds it's own start/end dates to the price items.
The JSON admin API gives you raw data for managing the items, not the output required by the frontend.
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: Price rules
Thanks so much for the information.
Off the topic; is there a way to make ctime (created date time) of a domain (namely CMS) public so that it is shown in the searches of the client side (jsonapi)?
Re: Price rules
Makes sense to include that information for CMS items. It's now available if you execute:
See: https://github.com/aimeos/ai-cms-grapes ... d.php#L162
Code: Select all
composer req aimeos/ai-cms-grapesjs:2023.10.x-dev
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: Price rules
It's so great and useful. Thanks you so much