Aimeos frontend controller package for e-commerce projects
aimeos / ai-controller-frontend Goto Github PK
View Code? Open in Web Editor NEWAimeos frontend controler
License: GNU Lesser General Public License v3.0
Aimeos frontend controler
License: GNU Lesser General Public License v3.0
According to the documentation, the default sorting for products jsonapi is according to their positioning in the catalog.
This does not work properly without specifying a category with f_catid
.
Either the documentation should warn about this, or the default behaviour should be changed to reflect the documentation, ie. by default sorting by the root catalogs positions.
Another issue is that the relevance sorting option cannot be combined with other sorting options.
For example sort=text,-ctime
can create a primary and secondary sort criteria, but relevance cannot be used in this way.
For example the combination sort=relevance,-ctime&filter[f_catid]=1
does not work the same way as the previous example since the "relevance
sorting" is applied after the ctime
sorting.
If PRs are wanted I can probably fix this so that "relevance" is an actual sorting option that can be combined with other options, and is actually applied as deafult.
Relevant code:
// controller/frontend/src/Controller/Frontend/Product/Standard.php
public function sort( string $key = null ) : Iface
{
$list = $this->splitKeys( $key );
foreach( $list as $sortkey )
{
$direction = ( $sortkey[0] === '-' ? '-' : '+' );
$sortkey = ltrim( $sortkey, '+-' );
switch( $sortkey )
{
case 'relevance': // <---------------- Not actually a sort option, default sort implemented in category function only if cateogry filter is used
break;
case 'code':
$this->addExpression( $this->filter->sort( $direction, 'product.code' ) );
break;
case 'ctime':
$this->addExpression( $this->filter->sort( $direction, 'product.ctime' ) );
break;
...
}
}
}
// controller/frontend/src/Controller/Frontend/Product/Standard.php
public function category( $catIds, string $listtype = 'default', int $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE ) : Iface
{
if( !empty( $catIds ) && ( $ids = $this->validateIds( (array) $catIds ) ) !== [] ) // <------------------- Is only applied if f_catid is specified, but should according to docs be the default
{
if( $level != \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE )
{
$list = map();
$cntl = \Aimeos\Controller\Frontend::create( $this->getContext(), 'catalog' );
foreach( $ids as $catId ) {
$list->union( $cntl->root( $catId )->getTree( $level )->toList() );
}
$ids = $this->validateIds( $list->keys()->toArray() );
}
$func = $this->filter->make( 'index.catalog:position', [$listtype, $ids] );
$this->addExpression( $this->filter->compare( '==', 'index.catalog.id', $ids ) );
$this->addExpression( $this->filter->compare( '>=', $func, 0 ) );
$func = $this->filter->make( 'sort:index.catalog:position', [$listtype, $ids] );
$this->addExpression( $this->filter->sort( '+', $func ) );
$this->addExpression( $this->filter->sort( '+', 'product.id' ) ); // prevent flaky order if products have same position
}
return $this;
}
Hey, thanks for providing security updates.
We wanted to fix GHSA-m9gv-6p22-qgmj by updating our installation to 2022.10.8, but this doesn't show up on packagist yet.
I'm confused as the tag and commits are from last month, accordingly to GitHub web ui.
The error seems to exist for other tags and branches as well. Maybe there is something broken in auto updating packagist for this package?
add() method receives an array with data to add to the customer item but if you specify the customer password, it's ignored. add() method calls to fromArray() without the possibility to set private arg to true which is needed to set the password.
I have product with type "selection" which has no price itself, but has variant with price $100. When I try to apply filtering by price this product doesn't display in results (I tried in default theme and using jsonapi).
Environment
Checkout didn't have any delivery/payment service, even though applying aimeos:setup clear etc as well with demo data but didn't succeed. all the services are presented in admin as well in database.
After an update of the ai-controller-frontend from 6510433 to 8183c0c (because of CVE-2024-39325) we experience issues in the checkout process.
Once a user picks his/her delivery method, the error message 'Service “delivery” already in basket' appears. The user cannot continue the checkout process.
We reverted the update for now and will investigate whether it is something special with our custom installation. In case other people experience the same issue, please let me know.
We are on aimeos/aimeos-typo3 b0e92f22
, so I guess our installation is pretty old.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.