Magento Coding Solutions

magento reindex programmatically

for ($i = 1; $i <= 9; $i++) {
        $reIndexProcess = Mage::getModel('index/process')->load($i); $reIndexProcess->reindexAll();
}

get Last order increment id in magento

<?php
$last_order_increment_id=Mage::getModel("sales/order")->getCollection()->getLastItem()->getIncrementId();
echo $last_order_increment_id;

?>

Reindex magento programmatically

<?php
for ($i = 1; $i <= 9; $i++) {
$reIndexProcess = Mage::getModel('index/process')->load($i);
$reIndexProcess->reindexAll();
}
}

get Attribute Collection by Attribute Id

Method 1 :
/* taille_inteernational is a attribute ***/
<?php $attributeInfo_taille_inteernational=Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter('taille_inteernational')
->getFirstItem();
$taille_inteernational_attribut=$attributeInfo_taille_inteernational->getSource()->getAllOptions(false); $i=0;
foreach($taille_inteernational_attribut as $taille_inteernational){ $i++;
echo '<option value="'.$taille_inteernational['value'].'" >'.$taille_inteernational['label'].'</option>';
} ?>
Method 2:
<?php
/****** hear metal_type is  a Attribute Key***********/

$metalType='metal_type';
    $attributeInfo = Mage::getResourceModel('eav/entity_attribute_collection')->setCodeFilter($metalType)->getFirstItem();
    $attributeId = $attributeInfo->getAttributeId();
    $attribute = Mage::getModel('catalog/resource_eav_attribute')->load($attributeId);
    $attributeOptions = $attribute ->getSource()->getAllOptions(false);

    print_r($attributeOptions);

?>