Jump to content

BO custom columns filter & sort issue


outlet.ee

Recommended Posts

I added 2 custom columns to the admin catalog, called 'supplier_reference' and 'myydyd' (meaning 'sold'). There is an extra field in DB for 'sold', and supplier reference field is already there in ps_product table.

The extra columns are showing but the filter and sorting for 'sold' do not work. Supplier reference filter works but sorting has issue with pagination.

Files modified:

src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/products_table.html.twig: added

          <th>
          {% include '@PrestaShop/Admin/Helpers/range_inputs.html.twig' with {
              'input_name': "filter_column_myydud",
              'min': '-1000000',
              'max': '1000000',
              'minLabel': "Min"|trans({}, 'Admin.Global'),
              'maxLabel': "Max"|trans({}, 'Admin.Global'),
              'value': filter_column_myydud,
              'disabled': filters_disabled,
            } %}
          </th>


src/PrestaShopBundle/Resources/views/Admin/Product/CatalogPage/Lists/list.html.twig: added  
 

        <td class="text-center">{{ product.myydud|default('0'|trans({}, 'Admin.Global')) }}</td>       


/src/PrestaShopBundle/Entity/AdminFilter.php: added

 

            'filter_column_supplier_reference' => FILTER_SANITIZE_STRING,
            'filter_column_myydud' =>[
                'filter' => FILTER_CALLBACK,
                'options' => $filterMinMax(FILTER_SANITIZE_NUMBER_INT),
            ],

/src/Adapter/Product/AdminProductDataProvider.php, added

 

            'supplier_reference' => ['table' => 'p', 'field' => 'supplier_reference', 'filtering' => self::FILTERING_LIKE_BOTH],
            'myydud' => ['table' => 'pc', 'field' => 'myydud', 'filtering' => ' %s '],      

 

Is there any more files to edit to make the filters ans sorting work, or more to edit at the files already edited?

 

    

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...