Aimeos 2020.04 release

2020.04 is the first stable release this year which contains a lot of changes and improvements. The most important one are:

  • Slick and clean frontend theme
  • Better admin interface usability
  • Major performance improvement when using MySQL
  • SEO improvements and support for fractional quantities
  • Cleaned up templates for the HTML client
  • Full SQL Server support
  • Requires PHP 7.1 and PHP Map object
  • Retrieve related items more easily

Slick and clean frontend theme

Thanks to our partner business unicorns who created a new design for Aimeos, the default frontend theme is now much more pleasing. From the technical point of view, it’s using CSS3 variables for the colors so it’s extremely easy to apply your own CI colors to the theme. Only include a CSS file before the Aimeos CSS which contains your own colors in:

.aimeos {
  --ai-primary: #FFA840;
  --ai-primary-light: #FFB850;
  --ai-secondary: #555;
  --ai-light: #D0D0D0;
  --ai-bg: #FFF;
}

Better admin interface usability

Especially the product panel had a lot of tabs and fields visible by default even if they are not necessary for the the majority of editors. They are reduced to the essential parts used in 80% of all cases like shown in the screenshot. Especially first time users now know exactly which fields and tabs are important to create their first products.

The advanced tabs and fields are still available but only after clicking on the drop-down icon in the tab list or below the shown form fields. This does also work using a smart phone, even if the tabs are then placed horizontally above the form fields.

Major performance improvement

When using the ai-sites extension from the Aimeos company in market place mode, MySQL stopped using indexes when the number of site IDs in the queries where more than a few. This led to a major performance decrease when market places had hundreds of vendors and a lot of products.

In 2020.04, the site IDs contains the parent site IDs too and form a path to the site in the site tree, e.g. “1.2.5.”. Now, retrieving all products for all vendors is simple for MySQL because the site ID just has to start with the parent site, e.g. “1.”. Thus, the existing indexes are always used by MySQL. Other database servers like PostgreSQL were not affected but will profit from the simpler queries too.

SEO and fractional quantities

For the URL segment of product URLs either the language dependent texts of type “url-segment” added by the editor where used or the sanitized label. Now it’a also possible to define a language indepented URL segment that is different from the label in the product panel. This does also apply to the categories.

Selling non-standard products where customers can also buy pieces is now possible without custom code. The “quantity scale” of each product defines the minimum amount a customer can buy, e.g. 100g if the standard price is per kilogram or 0,25m² for areal sized products. It’s also possible to define quantity scales larger than one.

HTML client templates

One often heard critisism about Aimeos was that the HTML templates contained not only HTML code and a few statements for conditions and loops to generate the final output but also PHP code to transform the data from the items to the requirements of the templates.

This code is now part of the client classes or has been moved to view helpers. Therefore the templates itself are now much cleaner and contain much less code so they are simpler to understand for integrators and frontend developers.

Full SQL Server support

Besides MySQL/MariaDB and PostgreSQL, Microsoft SQL Server is now the third relational database manament system fully supported by Aimeos. You can use both, SQL Server 2015+ installed on-premise or the variant available in the Azure cloud.

All Aimeos feature are available including ultra-fast full text search, provided the Microsoft full text search plugin is installed. Otherwise, only the slow LIKE based search is available, which isn’t suitable for several thousand products and more.

PHP 7.1 and PHP Map object

Version 2020.04 and later requires at least PHP 7.1 because the Aimeos code base now makes full use of scalar type hints as well as return type checking for all methods. Thus, the PHP interpreter can throw type exceptions much earlier which simplifies debugging for developers.

Also Aimeos uses the Map object from the aimeos/map package instead of arrays as return value of searchItems() and whenever it simplifies the code. Instead of:

$list = [['id' => 'one', 'value' => 'value1'], ['id' => 'two', 'value' => 'value2'], null];
 
$list[] = ['id' => 'three', 'value' => 'value3'];    // add element
unset( $list[0] );                                   // remove element
$list = array_filter( $list );                       // remove empty values
sort( $list );                                       // sort elements
$pairs = array_column( $list, 'value', 'id' );       // create ['three' => 'value3']
$value = reset( $pairs ) ?: null;                    // return first value

You can now write:

$list = [['id' => 'one', 'value' => 'value1'], ['id' => 'two', 'value' => 'value2'], null];
 
$value = map( $list )                                // create Map
    ->push( ['id' => 'three', 'value' => 'value3'] ) // add element
    ->remove( 0 )                                    // remove element
    ->filter()                                       // remove empty values
    ->sort()                                         // sort elements
    ->col( 'value', 'id' )                           // create ['three' => 'value3']
    ->first();                                       // return first value

That saved some hundred lines of code in the current code base compared to 2019.x and before.

Retrieve related items more easily

Last but not least, several methods for retrieving related items are available now. This simplifies custom code because instead of writing code to fetch categories, suppliers, stocks and order base data yourself, you can now simply tell searchItems() what you need:

$products = $manager->searchItems( $filter, ['catalog', 'stock', 'supplier'] );
foreach( $products as $product )
{
    $product->getCatalogItems();
    $product->getSupplierItems();
    $product->getStockItems();
}

The same works in the order domain where you can order items including their base items, ordered products, address data, used coupons and delivery/payment service data:

$domains = ['order/base', 'order/base/address', 'order/base/coupon', 'order/base/product', 'order/base/service'];
$orders = $manager->searchItems( $filter, $domains );
foreach( $orders as $order )
{
    $basket = $order->getOrderBaseItem();
    $basket->getAddresses();
    $basket->getCoupons();
    $basket->getProducts();
    $basket->getServices();
}

Final words

All breaking changes between 2019.10 and 2020.04 are available in the changelog. If you want to upgrade from an earlier version, please check the list carefully and adapt your code. In custom code, you especially need to care about changed method signatures due to the the PHP 7.1 type hints.

Leave a Reply

Your email address will not be published. Required fields are marked *