Questions around the TYPO3 integration and plugins as well as Flow and NeosCMS
Forum rules: Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#1569 by aksenovaa
27 Apr 2015, 12:37
As an option to get rid of too-long URL, created a setting for RealURL:
Code: Select all...
'fixedPostVars' =>
          array(
               'aimeosListConfiguration' => array(
                                array(
                                                'GETvar' => 'ai[f_catid]',
                                                'noMatch' => 'bypass',
                                        ),
                                 array(
                                                'GETvar' => 'ai[f_name]',
                                                'noMatch' => 'bypass',
                                        ),
                         array(
                                     'GETvar'   => 'ai[f_sort]',
                                     'valueMap' =>
                                           array(
                                                 'name'      => 'name',
                                                 '-name'     => '-name',
                                                 'price'     => 'price',
                                                 '-price'    => '-price',
                                                 'relevance' => 'relevance',
                                           ),
                                     'noMatch'  => 'bypass',
                               ),
//                                array (
//                                        'GETvar' => 'ai[f_search]',
////                                        'noMatch' => 'bypass',
//                                      ),
//                                array (
//                                        'GETvar' => 'ai[f_attrid][57]',
//                                        'noMatch' => 'bypass',
//                                      ),
                         array(
                                  'GETvar'  => 'ai[l_page]',
                                  'noMatch' => 'bypass',
                            ),
                      ),
                'aimeosDetailConfiguration' => array(
                      0 =>
                            array(
                                  'GETvar'  => 'ai[d_prodid]',
                            ),
                      1 =>
                            array(
                                  'GETvar'  => 'ai[d_name]',
                                  'noMatch' => 'bypass',
                            ),
                      2 =>
                            array(
                                  'GETvar'  => 'ai[l_pos]',
                            ),
                ),
                '28' => 'aimeosDetailConfiguration',
                '29' => 'aimeosListConfiguration',
          ),
...

Where
aimeosListConfiguration - settings for the page with List of products and Filter plugin
aimeosDetailConfiguration - settings for the page with Detail of product
28 - ID page with Detail of product
29 - ID page with List of products and Filter plugin
Accordingly, get rid of these settings postVarSets:
Code: Select all    'postVarSets' =>
    array (
      '_DEFAULT' =>
      array (
        'aimeos' =>
        array (
          0 =>
          array (
            'GETvar' => 'ai[controller]',
            'noMatch' => 'bypass',
          ),
          1 =>
          array (
            'GETvar' => 'ai[action]',
            'noMatch' => 'bypass',
          ),
        ),
//        'f' =>
//        array (
//          0 =>
//          array (
//            'GETvar' => 'ai[f_catid]',
//          ),
//          1 =>
//          array (
//            'GETvar' => 'ai[f_name]',
//          ),
//          2 =>
//          array (
//            'GETvar' => 'ai[f_sort]',
//            'valueMap' =>
//            array (
//              'name' => 'name',
//              '-name' => '-name',
//              'price' => 'price',
//              '-price' => '-price',
//              'relevance' => 'relevance',
//            ),
//            'noMatch' => 'bypass',
//          ),
//          3 =>
//          array (
//            'GETvar' => 'ai[l_page]',
//          ),
//        ),
//        'd' =>
//        array (
//          0 =>
//          array (
//            'GETvar' => 'ai[d_prodid]',
//          ),
//          1 =>
//          array (
//            'GETvar' => 'ai[d_name]',
//          ),
//          2 =>
//          array (
//            'GETvar' => 'ai[l_pos]',
//          ),
//        ),

At the same time we get a short URL, like this:
.../list/name/
.../list/-name/
.../detail/1/0/
and so on...

But was unable to configure the URL to filter by attributes:
/list/name/?ai%5Bf_search%5D=&ai%5Bf_attrid%5D%5B56%5D=в+наличии

That is, the parameters are still there ai[f_search]=
How to remove empty ai[f_search] ?

and I do not know how to configure attributes: ai[f_attrid][56]=в+наличии
That is how to take account this:
List of attribute IDs and names the user has filtered for. They are of the form "f_attrid[<id>]=<name>"
It turns out that for each attribute you need to do their setting?
ai[f_attrid][1]
ai[f_attrid][2]
...
ai[f_attrid][ID_n]

Or something like this can be avoided
#1570 by aimeos
27 Apr 2015, 14:11
aksenovaa wrote:At the same time we get a short URL, like this:
.../list/name/
.../list/-name/
.../detail/1/0/
and so on...


That looks great. Really cool stuff!

aksenovaa wrote:But was unable to configure the URL to filter by attributes:
/list/name/?ai%5Bf_search%5D=&ai%5Bf_attrid%5D%5B56%5D=в+наличии

That is, the parameters are still there ai[f_search]=
How to remove empty ai[f_search] ?


That's a good question. This parameter annoys me too because it's always sent when the filter form is submitted, even if the search field contains no value. It seems that you can only prevent the input field from being submitted via Javascript: http://stackoverflow.com/questions/3223365/how-to-prevent-form-element-from-sending-some-fields-we-dont-want

aksenovaa wrote:and I do not know how to configure attributes: ai[f_attrid][56]=в+наличии
That is how to take account this:
List of attribute IDs and names the user has filtered for. They are of the form "f_attrid[<id>]=<name>"
It turns out that for each attribute you need to do their setting?
ai[f_attrid][1]
ai[f_attrid][2]
...
ai[f_attrid][ID_n]

Or something like this can be avoided


The filter attributes might be hard to translate with RealURL. As you've already pointed out, there can be one or more submitted and we need at least the ID. In theory we could use Javascript again to create something like "ai[f_attrid]=1+2+...+n" but for a customer this means nothing.