Magento Coding Solutions

how to get attribute position by attribute option id in magento

      $attributeId = 134;
$collection =Mage::getResourceModel('eav/entity_attribute_option_collection')
                ->setPositionOrder('asc')
                ->setAttributeFilter($attributeId)
->addFilter('option_id',5)
               // ->setStoreFilter(0)
                ->load();
                echo "<pre>";
                //print_r($collection);
foreach($collection as $va){
print_r($va->getData());
}


-------------------------------------------------
$attributeId = 134;
$collection =Mage::getResourceModel('eav/entity_attribute_option_collection')
                ->setPositionOrder('asc')
               // ->setAttributeFilter($attributeId)
->addFilter('option_id',5)
               // ->setStoreFilter(0)
                ->load();
                echo "<pre>";
                //print_r($collection);
foreach($collection as $va){
print_r($va->getData());
}

Get Associated Products By product id

$pid=5; //Note: should be Conferrable product Id


$product = Mage::getModel('catalog/product')->load($pid);
$associatedProducts=$product->getTypeInstance()->getUsedProducts();
foreach($associatedProducts as $associatedProduct){
              // print_r($associatedProduct->getData());
$cid=$associatedProduct->getEntity_id();

                }