Showing posts with label admin. Show all posts
Showing posts with label admin. Show all posts

Thursday, 19 April 2018

Calendar.setup Calendar popup not display proper on Magento admin panel


HTML Code

<td class="label"><label for="tran_date">Date</label></td>
<td class="value">
    <input name="deposit[created_at]" id="tran_date" type="text" class="input-text" value="<?php echo Mage::getModel('core/date')->gmtDate('m/d/Y'); ?>"/>
    <img src="<?php echo $this->getSkinUrl('images/grid-cal.gif') ?>" class=""
        id="tran_date_trig"/>
    <div id="calendar--flat"></div>
</td>
</tr>
SCRIPT
 <script type="text/javascript">
// <![CDATA[
Calendar.setup({
flat: 'calendar--flat',
ifFormat: '%m/%e/%Y',
button: 'tran_date_trig',
align: 'Bl',
singleClick: true,
onSelect: function(dateText,selectedDate) {
    jQuery('#tran_date').val(selectedDate);
    jQuery('#calendar--flat').hide();
}
});
// ]]>
</script>

CSS

#calendar--flat {
    position: absolute;


Friday, 9 February 2018

How to add / create grid Tab in custom module in magento admin panel

Step1 :
open : /app/code/local/Namespace/Modulename/Block/Adminhtml/Employee/Edit/Tabs.php
Add following lines

protected function _beforeToHtml()
{
.........
.........
.........
$this->addTab(
    'form_advancepayment',
    array(
'label'   => Mage::helper('namespace_modulename')->__('Advance Payment'),
'title'   => Mage::helper('namespace_modulename')->__('Advance Payment'),
'content' => $this->getLayout()->createBlock(
    'namespace_modulename/adminhtml_employee_edit_tab_advancepayment'
)
->toHtml(),
    )
);
return parent::_beforeToHtml();
}
Step2 :
Create new file (Advancepayment.php) : /app/code/local/Namespace/Modulename/Block/Adminhtml/Employee/Edit/Tab/Advancepayment.php
<?php
class Namespace_Modulename_Block_Adminhtml_Employee_Edit_Tab_Advancepayment extends Mage_Adminhtml_Block_Widget_Grid
{
    public function __construct()
    {
        parent::__construct();
        $this->setId('advancepymt_grid');
        $this->setDefaultSort('entity_id');
        $this->setDefaultDir('DESC');
        $this->setSaveParametersInSession(true);
        $this->setUseAjax(true);
        //$this->setFilterVisibility(false);
    }
   
    protected function _prepareCollection()
    {
        $id = $this->getRequest()->getParam('id');
        $collection = Mage::getModel('namespace_modulename/advancepymt')
            ->getCollection()
            ->addFieldToFilter('employee_id', $id);
       
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }
   
    protected function _prepareColumns()
    {
        $this->addColumn(
            'entity_id',
            array(
                'header' => Mage::helper('namespace_modulename')->__('Id'),
                'index'  => 'entity_id',
                'filter' => false,
                'type'   => 'number'
            )
        );
        $this->addColumn(
            'payment',
            array(
                'header'    => Mage::helper('namespace_modulename')->__('Payment'),
                'align'     => 'left',
                'type'   => 'number',
                'index'     => 'payment',
            )
        );
       
        $this->addColumn(
            'created_at',
            array(
                'header' => Mage::helper('namespace_modulename')->__('Created at'),
                'index'  => 'created_at',
                'width'  => '120px',
                'type'   => 'datetime',
            )
        );
        return parent::_prepareColumns();
    }
   
    public function getGridUrl()
    {
        return $this->getUrl('*/*/advancepymt', array('_current'=>true));
    }
   
