Кнопка подтверждения заказа отсутствует в процессе оформления заказа opencart 2.0

Я создал модуль платежного шлюза ранее для версии 1.5, он работает отлично, теперь я обновился до 2.x, поэтому я начал работать со своими модулями, все работает нормально, за исключением того, что отсутствует окончательный порядок подтверждения.

вот ссылка на изображение http://i.stack.imgur.com/Ak4B1.png

я заменил старый код своим новым кодом, но он все равно не работает, и большая проблема в том, что он даже не показывает ошибку, так что я могу понять

Вот мой старый код

<form action="<?php echo $action; ?>" method="post" id="payment">

</form>
<div class="buttons">
  <div class="right"><a id="button-confirm" class="button" onclick="$('#payment').submit();"><span><?php echo $button_confirm; ?></span></a></div>
</div>

Новый код

 <form action="<?php echo $action; ?>" method="post" id="payment">

    </form>
     <div class="buttons">
        <div class="pull-right">
          <input type="submit" value="<?php echo $button_confirm; ?>" class="btn btn-primary" id="button-confirm" />
        </div>
      </div>

код файла контроллера

<?php
class ControllerPaymentIcicipg extends Controller {

    protected function index() {

        $this->load->language('payment/icicipg');
        $data['action'] = $this->url->link('payment/icicipg/send', '', 'SSL');
        $data['button_confirm'] = $this->language->get('button_confirm');

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/icicipg.tpl')) {
            $this->template = $this->config->get('config_template') . '/template/payment/icicipg.tpl';
        } else {
            $this->template = 'default/template/payment/icicipg.tpl';
        }

