0

I have some simple products which are associated to a grouped product.

If I load the simple product separately, the attribute tax_class_id is set, but if the product is contained in a grouped product (fetched in \Example_CatalogGrouped_Model_Product_Type_Grouped::getAssociatedProducts), the tax_class_id is empty.

In the backend, the value is present.

Logging the SQL queries revealed, that the data is loaded from the EAV.

The query contains the following part (attribute id of tax_class_id is 85), but the value is not present in the result:

Checking the query which loaded the products, there is a the condition

UNION ALL SELECT
            `t_d`.`entity_id`,
            `t_d`.`attribute_id`,
            `t_d`.`value`                                  AS `default_value`,
            `t_s`.`value`                                  AS `store_value`,
            IF(t_s.value_id IS NULL, t_d.value, t_s.value) AS `value`
          FROM `catalog_product_entity_int` AS `t_d`
            LEFT JOIN `catalog_product_entity_int` AS `t_s`
              ON t_s.attribute_id = t_d.attribute_id AND t_s.entity_id = t_d.entity_id AND t_s.store_id = 1
          WHERE (t_d.entity_id IN (7497)) AND (t_d.attribute_id IN
                   ( .... , '85', .... ))
                AND (t_d.store_id = 0)
0

Make sure that entity_type_id is set properly to 4 in catalog_product_entity_int. While is this not needed while loading the product normally, in this specific case it seems to matter.

  • 1
    I'd was not everyone will need this hard-coded to 4. Entity type IDs will vary depending on how you built up a store. Checkout the eav_entity_type table. – Alan Storm Aug 12 '13 at 21:38

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.