    public function getRowUrl($row)
    {
        return $this->getUrl('*/*/edit', array('id' => $row->getId()));
    }
Step3 :
Create function in current controller : /app/code/local/Namespace/Modulename/controllers/Adminhtml/Payroll/EmployeeController.php
class Namespace_Modulename_Adminhtml_Payroll_EmployeeController extends Namespace_Modulename_Controller_Adminhtml_Payroll
{
.............
.............
.............
public function advancepymtAction() {
        $this->loadLayout();
        $this->getLayout()->getBlock('edit.tab.advancepayment');
        $this->renderLayout(); 
    }
Step4 :
Add view in admin layout xml file : /app/design/adminhtml/default/default/layout/namespace_modulename.xml
Add following code into file

...........
...........
<adminhtml_modulename_employee_advancepymt>
<block type="core/text_list" name="root" output="toHtml">
    <block type="namespace_modulename/adminhtml_employee_edit_tab_advancepayment" name="edit.tab.advancepayment"/>
</block>
</adminhtml_modulename_employee_advancepymt>
...........
........... 

Saturday, 8 October 2016

How to upload products multiple images in codeigniter Gocart in admin panel

Open : gocart/views/admin/iframe/product_image_uploader.php

<?php include('header.php');?>
<script type="text/javascript">
 
<?php if( $this->input->post('submit') ):?>
$(window).ready(function(){
        $('#iframe_uploader', window.parent.document).height($('body').height()); });
<?php endif;?>
<?php if($file_name):?>
        parent.add_product_image('<?php echo json_encode($file_name);?>');
<?php endif;?>
 
</script>
<?php if (!empty($error)): ?>
    <div class="alert alert-error">
        <a class="close" data-dismiss="alert">×</a>
        <?php echo $error; ?>
    </div>
<?php endif; ?>
<div class="row-fluid">
    <div class="col-md-12">
        <?php echo form_open_multipart($this->config->item('admin_folder') . '/products/product_image_upload', 'class="form-inline "'); ?>
        <?php echo form_upload(array('name' => 'userfile[]', 'id' => 'userfile', 'class' => 'input-file', 'multiple'=>"true" )); ?>
        <input class="btn" name="submit" type="submit" value="<?php echo lang('upload'); ?>" />
        </form>
    </div>
</div>
<?php include('footer.php');


Open : gocart/controllers/admin/products.php

Update product_image_upload() function

function product_image_upload() {
        $data['file_name'] = false;
        $data['error'] = false;
        $config['allowed_types'] = 'gif|jpg|png';
        //$config['max_size'] = $this->config->item('size_limit');
        $config['upload_path'] = 'uploads/images/full';
        $config['encrypt_name'] = true;
        $config['remove_spaces'] = true;
        $this->load->library('upload', $config);
        $files = $_FILES;
     
        $cpt = count($_FILES['userfile']['name']);
        for($i=0; $i<$cpt; $i++)
        {
            $_FILES['userfile']['name']= $files['userfile']['name'][$i];
            $_FILES['userfile']['type']= $files['userfile']['type'][$i];
            $_FILES['userfile']['tmp_name']= $files['userfile']['tmp_name'][$i];
            $_FILES['userfile']['error']= $files['userfile']['error'][$i];
            $_FILES['userfile']['size']= $files['userfile']['size'][$i];

            //$this->upload->initialize($this->set_upload_options());
         
            if ($this->upload->do_upload()) {
                $upload_data = $this->upload->data();
             
                $this->load->library('image_lib');
                /*
                  I find that ImageMagick is more efficient that GD2 but not everyone has it
                  if your server has ImageMagick then you can change out the line
                  $config['image_library'] = 'gd2';
                  with
                  $config['library_path'] = '/usr/bin/convert'; //make sure you use the correct path to ImageMagic
                  $config['image_library'] = 'ImageMagick';
                 */
                //this is the larger image
                $config['image_library'] = 'gd2';
                $config['source_image'] = 'uploads/images/full/' . $upload_data['file_name'];
                $config['new_image'] = 'uploads/images/medium/' . $upload_data['file_name'];
                $config['maintain_ratio'] = TRUE;
                $config['width'] = 600;
                $config['height'] = 500;
                $this->image_lib->initialize($config);
                $this->image_lib->resize();
                $this->image_lib->clear();
                //small image
                $config['image_library'] = 'gd2';
                $config['source_image'] = 'uploads/images/medium/' . $upload_data['file_name'];
                $config['new_image'] = 'uploads/images/small/' . $upload_data['file_name'];
                $config['maintain_ratio'] = TRUE;
                $config['width'] = 235;
                $config['height'] = 235;
                $this->image_lib->initialize($config);
                $this->image_lib->resize();
                $this->image_lib->clear();
                //cropped thumbnail
                $config['image_library'] = 'gd2';
                $config['source_image'] = 'uploads/images/small/' . $upload_data['file_name'];
                $config['new_image'] = 'uploads/images/thumbnails/' . $upload_data['file_name'];
                $config['maintain_ratio'] = TRUE;
                $config['width'] = 150;
                $config['height'] = 150;
                $this->image_lib->initialize($config);
                $this->image_lib->resize();
                $this->image_lib->clear();
                $data['file_name'][] = $upload_data['file_name'];
            }
        }
        if ($this->upload->display_errors() != '') {
            $data['error'] = $this->upload->display_errors();
        }
        $this->load->view($this->config->item('admin_folder') . '/iframe/product_image_uploader', $data);
    }


Open : gocart/views/admin/product_form.php

Update : add_product_image(data) function


function add_product_image(data) {
     
        var $images = $.parseJSON(data);
        $.each($images, function(i, image) {
            p = image.split('.');
            var photo = '<?php add_image("' + p[0] + '", "' + p[0] + '.' + p[1] + '", '
            ', '
            ', '
            ', base_url('
            uploads / images / thumbnails '));?>';
            $('#gc_photos').append(photo);
            $('#gc_photos').sortable('destroy');
            photos_sortable();
        });
    }

Thursday, 15 September 2016

How to change the sort order for shipping in admin panel in magento



Step 1 : You have to copy this two files to your Theme in the adminhtml

app/design/adminhtml/default/default/template/sales/order/shipment/create/tracking.phtml
app/design/adminhtml/default/default/template/sales/order/invoice/create/tracking.phtml


Step 2 : Open : app/design/adminhtml/default/default/template/sales/order/shipment/create/tracking.phtml
(you will find this code at Line number 93)

Replace with

<select name="tracking[__index__][carrier_code]" id="trackingC__index__" class="select carrier" style="width:110px;" disabled="disabled">
    <?php foreach ($this->getCarriers() as $_code=>$_name): ?>
    <option value="<?php echo $_code ?>"><?php echo $this->escapeHtml($_name) ?></option>
    <?php endforeach; ?>
</select>

Step 3 : Open : app/design/adminhtml/default/default/template/sales/order/invoice/create/tracking.phtml
(you will find this code at Line number 93)

Replace with

<select name="tracking[__index__][carrier_code]" id="trackingC__index__" class="select carrier" style="width:110px;" disabled="disabled">
    <?php foreach ($this->getCarriers() as $_code=>$_name): ?>
    <option <?php if ($_code=="ups"): ?>selected<?php endif; ?> value="<?php echo $_code ?>"><?php echo $this->escapeHtml($_name) ?></option>
    <?php endforeach; ?>
</select>

Monday, 11 April 2016

Today's/Month sales report on admin dashboard in magento

The sales report is one of the main progress indicators in e-commerce. We often create a sales report using the default Magento features – just go to Reports -> Sales -> Orders, and then, fill in the filter form on that page. This way allows us to get full information about sales on the web store.

Nevertheless, getting back to all these actions every time is not handy, especially if we do not need the full report. So, let’s find out how to display the reports in different parts in the admin panel.

First of all, we add a part of the code that will display our report on the dashboard in the admin panel – so, to do this place the following code snippet to
[Magento root]/app/design/adminhtml/default/default/template/dashboard/index.phtml:

<div class="entry-edit cmsdas-1 todaysale">
                <div class="cms-entry-edit-head">
                <div class="lifetime-sales"><?php echo "Today's sales"  ?></div>
                    <div class="cms-va">
                        <span class="price"><?php echo Mage::helper('NAMESPACE_MODULE/todaysale')->getTotals();?></span>
                    <span style="font-size:14px; color:#686868;">
                    </span>
                    </div>
                </div>
            </div>
In this code snippet we have a standard markup and use custom helper Mage::helper('NAMESPACE_MODULE/todaysale')->getTotals(). In this case, the helper returns an information about the report.

Pay attention to the code helper which generates information about the report. Here are several methods that build the report.

class NAMESPACE_MODULE_Helper_Todaysale extends Mage_Core_Helper_Abstract {
    public function getTotals() {
       
        $isFilter= '';
        $todaysales = Mage::getResourceModel('reports/order_collection')
            ->calculateSales($isFilter);
        $todayStartOfDayDate  = Mage::app()->getLocale()->date()
            ->setTime('00:00:00')
            ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
        //$todayStartOfDayDate ='2016-04-7 00:00:00';
        $todayEndOfDayDate  = Mage::app()->getLocale()->date()
            ->setTime('23:59:59')
            ->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
       
        $todaysales->addAttributeToFilter('created_at', array(
            'from'  => $todayStartOfDayDate,
            'to'    =>  $todayEndOfDayDate,                  
        ));
        $todaysales->load();
        $todaysale = $todaysales->getFirstItem();
        //$this->addTotal($this->__("Today's Sales"), $todaysale->getLifetime());
        return (string)Mage::helper('core')->currency($todaysale->getLifetime(), true, false);
    }
}

Enable template path hint in admin Panel - Magento

There are two ways to enable admin panel path hints.

1.
You can enable template and block path hints in every store (including the admin store) by setting them in the Magento configuration. To do this, simply edit your module's configuration file app/etc/config.xml (which gets injected into Magento's global configuration).

To enable template and block path hints in the admin area add this to your app/etc/config.xml file
<config>

