The error is thrown in app/code/core/Mage/Api2/Model/Resource.php
if (!is_string($orderField)
|| !array_key_exists($orderField, $this->getAvailableAttributes($this->getUserType(), $operation))
) {
$this->_critical(self::RESOURCE_COLLECTION_ORDERING_ERROR);
}
So I think your $orderField
is either not a string or the attribut is not available for your operation.
Following back the code from the above function, it retrieves the attributes from the modules resources/' . $node . '/attributes
XML nodes such as app/code/core/Mage/Catalog/etc/api2.xml
.
app/code/core/Mage/Catalog/etc/api2.xml
for example has a definition of:
<config>
<api2>
<resources>
<product> <!-- your $node -->
<attributes translate="..." module="api2">
<entity_id>Product ID</entity_id>
<type_id>Product Type</type_id>
<attribute_set_id>Attribute Set</attribute_set_id>
<stock_data>Inventory Data</stock_data>
<image_url>Default Image</image_url>
<is_saleable>Salability Status</is_saleable>
<total_reviews_count>Total Reviews Count</total_reviews_count>
<url>Product URL</url>
<buy_now_url>Buy Now URL</buy_now_url>
<has_custom_options>Has Custom Options</has_custom_options>
<is_in_stock>Stock Status</is_in_stock>
<regular_price_with_tax>Regular Price With Tax</regular_price_with_tax>
<regular_price_without_tax>Regular Price Without Tax</regular_price_without_tax>
<final_price_with_tax>Final Price With Tax</final_price_with_tax>
<final_price_without_tax>Final Price Without Tax</final_price_without_tax>
<use_config_gift_message_available>Use Config Settings for Allow Gift Message</use_config_gift_message_available>
<use_config_gift_wrapping_available>Use Config Settings for Allow Gift Wrapping</use_config_gift_wrapping_available>
<url_key_create_redirect>Create Permanent Redirect for old URL</url_key_create_redirect>
</attributes>
</product>
</resources>
</api2>
</config>
As I do not see a price
in there, I think that's the reason why you get the error.
order=price&dir=asc
parameters from? I cannot see a function for this on the API documentation page: magentocommerce.com/api/rest/Resources/Products/…