1

When I am trying to update a category through API I get Fatal error: Uncaught SoapFault exception: [103] Default Product Listing Sort by does not exist in Available Product Listing Sort By. My call is:

$catResult = $proxy->call($session, 'catalog_category.update', array(181, array(
                'is_anchor' => 1,
                'include_in_menu' => 0,
                'available_sort_by' => "",
                'default_sort_by' => "",
            )));

I searched but I couldn't find anything that could fix this issue. I saw that at some point it is was a reported bug...but it should be fix by now. Does anyone know what is the problem? I want that my category to have default settings set.

3

The error indicates that the value for the default_sort_by field is invalid, because you use a empty value. Depending on the field that you want to use for sorting you need to enter it here, for example you could use position:

$result = $client->call($session, 'catalog_category.update', array(181, array(
                'is_anchor' => 1,
                'include_in_menu' => 0,
                'available_sort_by' => "position",
                'default_sort_by' => "position",
            )));

The code above should work, other options that are there by default are 'name' and 'price'. If you want another attribute to use as sortable field, you can set the option 'Used for Sorting in Product Listing' to 'Yes' for the attribute thru that admin option Catalog => Attributes => Manage Attributes

  • I want to achieve Available Product Listing Sort By -> Use All Available Attributes and Default Product Listing Sort By -> Use Config Settings. Those the checkboxes to be checked. – Denisa Oct 7 '14 at 20:34
  • Looking at the API code it looks like this is not implemented. The value should be set to null (like done in the CategoryController in the backend when the checkbox is selected), this will cause the record to be removed from the EAV table and therefore let Magento use the default values. The only option I can think of is writing your own API category update function to extend the current Magento API function to allow you to use the default value. – Vladimir Kerkhoff Oct 7 '14 at 21:01
  • 1
    Just did another quick test, if you set the value to false for both available_sort_by and default_sort_by it will set to use the default value. – Vladimir Kerkhoff Oct 7 '14 at 21:03
  • Yes..you are right..I tried with NULL because that is the value in database...seems I was totally wrong. Checked with false and seems fine. Thank you very much. – Denisa Oct 7 '14 at 21:37
  • @Denisa did you achieve this by only changing it to 'available_sort_by' => "false" 'default_sort_by' => "false" because that isn't working for me sadly.. – NoSixties Feb 10 '17 at 10:52
1

avaible_sort_by expects more than one parameter, so you need to use array:

$result = $client->call($session, 'catalog_category.update', array(181, array(<br/>
                'is_anchor' => 1,
                'include_in_menu' => 0,
                'available_sort_by' => array('position'),
                'default_sort_by' => 'position',
            )));
0

If you want set default_sort_by as null and use _config, try set store_id to 0 (if it possible set store_id by API). Because catalog_category_entity_varchar table have store_id with 0 value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.