    ...

    <stores>
        <admin>
            <dev>
                <debug>
                    <template_hints>1</template_hints>
                    <template_hints_blocks>1</template_hints_blocks>
                </debug>
            </dev>
        </admin>
    </stores>
</config>
To disable path hints simply change to 0, or delete the node.

2.

You can do it by changing the database directly. If you have something like phpMyAdmin that is a good way to gain access. Enter this SQL.

INSERT INTO `core_config_data` (`scope`, `scope_id`, `path`, `value`)
       VALUES ('websites', '0', 'dev/debug/template_hints', '1');

When you are done with path hints just delete the matching record from core_config_data Or update the value field to 0 instead of deleting the whole record, it will probably be the last one since you've just added it.

Saturday, 13 February 2016

Get customer addresses with admin formated

 $order = $this->getOrder();
 $address = $order->getShippingAddress()->getFormated(true);
 echo $address;

Tuesday, 29 December 2015

Add Field in Account Information in magento admin panel direct database

Add field in          ---------> eav_attribute table
Add field in          ---------> customer_eav_attribute table
Add field in          ---------> customer_form_attribute table

Wednesday, 9 September 2015

How to make custom PDF in magento admin panel


Put this code in your Controllers file.

How to make custom PDF in magento admin panel


$pdf = new Zend_Pdf();
        $page = new Zend_Pdf_Page(Zend_Pdf_Page::SIZE_A4);
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_TIMES);
        $page->setFont($font, 11);
       
        //add pages to main document
        $pdf->pages[] = $page;
        $top = $this->y;
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0.45));
        $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.45));
        $page->drawRectangle(25, $top, 570, $top - 55);
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
       
        //Header order
        $titre = "Packingslip # 100000039";
        $page->drawText($titre, 40, $page->getHeight()-115, "UTF-8");
        $titre = "Order # 100000031";
        $page->drawText($titre, 40, $page->getHeight()-130, "UTF-8");
        $titre = "Order Date: Aug 20, 2015";
        $page->drawText($titre, 40, $page->getHeight()-145, "UTF-8");
       
        //Create rectangle
        $top -= 55;
        $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
        $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
        $page->setLineWidth(0.5);
        $page->drawRectangle(25, $top, 275, ($top - 25));
        $page->drawRectangle(275, $top, 570, ($top - 25));
       
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
        $page->drawText(Mage::helper('sales')->__('Sold to:'), 35, ($top - 15), 'UTF-8');
        $page->drawText(Mage::helper('sales')->__('Ship to:'), 285, ($top - 15), 'UTF-8');
       
        //Create rectangle
        $addressesHeight = 110;
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));
        $page->drawRectangle(25, ($top - 25), 570, $top - 33 - $addressesHeight);
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
        $page->setFont($font, 10);
        $this->y = $top - 40;
        $addressesStartY = $this->y;
       
        //Billing Address
        $page->drawText(strip_tags(ltrim('Jaydip Kanasagra')), 35, $this->y, 'UTF-8');
        $page->drawText(strip_tags(ltrim('Metizsoft')), 35, $this->y-15, 'UTF-8');
        $page->drawText(strip_tags(ltrim('35 Brownsboro,')), 35, $this->y-30, 'UTF-8');
        $page->drawText(strip_tags(ltrim('Madison,')), 35, $this->y-45, 'UTF-8');
        $page->drawText(strip_tags(ltrim('Alabama, 33324')), 35, $this->y-60, 'UTF-8');
        $page->drawText(strip_tags(ltrim('United States')), 35, $this->y-75, 'UTF-8');
        $page->drawText(strip_tags(ltrim('T: (256) 683 - 0237')), 35, $this->y-90, 'UTF-8');
       
       
        //Shipping Address
        $page->drawText(strip_tags(ltrim('Jaydip Kanasagra')), 285, $this->y, 'UTF-8');
        $page->drawText(strip_tags(ltrim('Metizsoft')), 285, $this->y-15, 'UTF-8');
        $page->drawText(strip_tags(ltrim('35 Brownsboro,')), 285, $this->y-30, 'UTF-8');
        $page->drawText(strip_tags(ltrim('Madison,')), 285, $this->y-45, 'UTF-8');
        $page->drawText(strip_tags(ltrim('Alabama, 33324')), 285, $this->y-60, 'UTF-8');
        $page->drawText(strip_tags(ltrim('United States')), 285, $this->y-75, 'UTF-8');
        $page->drawText(strip_tags(ltrim('T: (256) 683 - 0237')), 285, $this->y-90, 'UTF-8');
        $this->y -= 110;
        $addressesEndY = $this->y;
       
        $addressesEndY = min($addressesEndY, $this->y);
        $this->y = $addressesEndY;
       
        //Create rectangle
        $page->setFillColor(new Zend_Pdf_Color_Rgb(0.93, 0.92, 0.92));
        $page->setLineWidth(0.5);
        $page->drawRectangle(25, $this->y, 275, $this->y-25);
        $page->drawRectangle(275, $this->y, 570, $this->y-25);
       
        //Payment and Shipping Method
        $this->y -= 15;
        $page->setFont($font, 12);
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
        $page->drawText(Mage::helper('sales')->__('Payment Method'), 35, $this->y, 'UTF-8');
        $page->drawText(Mage::helper('sales')->__('Shipping Method:'), 285, $this->y , 'UTF-8');
       
        $this->y -=10;
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(1));

        $page->setFont($font, 10);
        $page->setFillColor(new Zend_Pdf_Color_GrayScale(0));
       
        $paymentLeft = 35;
        $yPayments   = $this->y - 15;
       
        foreach (Mage::helper('core/string')->str_split('Cash On Pickup', 45, true, true) as $_value) {
            $page->drawText(strip_tags(trim($_value)), $paymentLeft, $yPayments, 'UTF-8');
            $yPayments -= 15;
        }
        $yPayments = min($addressesEndY, $yPayments)-60;
        $page->drawLine(25,  ($top - 150), 25,  $yPayments);
        $page->drawLine(570, ($top - 150), 570, $yPayments);
        $page->drawLine(25,  $yPayments,  570, $yPayments);
       
        foreach (Mage::helper('core/string')->str_split('Delivery - Delivery (Only available for local area)', 45, true, true) as $_value) {
            $page->drawText(strip_tags(trim($_value)), 285, $this->y-15, 'UTF-8');
            $this->y -= 15;
        }
        $topMargin    = 20;
        $methodStartY = $this->y;
        $yShipments = $this->y;
       
        $totalShippingChargesText = "(" . Mage::helper('sales')->__('Total Shipping Charges') . " $0.00)";
        $page->drawText($totalShippingChargesText, 285, $yShipments - $topMargin, 'UTF-8');
       
        $currentY = min($yPayments, $yShipments);
        // replacement of Shipments-Payments rectangle block
        $page->drawLine(25,  $methodStartY, 25,  $currentY); //left
        $page->drawLine(25,  $currentY,     570, $currentY); //bottom
        $page->drawLine(570, $currentY,     570, $methodStartY); //right
        $this->y = $currentY;
        $this->y -= 15;
       
        //Items
        $page->setFont($font, 10);
        $page->setFillColor(new Zend_Pdf_Color_RGB(0.93, 0.92, 0.92));
        $page->setLineColor(new Zend_Pdf_Color_GrayScale(0.5));
        $page->setLineWidth(0.5);
        $page->drawRectangle(25, $this->y, 570, $this->y-15);
        $this->y -= 10;
        $page->setFillColor(new Zend_Pdf_Color_RGB(0, 0, 0));
       
        $page->drawText(Mage::helper('sales')->__('Qty'), 35, $this->y, 'UTF-8');
        $page->drawText(Mage::helper('sales')->__('Products'), 125, $this->y , 'UTF-8');
        $page->drawText(Mage::helper('sales')->__('Sku'), 550, $this->y , 'UTF-8');
       
        $test = array(0=>'test',1=>'test1',2=>'test2');
        $this->y = $this->y-15;
        foreach ($test as $_value) {
            $this->y -= 15;
            $page->drawText(strip_tags(trim('10')), 35, $this->y, 'UTF-8');
            $page->drawText(strip_tags(trim('SWISHER SWEET CGRL WGRP 2F.99')), 125, $this->y, 'UTF-8');
            $page->drawText(strip_tags(trim('025900227289')), 500, $this->y, 'UTF-8');
        }
       
        //generate pdf
        $content =  $pdf->render();
        $fileName = 'details.pdf';
        $this->_prepareDownloadResponse($fileName, $content);

