Get data from another template
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Get data from another template
Hey! I'm trying to create filter by price (range slider).
I'm passing range values (min and max) by url.
After extending list standard class and retrieving products that matchs range: i'm passing some params into view: The question is: how can i get them in another template like attribute-body-standard?
If it's not possible, what should i do to get min and max values in attribute template?
I'm passing range values (min and max) by url.
After extending list standard class and retrieving products that matchs range: i'm passing some params into view: The question is: how can i get them in another template like attribute-body-standard?
If it's not possible, what should i do to get min and max values in attribute template?
Re: Get data from another template
You can implement your code in a decorator which you can configure for all clients where you need the values in their templates: https://aimeos.org/docs/Developers/Html ... components
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: Get data from another template
I created my own decorator. Now i need to compare each product price with min and max values. I'm trying to do smth like that in my decorator:
What is wrong with my query? Or how can i access each product price and compare it value with my min and max.
Sorry, cann't find any information about this in docs.
Code: Select all
$products = \Aimeos\Controller\Frontend::create( $context, 'product' )->uses( $domains );
$items = $products->compare('>', 'product.price.value', 20)->search();
Sorry, cann't find any information about this in docs.
Re: Get data from another template
What you are looking for is "index.price:value":
https://github.com/aimeos/aimeos-core/b ... rd.php#L35
https://github.com/aimeos/aimeos-core/b ... rd.php#L35
Code: Select all
$cntl = \Aimeos\Controller\Frontend::create( $context, 'product' )->uses( $domains );
$items = $cntl->compare('>=', 'index.price:value', 20)->compare('<', 'index.price:value', 40)->search();
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: Get data from another template
Thank you very match!
For it works i also added currency:
Is it good idea to fetch all products again in my decorator if price sorting is required or better configure new standard class?
For it works i also added currency:
Code: Select all
$cntl = \Aimeos\Controller\Frontend::create( $context, 'product' )->uses( $domains );
$items = $cntl->compare('>=', 'index.price:value("'.$currencyid.'")', 20)->search();
Re: Get data from another template
If the HTML client already adds the products to the view, you only have to wait until its method has been called, e.g.
Code: Select all
public function addData( \Aimeos\MW\View\Iface $view, array &$tags = [], &$expire = null )
{
$view = $this->client->addData( $view, $tags, $expire );
// now use $view->listProductItems
return $view;
}
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