1

I am using Magento 1.9.2.1 and I am using the native swatches option. I am trying to only show the associated products on the catalog page and not the configurable product. But I am hoping that by clicking on any of the associated products, it would take the customer to the configurable product.

So lets say that I am selling a cap that has a red and brown option. I want the catalog to show the red simple product and the brown simple product. But when the customer clicks on either of the simple products, it will take them to the configurable product and they can select a color there instead.

Is there a easy way to do this?

  • I think you'd have to add individual redirects for each simple product. Or possibly if they have a similar naming convention, you could set wildcard redirects on your server. – ladle3000 Aug 18 '15 at 22:09
0

You need to implement some method like this (e.g. in data helper of your module):

/**
 * @param array $simpleIds
 *
 * @return array
 */
public function getConfigurableItems($simpleIds)
{
    $collection = Mage::getResourceModel('catalog/product_type_configurable_product_collection')
        ->setFlag('require_stock_items', true)
        ->setFlag('product_children', true);

    $collection->getSelect()->where('link_table.child_id IN (?)', $simpleIds)->columns(array('link_table.child_id'));
    $result = array();
    foreach ($collection as $item) {
        $result[$item->getChildId()] = $item;
    }

    return $result;
}

The output of it will be an array where key is ID of simple product and value is object of configurable product.

0

I was able to find the answer to my question on a differently worded question to the same question. The author has kindly provided a working extension. I have tried it and it is working perfectly.

Here is the original question: https://stackoverflow.com/questions/12956249/forward-to-configurable-product-when-opening-simple-product

Here is the extension: https://github.com/Mestrona/Mestrona_ForwardToConfigurable

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.