Tuesday, 1 September 2015

How to create shipping and invoice in magneto by code or API


Various merchants, various demands. Imagine you have a private on site sale or something like that, where your checkout requirements are pretty simply: create invoice / ship and complete the order all at once. For example, you are doing the checkout for bunch of people standing in front of you, paying you money right on the spot. In such scenario overload of manually creating an invoice and shipment can be too much.

Thus, having your Magento automatically invoice/ship/complete orders can be a logical request. So how do we do that?

Easy! All you need to do is to observe the sales_order_save_after event or observe the controller_action_predispatch event and target the Mage_Checkout_OnepageController::successAction() catching the Mage::getSingleton(‘checkout/session’)->getLastOrderId(). In this example I decided to demonstrate the possible (not ideal, or not even the best) “sales_order_save_after event” approach. 

And here is the code for our observer model. 

$order = $observer->getEvent()->getOrder();
 
        $orders = Mage::getModel('sales/order_invoice')->getCollection()
                        ->addAttributeToFilter('order_id', array('eq'=>$order->getId()));
        $orders->getSelect()->limit(1);  
 
        if ((int)$orders->count() !== 0) {
            return $this;
        }
 
        if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
 
            try {
                if(!$order->canInvoice()) {
                    $order->addStatusHistoryComment('Inchoo_Invoicer: Order cannot be invoiced.', false);
                    $order->save();  
                }
 
                //START Handle Invoice
                $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
 
                $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
                $invoice->register();
 
                $invoice->getOrder()->setCustomerNoteNotify(false);          
                $invoice->getOrder()->setIsInProcess(true);
                $order->addStatusHistoryComment('Automatically INVOICED by Invoicer.', false);
 
                $transactionSave = Mage::getModel('core/resource_transaction')
                    ->addObject($invoice)
                    ->addObject($invoice->getOrder());
 
                $transactionSave->save();
                //END Handle Invoice
 
                //START Handle Shipment
                $shipment = $order->prepareShipment();
                $shipment->register();
 
                $order->setIsInProcess(true);
                $order->addStatusHistoryComment('Automatically SHIPPED by Invoicer.', false);
 
                $transactionSave = Mage::getModel('core/resource_transaction')
                    ->addObject($shipment)
                    ->addObject($shipment->getOrder())
                    ->save();
                //END Handle Shipment
            } catch (Exception $e) {
                $order->addStatusHistoryComment('Inchoo_Invoicer: Exception occurred during automaticallyInvoiceShipCompleteOrder action. Exception message: '.$e->getMessage(), false);
                $order->save();
            }                
        }