        $this->render();

    }

    public function send() {

        include("Sfa/BillToAddress.php");
        include("Sfa/CardInfo.php");
        include("Sfa/Merchant.php");
        include("Sfa/MPIData.php");
        include("Sfa/ShipToAddress.php");
        include("Sfa/PGResponse.php");
        include("Sfa/PostLibPHP.php");
        include("Sfa/PGReserveData.php");

        $this->load->model('checkout/order');

        $order_id = $this->session->data['order_id'] ;

        $order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);

        $MID = $this->config->get('icicipg_MID');
        $cust_ip = $order_info['forwarded_ip'];
        $RedirectURL = $this->config->get('icicipg_RedirectURL');

        if ($this->currency->getCode()=='INR'){
           $amount = $order_info['total'];
        } else {
           $amount = $this->currency->convert($order_info['total'], $this->currency->getCode(), 'INR') ;
        }
        $amount = round((float)$amount,2);

        $bCustomerId = $order_info['customer_id'];
        $bCustomerName = html_entity_decode($order_info['payment_firstname'] . " " . $order_info['payment_lastname'], ENT_QUOTES, 'UTF-8');
        $bAddrLine1 = html_entity_decode($order_info['payment_address_1'], ENT_QUOTES, 'UTF-8');
        $bAddrLine2 = html_entity_decode($order_info['payment_address_2'], ENT_QUOTES, 'UTF-8');
        $bAddrLine3 = "";
        $bCity = html_entity_decode($order_info['payment_city'], ENT_QUOTES, 'UTF-8');
        $bState = html_entity_decode($order_info['payment_zone'], ENT_QUOTES, 'UTF-8');
        $bZip = html_entity_decode($order_info['payment_postcode'], ENT_QUOTES, 'UTF-8');
        $bCountryAlpha = $order_info['payment_iso_code_3'];
        $bEmail = html_entity_decode($order_info['email'], ENT_QUOTES, 'UTF-8');


        if ($this->cart->hasShipping()) {
            $sAddrLine1 = html_entity_decode($order_info['shipping_address_1'], ENT_QUOTES, 'UTF-8');
            $sAddrLine2 = html_entity_decode($order_info['shipping_address_2'], ENT_QUOTES, 'UTF-8');
            $sAddrLine3 = "";
            $sCity = html_entity_decode($order_info['shipping_city'], ENT_QUOTES, 'UTF-8');
            $sState = html_entity_decode($order_info['shipping_zone'], ENT_QUOTES, 'UTF-8');
            $sZip = html_entity_decode($order_info['shipping_postcode'], ENT_QUOTES, 'UTF-8');
            $sCountryAlpha = $order_info['shipping_iso_code_3'];
            $sEmail = html_entity_decode($order_info['email'], ENT_QUOTES, 'UTF-8');
        } else {
            $sAddrLine1 = html_entity_decode($order_info['payment_address_1'], ENT_QUOTES, 'UTF-8');
            $sAddrLine2 = html_entity_decode($order_info['payment_address_2'], ENT_QUOTES, 'UTF-8');
            $sAddrLine3 = "";
            $sCity = html_entity_decode($order_info['payment_city'], ENT_QUOTES, 'UTF-8');
            $sState = html_entity_decode($order_info['payment_zone'], ENT_QUOTES, 'UTF-8');
            $sZip = html_entity_decode($order_info['payment_postcode'], ENT_QUOTES, 'UTF-8');
            $sCountryAlpha = $order_info['payment_iso_code_3'];
            $sEmail = html_entity_decode($order_info['email'], ENT_QUOTES, 'UTF-8');
        }

        $oMPI           =   new MPIData();
        $oCI            =   new CardInfo();
        $oPostLibphp    =   new PostLibPHP();
        $oMerchant      =   new Merchant();
        $oBTA           =   new BillToAddress();
        $oSTA           =   new ShipToAddress();
        $oPGResp        =   new PGResponse();
        $oPGReserveData =   new PGReserveData();

        $oMerchant->setMerchantDetails($MID,$MID,$MID,$cust_ip,$order_id,$order_id,$RedirectURL,"POST","INR",$order_id,"req.Sale",$amount,"","Ext1","true","Ext3","Ext4","New PHP");

        //$oBTA->setAddressDetails ("CID","Tester","Aline1","Aline2","Aline3","Pune","A.P","48927489","IND","[email protected]");
        $oBTA->setAddressDetails ($bCustomerId, $bCustomerName,$bAddrLine1, $bAddrLine2, $bAddrLine3,$bCity, $bState, $bZip, $bCountryAlpha, $bEmail);

        //$oSTA->setAddressDetails ("Add1","Add2","Add3","City","State","443543","IND","[email protected]");
        $oSTA->setAddressDetails ($sAddrLine1, $sAddrLine2, $sAddrLine3, $sCity, $sState, $sZip, $sCountryAlpha,$sEmail);

        #$oMPI->setMPIRequestDetails("1245","12.45","356","2","2 shirts","12","20011212","12","0","","image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*","Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)");

        $oPGResp=$oPostLibphp->postSSL($oBTA,$oSTA,$oMerchant,$oMPI,$oPGReserveData);

        function redirect($url) {
            if(headers_sent()){
            ?>
                <html><head>
                    <script language="javascript" type="text/javascript">
                        window.self.location='<?php print($url);?>';
                    </script>
                </head></html>
            <?php
                exit;
            } else {
                header("Location: ".$url);
                exit;
            }
        }       

        if($oPGResp->getRespCode() == '000'){
            $url    =$oPGResp->getRedirectionUrl();
            #$url =~ s/http/https/;
            #print "Location: ".$url."\n\n";
            #header("Location: ".$url);
            redirect($url);
        }else{
            print "Error Occured.<br>";
            print "Error Code:".$oPGResp->getRespCode()."<br>";
            print "Error Message:".$oPGResp->getRespMessage()."<br>";
        }

    }


    public function callback() {

        include("Sfa/EncryptionUtil.php");

        $strMerchantId=$this->config->get('icicipg_MID');
        $astrFileName=substr(DIR_SYSTEM,0,strlen(DIR_SYSTEM)-7) . 'Sfa/' . $strMerchantId . '.key';
        $astrClearData;
        $ResponseCode = "";
        $Message = "";
        $TxnID = "";
        $ePGTxnID = "";
        $AuthIdCode = "";
        $RRN = "";
        $CVRespCode = "";
        $Reserve1 = "";
        $Reserve2 = "";
        $Reserve3 = "";
        $Reserve4 = "";
        $Reserve5 = "";
        $Reserve6 = "";
        $Reserve7 = "";
        $Reserve8 = "";
        $Reserve9 = "";
        $Reserve10 = "";

        $this->language->load('checkout/success');
        $this->load->language('payment/icicipg');

        if($_POST && $_POST['DATA']!=null){

            if($_POST['DATA']==null){
                print "null is the value";
            }
             $astrResponseData=str_replace("&amp;", "&", $_POST['DATA']);
             $astrDigest = str_replace("&amp;", "&", $_POST['EncryptedData']);
             $oEncryptionUtilenc =  new EncryptionUtil();
             $astrsfaDigest  = $oEncryptionUtilenc->getHMAC($astrResponseData,$astrFileName,$strMerchantId);

            if (strcasecmp($astrDigest, $astrsfaDigest) == 0) {
                parse_str($astrResponseData, $output);
                if( array_key_exists('RespCode', $output) == 1) {
                    $ResponseCode = $output['RespCode'];
                }
                if( array_key_exists('Message', $output) == 1) {
                    $Message = $output['Message'];
                }
                if( array_key_exists('TxnID', $output) == 1) {
                    $TxnID=$output['TxnID'];
                }
                if( array_key_exists('ePGTxnID', $output) == 1) {
                    $ePGTxnID=$output['ePGTxnID'];
                }
                if( array_key_exists('AuthIdCode', $output) == 1) {
                    $AuthIdCode=$output['AuthIdCode'];
                }
                if( array_key_exists('RRN', $output) == 1) {
                    $RRN = $output['RRN'];
                }
                if( array_key_exists('CVRespCode', $output) == 1) {
                    $CVRespCode=$output['CVRespCode'];
                }
            }

            $Order_Id = $TxnID;

            $this->load->model('checkout/order');

            //$order_info = $this->model_checkout_order->getOrder($Order_Id);
            if(trim($TxnID)!=""){
                if((int)$ResponseCode == 0) { 
                    $this->document->setTitle('Payment Transaction Successful');
                    $data['heading_title'] = sprintf($this->language->get('text_order_success'),$TxnID);
                    $order_status_id = $this->config->get('icicipg_success_status_id');
                    $this->model_checkout_order->confirm($Order_Id, $order_status_id);
                    if ($this->customer->isLogged()) {
                        $data['text_message'] = sprintf($this->language->get('text_customer'), $this->url->link('account/account', '', 'SSL'), $this->url->link('account/order', '', 'SSL'), $this->url->link('account/download', '', 'SSL'), $this->url->link('information/contact'));
                    } else {
                        $data['text_message'] = sprintf($this->language->get('text_guest'), $this->url->link('information/contact'));
                    }
                    if (isset($this->session->data['order_id'])) {
                        $this->cart->clear();

                        unset($this->session->data['shipping_method']);
                        unset($this->session->data['shipping_methods']);
                        unset($this->session->data['payment_method']);
                        unset($this->session->data['payment_methods']);
                        unset($this->session->data['guest']);
                        unset($this->session->data['comment']);
                        unset($this->session->data['order_id']);    
                        unset($this->session->data['coupon']);
                        unset($this->session->data['reward']);
                        unset($this->session->data['voucher']);
                        unset($this->session->data['vouchers']);
                    }   
                    $data['button_continue'] = $this->language->get('button_continue');

                    $data['continue'] = $this->url->link('common/home');

                    //$this->redirect($this->url->link('checkout/success'));
                } else {
                    $this->document->setTitle('Payment Transaction Failed');
                    $data['heading_title'] = sprintf($this->language->get('text_order_failed'),$TxnID);
                    $data['text_message'] = sprintf($this->language->get('text_icicipg_eorror_message'), $this->url->link('information/contact'),$Message);
                    $data['button_continue'] = $this->language->get('button_continue');
                    $data['continue'] = $this->url->link('common/home');
                    $order_status_id = $this->config->get('icicipg_failed_status_id');
                    $this->model_checkout_order->confirm($Order_Id, $order_status_id);
                }
            } else {
                $this->document->setTitle('Payment Transaction Failed');
                $data['heading_title'] = $this->language->get('text_icicipg_error');
                $data['text_message'] = sprintf($this->language->get('text_icicipg_eorror_message'), $this->url->link('information/contact'),'Unspecified');
                $data['button_continue'] = $this->language->get('button_continue');
                $data['continue'] = $this->url->link('common/home');            
            }

        } else {
            $this->document->setTitle('Payment Transaction Failed');
            $data['heading_title'] = $this->language->get('text_icicipg_error');
            $data['text_message'] = sprintf($this->language->get('text_icicipg_eorror_message'), $this->url->link('information/contact'),'Unspecified');
            $data['button_continue'] = $this->language->get('button_continue');
            $data['continue'] = $this->url->link('common/home');



        }
        //$data['text_message'] = $astrDigest . '<br/>' .  $astrsfaDigest . '<br/><pre>' . print_r($_POST ,1) . '</pre>';

        $data['breadcrumbs'] = array();
        $this->children = array(
            'common/column_left',
            'common/column_right',
            'common/content_top',
            'common/content_bottom',
            'common/footer',
            'common/header'
        );

        $data['column_left'] = $this->load->controller('common/column_left');
                $data['column_right'] = $this->load->controller('common/column_right');
                $data['content_top'] = $this->load->controller('common/content_top');
                $data['content_bottom'] = $this->load->controller('common/content_bottom');
                $data['footer'] = $this->load->controller('common/footer');
                $data['header'] = $this->load->controller('common/header');

        if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/success.tpl')) {
                    $this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/common/success.tpl', $data));
                } else {
                    $this->response->setOutput($this->load->view('default/template/common/success.tpl', $data));
                }

    }
}
?>

