Skip to content

Add New Order Status on Custom Magento Extension Installer

long time no post :p

let’s get straight to the point, here is how we do this
first open your installer file at app/code/local/YOURMODULE/MODULENAME/sql/modulename_setup/mysql4-install-1.0.0.php

here the code

<?php
$installer = $this;
$installer->startSetup();

$statusTable = $installer->getTable('sales/order_status');
$installer->getConnection()->insertArray(
    $statusTable,
    array(
        'status',
        'label'
    ),
    array(
        array('status' => 'paycom', 'label' => 'Payment Confirmed by Customer'),
        
    )
);

$statusStateTable = $installer->getTable('sales/order_status_state');
$installer->getConnection()->insertArray(
    $statusStateTable,
    array(
        'status',
        'state',
        'is_default'
    ),
    array(
        array(
            'status' => 'paycom',
            'state' => 'pending',
            'is_default' => 0
        ),
        
    )
);

$installer->endSetup();
Share

Comments are closed.