0

I am soon going to be migrating to a fresh install of Magento CE 1.9 and we currently have tons of grouped products with many simple products associated with them.

I need to be able to retain the simple products position on the grouped products' page.

I have searched the database for the associated products position value, but I am not having any luck. I also am not having luck reading the code for the catalog/product model.

I'm using CE 1.6.2.0 if that helps

  • With fresh you mean, you're not going to upgrade, but import entities into a clean install? Aka a rebuild? In that case you're going to have to do an import and export with carefully selected attributes. While preparing that export using for example the dataflow profiles, this bit should become apparent. – Melvyn Mar 11 '15 at 18:36
  • @Melvyn I've tried dataflow profiles. I used the "Export all products" profile on a sku with a known position ("9") and that value doesn't show up in the export. It isn't an attribute, or if it is, it is only visible on the "Associated Products" tab of a grouped product – David Wilkins Mar 11 '15 at 19:21
2

Run this query, and you'll get the positions of the simple products associated with the grouped products. I've added extra columns for demonstration, but you'll get the idea.

SELECT p.entity_id,p.sku AS parent_sku,p2.entity_id,p2.sku AS child_sku,i.value AS position
FROM `catalog_product_link` AS l
    INNER JOIN `catalog_product_entity` AS p
        ON l.`product_id` = p.`entity_id`
    INNER JOIN `catalog_product_entity` AS p2
        ON l.`linked_product_id` = p2.`entity_id`
    INNER JOIN `catalog_product_link_attribute_int` AS i
        ON l.`link_id` = i.`link_id`
WHERE p.`type_id` = 'grouped'
    AND l.`link_type_id` = 3 -- product association
ORDER BY p.`sku`

For migration purposes, this is fine. You could easily make this into a Varien_Db_Select object as well, if you feel comfortable seeing neat code.

  • @DavidWilkins, glad it worked! – musicliftsme Mar 12 '15 at 1:31

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.