خوش امدید به سایت اپن کارت با طعم پارسی - مرجع رسمی اپن کارت

لطفاً برای دسترسی به تمامی بخش های سایت مراحل ثبت نام و ایجاد حساب کاربری را طی نمایید. پس از ثبت نام و ورود به سیستم، شما قادر به استفاده از امکاناتی همچون دانلود فایل ها، ایجاد موضوع، ارسال پاسخ به مباحث موجود، دادن امتیاز به اعضای دیگر، ارسال و دریافت پیام خصوصی، مدیریت نمایه و دیگر امکانات سایت خواهید بود. بعد از ثبت نام و ورودتان به سیستم این پیام دیگر برای شما نمایش داده نخواهد شد. اوقات خوب و لحظات مفیدی را برای شما در سایت آرزو مندیم.

  • 0
hamedostadi

همگام سازی خرید پستی با اپن کارت 2

با سلام . بنده دارم ماژول خرید پستی را با ورژن 2 اپن کارت همگام سازی می کنم . الان به یه مشکل خوردم . نمی دونم چرا پارامترها به دیتابیس در قسمت setting ذخیره نمی شه. 

دو تا فایلها را می فرستم ببینید اشکال کار در کجاست. 

فایل ws_posts.tpl

    <?php echo $header; ?><?php echo $column_left; ?>
    <div id="content">

    <div class="page-header">
        <div class="container-fluid">
          <div class="pull-right">
            <button type="submit" form="form-ws-posts" data-toggle="tooltip" title="<?php echo $button_save; ?>" class="btn btn-primary"><i class="fa fa-save"></i></button>
            <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="<?php echo $button_cancel; ?>" class="btn btn-default"><i class="fa fa-reply"></i></a></div>
          <h1><?php echo $heading_title; ?></h1>
          <ul class="breadcrumb">
            <?php foreach ($breadcrumbs as $breadcrumb) { ?>
            <li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
            <?php } ?>
          </ul>
        </div>
      </div>





      <div class="container-fluid">
        <?php if ($error_warning) { ?>
        <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
          <button type="button" class="close" data-dismiss="alert">&times;</button>
        </div>
        <?php } ?>
        
        
        <div class="panel panel-default">
          <div class="panel-heading">
            <h3 class="panel-title"><i class="fa fa-pencil"></i> </h3>
          </div>
          <div class="panel-body">
              <ul class="nav nav-tabs">
                <li class="active"><a href="#tab-general" data-toggle="tab"><?php echo $tab_general; ?></a></li>
                <li><a href="#tab-settle" data-toggle="tab"><?php echo $tab_settings; ?></a></li>
                <!--<li><a href="#tab-refund" data-toggle="tab"><?php echo $tab_refund; ?></a></li>-->
              </ul>
              
              
              
              
              <div class="tab-content">
                <div class="tab-pane active" id="tab-general">
            <form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form-ws-posts">
            <h2><?php echo $fields_configuration_1; ?></h2>
              <div class="form-group">
              <table class="form">
                            <tr>
                                <td><?php echo $entry_provider; ?></td>
                                <td>
                                    <select name="wsposts_provider">
                                        <?php
                                            $providers = array(
                                                'IranMc'       => 'ایران مارکت سنتر',
                                                'ParsPeik'     => 'پارس پیک',
                                                'Frotel'       => 'فروتل',
                                                'ErsalMarket'  => 'ارسال مارکت (هایسل)',
                                                'Hamvar'       => 'هموار',
                                                'SafirCOD'     => 'سفیر',
                                                //'WebSky'     => 'آسمان وب',
                                                'MellatMarket' => 'ملت مارکت'
                                            );
                                            
                                            foreach($providers as $provider => $p_name) {
                                                echo '<option value="' . $provider . '" ' . ($wsposts_provider == $provider ? 'selected="selected"' : '') . '>' . $p_name . '</option>';
                                            }
                                        ?>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_co_id; ?></td>
                                <td><input type="text" name="wsposts_co_id" value="<?php echo $wsposts_co_id; ?>" size="25" /></td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_username; ?></td>
                                <td><input type="text" name="wsposts_username" value="<?php echo $wsposts_username; ?>" size="25"  /></td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_password; ?></td>
                                <td><input type="text" name="wsposts_password" value="<?php echo $wsposts_password; ?>" size="25" /></td>
                            </tr>
                        </table>

              </div>
      
              <div class="form-group">
              
              <h2><?php echo $fields_configuration_2; ?></h2>
                        <table class="form">
                            <tr>
                                <td><?php echo $entry_default_product_weight; ?></td>
                                <td><input type="text" name="wsposts_default_product_weight" value="<?php echo $wsposts_default_product_weight; ?>" size="25" /></td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_default_product_price; ?></td>
                                <td><input type="text" name="wsposts_default_product_price" value="<?php echo $wsposts_default_product_price; ?>" size="25" /></td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_order_status; ?></td>
                                <td>
                                    <select name="ws_posts_order_status_id">
                                        <?php foreach ($order_statuses as $order_status) { ?>
                                            <option value="<?php echo $order_status['order_status_id']; ?>" <?php echo $order_status['order_status_id'] == $ws_posts_order_status_id ? 'selected="selected"' : '' ?>><?php echo $order_status['name']; ?></option>
                                        <?php } ?>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_status; ?></td>
                                <td>
                                    <select name="ws_posts_status">
                                        <option value="1" <?php echo $ws_posts_status ? 'selected="selected"' : ''; ?>><?php echo $text_enabled; ?></option>
                                        <option value="0" <?php echo !$ws_posts_status  ? 'selected="selected"' : ''; ?>><?php echo $text_disabled; ?></option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_sort_order; ?></td>
                                <td><input type="text" name="ws_posts_sort_order" value="<?php echo $ws_posts_sort_order; ?>" size="1" /></td>
                            </tr>
                        </table>
         
              </div>


                </div>
                <div class="tab-pane" id="tab-settle">
                    
            <h2><?php echo $fields_configuration_3; ?></h2>        
                    

              <div class="form-group">
               
               <table class="form">
                            <tr>
                                <td><?php echo $entry_setting_frotel_state; ?></td>
                                <td>
                                    <?php
                                        $states = array(
                                            '41' => 'آذربایجان شرقی',
                                            '44' => 'آذربایجان غربی',
                                            '45' => 'اردبیل',
                                            '31' => 'اصفهان',
                                            '84' => 'ایلام',
                                            '77' => 'بوشهر',
                                            '26' => 'البرز',
                                            '21' => 'تهران',
                                            '38' => 'چهارمحال و بختیاری',
                                            '56' => 'خراسان جنوبی',
                                            '51' => 'خراسان رضوی',
                                            '58' => 'خراسان شمالی',
                                            '61' => 'خوزستان',
                                            '24' => 'زنجان',
                                            '23' => 'سمنان',
                                            '54' => 'سیستان و بلوچستان',
                                            '71' => 'فارس',
                                            '28' => 'قزوین',
                                            '25' => 'قم',
                                            '87' => 'کردستان',
                                            '34' => 'کرمان',
                                            '83' => 'کرمانشاه',
                                            '74' => 'کهکیلویه و بویراحمد',
                                            '17' => 'گلستان',
                                            '13' => 'گیلان',
                                            '66' => 'لرستان',
                                            '15' => 'مازندران',
                                            '86' => 'مرکزی',
                                            '76' => 'هرمزگان',
                                            '81' => 'همدان',
                                            '35' => 'یزد'
                                        );
                                    ?>
                                    
                                    <script type="text/javascript" src="<?php echo HTTP_CATALOG; ?>catalog/view/javascript/js_wsposts/wsposts-frotel.js"></script>
                                    <select id="state_id" name="wsposts_setting_frotel_state" onchange="load_Cities(this.value);">
                                        <option value="0"><?php echo $text_select; ?></option>
                                        
                                        <?php foreach($states as $key => $value) { ?>
                                            <option value="<?php echo $key; ?>" <?php echo isset($wsposts_setting_frotel_state) && $wsposts_setting_frotel_state == $key ? 'selected="selected"' : ''; ?>><?php echo $value; ?></option>
                                        <?php } ?>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td><?php echo $entry_setting_frotel_city; ?></td>
                                <td>
                                    <select id="city_id" name="wsposts_setting_frotel_city">
                                        <option value="0"><?php echo $text_select; ?></option>
                                    </select>
                                </td>
                            </tr>
                        </table>
                        
                        
               
               
               
              </div>
              
                </div>

            </div>
            
          </div>
        </div>
      </div>
    </form>


    </div>


    <?php echo $footer; ?> 

 و فایل ws_posts.php

    <?php
    class ControllerPaymentWsPosts extends Controller {
        private $error = array();
        
        public function install() {
            $unFiles = array(
                // admin/controller
                DIR_APPLICATION . 'controller/payment/webservice.php',
                DIR_APPLICATION . 'controller/module/rahgiri.php',
                DIR_APPLICATION . 'controller/shipping/emspost.php',
                DIR_APPLICATION . 'controller/shipping/expresspost.php',
                DIR_APPLICATION . 'controller/shipping/ws_express.php',
                DIR_APPLICATION . 'controller/shipping/ws_registred.php',

                // admin/language
                DIR_APPLICATION . 'language/english/payment/webservice.php',
                DIR_APPLICATION . 'language/english/module/rahgiri.php',
                DIR_APPLICATION . 'language/english/shipping/emspost.php',
                DIR_APPLICATION . 'language/english/shipping/expresspost.php',
                DIR_APPLICATION . 'language/english/shipping/ws_express.php',
                DIR_APPLICATION . 'language/english/shipping/ws_registred.php',
                DIR_APPLICATION . 'language/persian/payment/webservice.php',
                DIR_APPLICATION . 'language/persian/module/rahgiri.php',
                DIR_APPLICATION . 'language/persian/shipping/emspost.php',
                DIR_APPLICATION . 'language/persian/shipping/expresspost.php',
                DIR_APPLICATION . 'language/persian/shipping/ws_express.php',
                DIR_APPLICATION . 'language/persian/shipping/ws_registred.php',

                // admin/view
                DIR_APPLICATION . 'view/template/payment/webservice.tpl',
                DIR_APPLICATION . 'view/template/module/rahgiri.tpl',
                DIR_APPLICATION . 'view/template/shipping/emspost.tpl',
                DIR_APPLICATION . 'view/template/shipping/expresspost.tpl',
                DIR_APPLICATION . 'view/template/shipping/ws_express.tpl',
                DIR_APPLICATION . 'view/template/shipping/ws_registred.tpl',
                DIR_APPLICATION . 'view/image/payment/webservice.png',
                DIR_APPLICATION . 'view/image/payment/webservice2.png',
            
                // catalog/controller
                DIR_CATALOG . 'controller/payment/webservice.php',
                DIR_CATALOG . 'controller/module/rahgiri.php',

                // catalog/language
                DIR_CATALOG . 'language/english/payment/webservice.php',
                DIR_CATALOG . 'language/english/module/rahgiri.php',
                DIR_CATALOG . 'language/english/shipping/emspost.php',
                DIR_CATALOG . 'language/english/shipping/expresspost.php',
                DIR_CATALOG . 'language/english/shipping/ws_express.php',
                DIR_CATALOG . 'language/english/shipping/ws_registred.php',
                DIR_CATALOG . 'language/persian/payment/webservice.php',
                DIR_CATALOG . 'language/persian/module/rahgiri.php',
                DIR_CATALOG . 'language/persian/shipping/emspost.php',
                DIR_CATALOG . 'language/persian/shipping/expresspost.php',
                DIR_CATALOG . 'language/persian/shipping/ws_express.php',
                DIR_CATALOG . 'language/persian/shipping/ws_registred.php',
                
                // catalog/model
                DIR_CATALOG . 'model/payment/webservice.php',
                DIR_CATALOG . 'model/shipping/emspost.php',
                DIR_CATALOG . 'model/shipping/expresspost.php',
                DIR_CATALOG . 'model/shipping/ws_express.php',
                DIR_CATALOG . 'model/shipping/ws_registred.php',

                // catalog/view
                DIR_CATALOG . 'view/theme/default/template/payment/webservice.tpl',
                DIR_CATALOG . 'view/theme/default/template/payment/webservice_info.tpl',
                DIR_CATALOG . 'view/theme/default/template/module/rahgiri.tpl',
                DIR_CATALOG . 'view/javascript/js_webservice/webservice-frotel.js',
                DIR_CATALOG . 'view/javascript/js_webservice/webservice-hamvar.js',
                DIR_CATALOG . 'view/javascript/js_webservice/webservice-mellatmarket.js',
                DIR_CATALOG . 'view/javascript/js_webservice/webservice-websky.js',
                
                // vqmod/xml
                dirname(DIR_SYSTEM) . '/vqmod/xml/wsposts-1-5-1-x.xml',
                dirname(DIR_SYSTEM) . '/vqmod/xml/wsposts-1-5-3-x.xml'
            );
            
            foreach ($unFiles as $unFile) {
                if (file_exists($unFile)) { unlink($unFile); }
            }
        }
        
        public function index() {
            if (file_exists(DIR_SYSTEM . 'library/Ws-Reset.txt')) {
                
                $this->install();
                unlink(DIR_SYSTEM . 'library/Ws-Reset.txt');
            }
            
            /* Language */
            $this->load->language('payment/ws_posts');
            $this->document->setTitle($this->language->get('heading_title'));
            
            /* Model */
            $this->load->model('setting/setting');
            $this->load->model('localisation/order_status');
            
            /* (Update) */
            if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {
                
                $parameters = array(
                    'SellerState' => trim($this->request->post['wsposts_setting_frotel_state']),
                    'SellerCity' => trim($this->request->post['wsposts_setting_frotel_city'])
                );
                
                $this->request->post['wsposts_options'] = base64_encode(trim(serialize($parameters)));
                $this->model_setting_setting->editSetting('ws_posts', $this->request->post);

                
                $this->session->data['success'] = $this->language->get('text_success');            

                $this->response->redirect($this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL'));
            }
            
            $data['heading_title'] = $this->language->get('heading_title');
            
            $data['text_enabled'] = $this->language->get('text_enabled');
            $data['text_disabled'] = $this->language->get('text_disabled');
            $data['text_all_zones'] = $this->language->get('text_all_zones');
            $data['text_select'] = $this->language->get('text_select');
            $data['text_none'] = $this->language->get('text_none');
            
            $data['button_save'] = $this->language->get('button_save');
            $data['button_cancel'] = $this->language->get('button_cancel');
            
            $data['tab_general'] = $this->language->get('tab_general');
            $data['tab_settings'] = $this->language->get('tab_settings');
            
            $data['fields_configuration_1'] = $this->language->get('fields_configuration_1');
            $data['fields_configuration_2'] = $this->language->get('fields_configuration_2');
            $data['fields_configuration_3'] = $this->language->get('fields_configuration_3');
            
            $data['entry_provider'] = $this->language->get('entry_provider');
            $data['entry_co_id'] = $this->language->get('entry_co_id');
            $data['entry_username'] = $this->language->get('entry_username');
            $data['entry_client'] = $this->language->get('entry_client');
            $data['entry_password'] = $this->language->get('entry_password');    
            //$data['entry_options'] = $this->language->get('entry_options');
            $data['entry_default_product_weight'] = $this->language->get('entry_default_product_weight');
            $data['entry_default_product_price'] = $this->language->get('entry_default_product_price');
            $data['entry_order_status'] = $this->language->get('entry_order_status');        
            $data['entry_status'] = $this->language->get('entry_status');
            $data['entry_sort_order'] = $this->language->get('entry_sort_order');
            $data['entry_setting_frotel_state'] = $this->language->get('entry_setting_frotel_state');
            $data['entry_setting_frotel_city'] = $this->language->get('entry_setting_frotel_city');
            
            /* Warnings */
            if (isset($this->error['warning'])) {
                  $data['error_warning'] = $this->error['warning'];
            } else {
                 $data['error_warning'] = '';
            }
            $data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : '';
            
            /* Breadcrumbs */
            $data['breadcrumbs'] = array();

            $data['breadcrumbs'][] = array(
                'text' => $this->language->get('text_home'),
                'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
            );

            $data['breadcrumbs'][] = array(
                'text' => $this->language->get('text_payment'),
                'href' => $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL')
            );    
               $data['breadcrumbs'] = array();

            $data['breadcrumbs'][] = array(
                'text' => $this->language->get('text_home'),
                'href' => $this->url->link('common/dashboard', 'token=' . $this->session->data['token'], 'SSL')
            );

            $data['breadcrumbs'][] = array(
                'text' => $this->language->get('text_payment'),
                'href' => $this->url->link('payment/ws_posts', 'token=' . $this->session->data['token'], 'SSL')
            );

            
            /* Actions */
            $data['action'] = $this->url->link('payment/ws_posts', 'token=' . $this->session->data['token'], 'SSL');
            $data['cancel'] = $this->url->link('extension/payment', 'token=' . $this->session->data['token'], 'SSL');    
            
            /* (Fields)->Payment */


            if (isset($this->request->post['wsposts_provider'])) {
                  $data['wsposts_provider'] = $this->request->post['wsposts_provider'];
            } else {
                 $data['wsposts_provider'] = $this->config->get('wsposts_provider');
            }

            if (isset($this->request->post['wsposts_co_id'])) {
                  $data['wsposts_co_id'] = $this->request->post['wsposts_co_id'];
            } else {
                 $data['wsposts_co_id'] =  $this->config->get('wsposts_co_id');
            }

            
            if (isset($this->request->post['wsposts_username'])) {
                  $data['wsposts_username'] =  $this->request->post['wsposts_username'];
            } else {
                 $data['wsposts_username'] =  $this->config->get('wsposts_username');
            }

        
            
            if (isset($this->request->post['wsposts_password'])) {
                 $data['wsposts_password'] =  $this->request->post['wsposts_password'];
            } else {
                $data['wsposts_password'] =  $this->config->get('wsposts_password');
            }

            
            
            ////$data['wsposts_options'] = isset($this->request->post['wsposts_options']) ? $this->request->post['wsposts_options'] : $this->config->get('wsposts_options');
            
            if (isset($this->request->post['wsposts_default_product_weight'])) {
                 $data['wsposts_default_product_weight'] =   $this->request->post['wsposts_default_product_weight'];
            } else {
                $data['wsposts_default_product_weight'] =  $this->config->get('wsposts_default_product_weight');
            }
            
            
            
            if (isset($this->request->post['wsposts_default_product_price'])) {
                 $data['wsposts_default_product_price'] =   $this->request->post['wsposts_default_product_price'];
            } else {
                $data['wsposts_default_product_price'] =  $this->config->get('wsposts_default_product_price');
            }
            

            
            if (isset($this->request->post['wsposts_setting_frotel_state'])) {
                 $data['wsposts_setting_frotel_state'] =   $this->request->post['wsposts_setting_frotel_state'];
            } else {
                $data['wsposts_setting_frotel_state'] =  $this->config->get('wsposts_setting_frotel_state');
            }
            
            
            
            if (isset($this->request->post['wsposts_setting_frotel_city'])) {
                 $data['wsposts_setting_frotel_city'] =   $this->request->post['wsposts_setting_frotel_city'];
            } else {
                $data['wsposts_setting_frotel_city'] =  $this->config->get('wsposts_setting_frotel_city');
            }
            
            
            /* (Fields)->Application */
            
        
            if (isset($this->request->post['ws_posts_order_status_id'])) {
                 $data['ws_posts_order_status_id'] =   $this->request->post['ws_posts_order_status_id'];
            } else {
                $data['ws_posts_order_status_id'] =  $this->config->get('ws_posts_order_status_id');
            }

            
            
            if (isset($this->request->post['ws_posts_sort_order'])) {
                 $data['ws_posts_sort_order'] =   $this->request->post['ws_posts_sort_order'];
            } else {
                $data['ws_posts_sort_order'] =  $this->config->get('ws_posts_sort_order');
            }

            
            
            if (isset($this->request->post['ws_posts_status'])) {
                 $data['ws_posts_status'] =  $this->request->post['ws_posts_status'];
            } else {
                $data['ws_posts_status'] =  $this->config->get('ws_posts_status');
            }
            /* DataRows */
            $data['order_statuses'] = $this->model_localisation_order_status->getOrderStatuses();
            
            /* Template */
            $data['header'] = $this->load->controller('common/header');
            $data['column_left'] = $this->load->controller('common/column_left');
            $data['footer'] = $this->load->controller('common/footer');

            $this->response->setOutput($this->load->view('payment/ws_posts.tpl', $data));

        }
        
        protected function validate() {
            if (!$this->user->hasPermission('modify', 'payment/ws_posts')) {
                $this->error['warning'] = $this->language->get('error_permission');
            }

            return !$this->error;
        }
    }
    ?>

 

0

به اشتراک گذاری این ارسال


لینک به ارسال
به اشتراک گذاری در سایت های دیگر

2 پاسخ به این سوال تا کنون داده شده است

  • 0

حل شد .

مشکل اینجا بود

 $this->model_setting_setting->editSetting('ws_posts', $this->request->post);

که با ید اینج.وری می شد

 $this->model_setting_setting->editSetting('wsposts', $this->request->post);

1

به اشتراک گذاری این ارسال


لینک به ارسال
به اشتراک گذاری در سایت های دیگر

برای ارسال دیدگاه یک حساب کاربری ایجاد کنید یا وارد حساب خود شوید

برای اینکه بتوانید دیدگاهی ارسال کنید نیاز دارید که کاربر سایت شوید

ایجاد یک حساب کاربری

برای حساب کاربری جدید در سایت ما ثبت نام کنید. عضویت خیلی ساده است !


ثبت نام یک حساب کاربری جدید

ورود به حساب کاربری

دارای حساب کاربری هستید؟ از اینجا وارد شوید


ورود به حساب کاربری