Thursday 31 July 2014

override adminhtml block magento

Go to custom module config.xml

this will overrite Mage/adminhtml/block/customer/group/edit/form.php
<config>
     <global>
              <blocks>
            <adminhtml>
                <rewrite><customer_group_edit_form>Bill_Checked_Block_Adminhtml_Customer_Group_Edit_Form</customer_group_edit_form>
                </rewrite>
            </adminhtml>
        </blocks>
     </global>
</config>





then create file in   app\code\local\Package\Module\Block\Adminhtml\Customer\Group\Edit\Form.php


use code


class Package_Module_Block_Adminhtml_Customer_Group_Edit_Form extends Mage_Adminhtml_Block_Customer_Group_Edit_Form
{
    protected function _prepareLayout()
    {
     ///Youre code is here
     }
}

Wednesday 30 July 2014

Add multiple product images Magento

$newProduct = Mage::getModel(''catalog/product'')->load(productid)
$artworkhid = "image1.jpg,image2.jpg,image3.jpg";
$newProduct->setMediaGallery (array('images'=>array (), 'values'=>array ()));
$imgs = explode(',',$artworkhid);
 $i = 1;
foreach($imgs as $ims){
$previewImage = '/image_path/'.$ims;
     if(file_exists($previewImage)){
 if($i==1){
            $newProduct->addImageToMediaGallery ($previewImage, array ('thumbnail','small_image','image'), false, false);
      }else{
            $newProduct->addImageToMediaGallery ($previewImage, null, false, false);
  }
 $i++;
 }
}

Tuesday 3 June 2014

Sunday 18 May 2014

magento basics concept

Magento built in zend framework on object orient concept in MVC architecture Based on EDA(Event Driven Architecture).
Whent an event happens element listen event and sent to event engine.  

Thursday 6 March 2014

Index management magento programmatically


get All Index process collection

$allIndex= Mage::getSingleton('index/indexer')->getProcessesCollection();

foreach ($allIndex as $index) {
if ($index->getStatus() == Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX) {
$index->reindexEverything();
//echo "<pre>"; print_r($index->getProcess_id()); echo "</pre>";
}
}