I know how to check if a product is configurable or not. But anyone tell me how to check if a product is pure simple product that means I want to check those products which I created as Attribute set= 'Default' and Product type= 'Simple Product' not attribute set= 'Default' and Product type= 'configurable Product'.


4 Answers 4


Simply I did: (Magento 1.8)

if($_product->isConfigurable()) {
   echo 'config'; 

What you can do is use the function getParentIdsByChild on the class Mage_Catalog_Model_Product_Type_Configurable. This function takes in a possible child product id and will return an array of parent ids if there are any.

$parentIds = Mage::getModel('catalog/product_type_configurable')->getParentIdsByChild($productId);

If there are no parent ids then the array will be empty so you can simply check for an empty array to make sure that the product you have has no parent ids.


I did it by myself. Here's is the code.

$p= Mage::getModel('catalog/product')->load($prd['product_id']);

$attributeSetModel = Mage::getModel("eav/entity_attribute_set");
$attributeSetName  = $attributeSetModel->getAttributeSetName();

if($attributeSetName=='Default' && $p->getTypeId()=='simple') {

      echo "This is a pure simple products";

Or if you want the find all pure simple products and the configurable product but not the child product of a configurable product then use this code :

if($p->isConfigurable() || ($attributeSetName=='Default' && $p->getTypeID()=='simple')) {

  echo "It consists of both pure simple products and the configurable product but not the child product of a configurable product";


I'm not 100% sure what do you want to achieve, but either way this is not how to determine if the product belongs to any configurable product. You see simple product can be a child of a configurable product, it can be independent product and it can be both and there should be regarded as such.

I think the best way to determine if the simple product is pure child product is to check its visibility, i.e. check whether or not it's "Not Visible Individually". Easiest way to check visibility is:


Return values are:

const VISIBILITY_IN_SEARCH      = 3;
const VISIBILITY_BOTH           = 4;

So if you want to see if the product is not visible individually check:

if ($_product->getVisibility() == Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE) 
  echo 'Product not visible individually';
  • I saw stores that show all products: both parent item and all children. So the getParentIdsByChild may also help.
    – Amasty
    Jul 28, 2014 at 9:24

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.