person Aryan    schedule 11.06.2015    source источник
comment
вы включили журналы ошибок из админки?   -  person Frosty    schedule 11.06.2015
comment
Ошибка @Innervisions включена только   -  person Aryan    schedule 11.06.2015
comment
как я вижу, в старом коде есть javascript, в котором есть onclick #payment .submit, поэтому он выполнил заказ, но в вашем коде этого нет, можете ли вы проверить консоль на наличие ошибок JS?   -  person Frosty    schedule 11.06.2015
comment
В консоли нет ошибок, я добавил код контроллера для простоты понимания.   -  person Aryan    schedule 11.06.2015
comment
Итак, как я вижу на картинке, вам не хватает кнопки подтверждения, чтобы завершить заказ? это правильно? Можно еще ссылку на сайт   -  person Frosty    schedule 11.06.2015
comment
@Innervisions вот ссылка itracktraining.com/testoc/oc/upload   -  person Aryan    schedule 11.06.2015
comment
Уведомление о кредитных/дебетовых картах: неопределенный индекс: термины в /home/itracktr/public_html/testoc/oc/upload/catalog/view/theme/default/template/checkout/payment_method.tpl в строке 16 здесь ошибка на шаге 5 посмотрите, что написано в строке 16 в payment_method.tpl   -  person Frosty    schedule 11.06.2015
comment
Это не проблема, я исправил это уведомление, но кнопка подтверждения заказа по-прежнему отсутствует, но в то же время, если я выбираю наложенный платеж, появляется кнопка подтверждения заказа.   -  person Aryan    schedule 11.06.2015
comment
Не уверен, в чем могут быть проблемы... Но мне кажется, что это может быть проблема с Javascript, поэтому он не выдает никаких ошибок php.   -  person Frosty    schedule 11.06.2015
comment
да все способы перепробовал но решения нет   -  person Aryan    schedule 12.06.2015


Ответы (1)


Opencart 2.0+ отображает шаблон другим способом: $this->load->view($template,$data)

Так, например, ваш может выглядеть примерно так:

if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/icicipg.tpl')) {
    return $this->load->view($this->config->get('config_template') . '/template/payment/icicipg.tpl', $data);
} else {
    return $this->load->view('default/template/payment/icicipg.tpl',$data);
}

Кроме того, я полагаю, что ваш метод Index() должен быть public, а не protected.

person billynoah    schedule 13.06.2015
comment
Не могу принять этот ответ для оп, поэтому вместо этого я проголосовал за него. У меня было все отсортировано, кроме общедоступного метода. - person Chris; 29.03.2017