Comment 3 for bug 1071378

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Using Magento 1.6.1.0. Got the same problem.

The error originates from app/code/core/Mage/Catalog/Model/Category/Attribute/Backend/Sortby.php, when the default sorting field is not in the list of available sort orders. This is always the case when 'Use Default Config' is set, because then the list is empty.

I gather from the PHP code in this file that the connector should set up an array value for a field 'use_post_data_config' that contains 'available_sort_by' if 'Use Default Config' is set on the category. Also, the field 'available_sort_by' should then by absent from the list of values sent to Magento. Only then will it retrieve the list of default sorting fields to check if the sorting field for this particular category is valid.

I have added a mapping line to the template and it gets sent over the wire as expected. Unfortunately, when Magento reads it out using "$object->getData('use_post_data_config')" it is not there so my problem is not yet solved.

Here is the mapping line:

magentoerpconnect.mag1500_product_category_use_post_data_config,magentoerpconnect.mag1500_product_category,use_post_data_config,,out,function,unicode,,False,False,"use_config_fields = []
if 'default_sort_by' in resource:
    cat_attr_option = 'None'
    if resource['default_sort_by']:
        cat_attr_option = self.pool.get('magerp.product_category_attribute_options').browse(cr, uid, resource['default_sort_by'][0], context=context)
    if cat_attr_option.value == 'None':
        use_config_fields.append('default_sort_by')
if resource.get('use_default_available_sort_by'):
    use_config_fields.append(u'available_sort_by')
if use_config_fields:
    result = [(u'use_post_data_config', use_config_fields)]
else:
    result = []"

I would like to know if I am on the right path. Has anyone got a notion of this 'use_post_data_config' key, and do you think it should be used in the connector like I think it does?