4

Fatal error: Uncaught SoapFault exception: [1] Default Product Listing Sort by does not exist in Available Product Listing Sort By.

I cannot figure out why Magento keeps giving me this error? Using the default sort by position.

    $result = $client->catalogCategoryCreate($session, 2, array(
    'name' => $cat_name,
    'is_active' => 1,
    'available_sort_by' => array('position'),
    'custom_design' => null,
    'custom_apply_to_products' => null,
    'custom_design_from' => null,
    'custom_design_to' => null,
    'custom_layout_update' => null,
    'default_sort_by' => 'position',
    'description' => $cat_name,
    'display_mode' => null,
    'is_anchor' => 0,
    'landing_page' => null,
    'meta_description' => $cat_name,
    'meta_keywords' => $cat_name,
    'meta_title' => $cat_name,
    'page_layout' => 'two_columns_left',
    'url_key' => $cat_url,
    'include_in_menu' => 1,
));

// Print Result = New Category ID
// var_dump ($result);

return $result;

It was working perfectly fine until last Wednesday when the Schema server went down for couple of hours. Any idea how to by pass the error, or fix it?

UPDATED - Problem "Resolved"

I changed from v2 SOAP, to just plain SOAP. Had to modify the API call a bit. It appears there is a problem with v2 SOAP...

$result = $client->call($session, 'catalog_category.create', array(2, array(
    'name' => $cat_name,
    'is_active' => 1,
    'available_sort_by' => 'position',
    'custom_design' => null,
    'custom_apply_to_products' => null,
    'custom_design_from' => null,
    'custom_design_to' => null,
    'custom_layout_update' => null,
    'default_sort_by' => 'position',
    'description' => $cat_name,
    'display_mode' => null,
    'is_anchor' => 1,
    'landing_page' => null,
    'meta_description' => $cat_name,
    'meta_keywords' => $cat_name,
    'meta_title' => $cat_name,
    'page_layout' => 'two_columns_left',
    'url_key' => $cat_url,
    'include_in_menu' => 0,
)));
  • 2
    Well I sort of fixed the problem... I changed the API from v2 SOAP to just plain SOAP. I had to modify my API requests for the change as they're not the same. See notes above... – JCastell Dec 28 '15 at 19:44
  • Add your answer and accept it, its okay to do such. – B00MER Dec 28 '15 at 22:12
1
+25

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:

for example:

$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

or other solution is:

I changed the settings in all store views, but it didn't changed in all sotre views. When I tried to change the setting Use Default Value in my "languagesviews". I get the error "Default Product Listing Sort by not exists on Available Product Listing Sort By".

So I "just" need to change all categorysettings of each language.

EDIT:

After editing some categories and checking/unchecking "use default values" the error is gone and I set all "use default values" to yes.

so you need to check the checkbox default use in display settings.

I hope this will help you.

|improve this answer|||||
  • Thanks for your answer, but as I specified I am using the default POSITION for the sort by, but it is still producing this error which makes no sense to me... In addition, your code is invalid... available_sort_by expects an ARRAY and not a value. – JCastell Dec 28 '15 at 17:07
  • Please choose default settings from admin dispay settings I hope this can be a trick for your question to solve errors. – Denish Vachhani Dec 28 '15 at 17:11
  • That did not help either, it's like it cannot find POSITION which is a default sort by attribute. Which is extremely weird. The above code was working perfectly for weeks straight, until Schema went down for a few hours... since then I've been getting this error... – JCastell Dec 28 '15 at 17:25
  • Have you any previous back up? For db also? – Denish Vachhani Dec 28 '15 at 17:27
  • Also try to print_r($result). Because this error raise when default parameters pass with null value. – Denish Vachhani Dec 28 '15 at 17:37

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.