Add status for order - orderstatus

// Create a custom order status
        $status = array(
            'invoice'     => 1
          , 'send_email'  => 0
          , 'module_name' => $this->name
          , 'color'       => 'RoyalBlue'
          , 'unremovable' => 1
          , 'hidden'      => 0
          , 'logable'     => 1
          , 'delivery'    => 0
          , 'shipped'     => 0
          , 'paid'        => 0
          , 'deleted'     => 0
        );

        if (!Db::getInstance()->insert('order_state', $status))
        {
            return false;
        }

        // Setup status translation
        $statusId = (int) Db::getInstance()->Insert_ID();
        $sql = new DbQuery();
        $sql->select('id_lang');
        $sql->from('lang');
        $sql->orderBy('id_lang');
        $sql->where('active = 1');
        $sql->limit('1');
        $langId =  Db::getInstance()->executeS($sql);

        $language = array(
            'id_lang'        => (int) $langId[0]['id_lang']
          , 'id_order_state' => $statusId
          , 'name'           => 'Awaiting payment'
          , 'template'       => ''
        ,
        );

        if (!Db::getInstance()->insert('order_state_lang', $language))
        {
            return false;
        }

        Configuration::updateValue('EBANX_STATUS_OPEN', $statusId);

Comments

Popular Posts