Attribute sorting [SOLVED]

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
goransabo
Posts: 33
Joined: 30 Nov 2020, 17:54

Attribute sorting [SOLVED]

Post by goransabo » 19 Dec 2020, 11:48

Hello!
I have one problem with attribute sorting by position or id!
ID and pos (in db) is correct, but on frontend attributes have incorrect position!
Screenshot in attachment!
Best regards,
Goran

// Typo3 10.4.11 / Aimeos 20.10.4 / PHP 7.3 / Linux //
Attachments
frontend-sort.png
frontend-sort.png (23.14 KiB) Viewed 1904 times
db-sort.png
db-sort.png (131.61 KiB) Viewed 1904 times
Last edited by goransabo on 22 Dec 2020, 19:44, edited 1 time in total.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Attribute sorting

Post by aimeos » 22 Dec 2020, 11:06

What's the sorting in the attribute subpanel of the product?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

goransabo
Posts: 33
Joined: 30 Nov 2020, 17:54

Re: Attribute sorting

Post by goransabo » 22 Dec 2020, 12:09

in frontend sorting is incorrect!

goransabo
Posts: 33
Joined: 30 Nov 2020, 17:54

Re: Attribute sorting [SOLVED]

Post by goransabo » 22 Dec 2020, 19:43

Here is fix for the problem with correct sort of attributes on product detail page:
In Resources/Private/Extensions/ai-client-html/slient/html/templates/common/partials/attribute-standard.php you need to find 131 line:

Code: Select all

<?php if( $this->config( 'client/html/catalog/attribute/preselect/' . $code, false ) === false ) : ?>
<option class="select-option" value=""><?= $enc->html( $this->translate( 'client', 'none' ) ); ?></option>
<?php endif; ?>
add this: <?php ksort($attributes);?>
<?php foreach( $attributes as $id => $attribute ) : ?>
<option class="select-option" value="<?= $enc->attr( $id ); ?>">
<?= $enc->html( $this->attrname( $attribute ) ) ?>
</option>
<?php endforeach; ?>

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: Attribute sorting [SOLVED]

Post by aimeos » 24 Dec 2020, 09:07

The attributes are sorted by the order you have added them in the product detail panel of the admin backend, not by the position of the attributes themselves. Thus, you can have a different sorting for different products.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply