Magento: Get parent id of simple product associated to configurable product
Scenario:
A simple product is associated with a configurable product. You have the id of the simple product. Now, you need the id of the configurable product with which the simple product is associated.
Get parent product id, i.e. get id of configurable product from a simple product.
$_product = Mage::getModel('catalog/product')->load(YOUR_SIMPLE_PRODUCT_ID);
$parentIdArray = $_product->loadParentProductIds()->getData('parent_product_ids');
print_r($parentIdArray);
Related posts:
- Magento: Get order option of configurable and bundle product in cart
- Magento: How to get all associated children product of a configurable product?
- Magento: Get Product Collection by Type
- Magento: Fatal error: Call to a member function getTable() on a non-object
- Magento: Load store specific product
- Magento: How to filter product collection using 2 or more category filters?
- Magento: Product Edit Warning: Invalid argument supplied for foreach()
- Magento: Get category name and url from product
- Magento: Product is still visible in catalog and search even after changing visibility to nowhere
- Magento: Get manufacturer name and id from product
