Jump to content
Sign in to follow this  
EvgeniyOC

Модуль infosmska Undefined offset: 1 gateway.php on line 56

Recommended Posts

Всем привет! установил модуль infosmska (http://www.infosmska.ru/ ) для смс рассылок.
Но почему-то при совершении заказа вот такая ошибка выдается
Notice: Undefined offset: 1 in /system/library/oc_infosmska/gateway.php on line 56

код gateway.php  - http://pastebin.com/jsTxSf3m

<?php

class OCInfosmskaGateway {
    public function __construct($registry) {
        $this->db = $registry->get('db');
        $this->config = $registry->get('config');
    }


    public function get_order_info($textarea, $order_id, $order_status_id = 0) {
        $order = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order` WHERE order_id = $order_id LIMIT 1");
        $currency = $this->db->query("SELECT symbol_left,symbol_right FROM `" . DB_PREFIX . "currency` WHERE currency_id = " . $order->row['currency_id'] . " LIMIT 1");


        $total = $currency->row['symbol_left'].number_format(round($order->row['total'] * $order->row['currency_value'], 2), 2).$currency->row['symbol_right'];


        $g_list = $status->row['name'] = '';


        if (stripos($textarea, '{GOODS_LIST}') !== false) {
            $goods_list = $this->db->query("SELECT * FROM `" . DB_PREFIX . "order_product` WHERE order_id = $order_id");


            foreach ($goods_list->rows as $k => $v)
                $g_list .= ($k ? "\n" : '').$v['name'].':'.$v['model'].':'.$v['quantity'].':'.$currency->row['symbol_left'].
                        number_format(round($v['total'] * $order->row['currency_value'], 2), 2).$currency->row['symbol_right'];
        }


        if (stripos($textarea, '{ORDER_STATUS}') !== false)
            $status = $this->db->query("SELECT name FROM `" . DB_PREFIX . "order_status` WHERE order_status_id = " . ($order_status_id ? $order_status_id : $order->row['order_status_id']) . " AND language_id = ".$order->row['language_id'] . " LIMIT 1");


        $macros = array('~\{ORDER_NUM\}~i', '~\{ORDER_SUM\}~i', '~\{ORDER_STATUS\}~i', '~\{FIRST_NAME\}~i', '~\{LAST_NAME\}~i', '~\{CR_PHONE\}~i', '~\{CR_ADDR\}~i', '~\{GOODS_LIST\}~i');


        $value = str_replace('$', '\$', array($order_id, $total, $status->row['name'], $order->row['firstname'], $order->row['lastname'], $order->row['telephone'],
                                                $order->row['shipping_address_1'].($order->row['shipping_address_2'] ? ' '.$order->row['shipping_address_2'] : ''), $g_list));


        return array('phone' => $order->row['telephone'], 'message' => preg_replace($macros, $value, $textarea), 'order_status_id' => $order->row['order_status_id']);
    }




    public function send($login, $password, $phone, $text, $sender)
    {
        $host = "api.infosmska.ru";
        $fp = fsockopen($host, 80);
        fwrite($fp, "GET /interfaces/SendMessages.ashx" .
        "?login=" . rawurlencode($login) .
        "&pwd=" . rawurlencode($password) .
        "&phones=" . rawurlencode($phone) .
        "&message=" . rawurlencode($text) .
        "&sender=" . rawurlencode($sender) .
        " HTTP/1.1\r\nHost: $host\r\nConnection: Close\r\n\r\n");
        fwrite($fp, "Host: " . $host . "\r\n");
        fwrite($fp, "\n");

        $response = "";
          while(!feof($fp)) {
          $response .= fread($fp, 1);
          }
            fclose($fp);
            list($other, $responseBody) = explode("\r\n\r\n", $response, 2);
            list($other, $ids_str) = explode(":", $responseBody, 2);
            list($sms_id, $other) = explode(";", $ids_str, 2);
        return $sms_id;
    }




}

56 строка: list($sms_id, $other) = explode(";", $ids_str, 2);

 

я так понял, проблема в том. что функция explode как-то не так отрабатывает... Пожалуйста, помогите

 

Share this post


Link to post
Share on other sites

кхм... ну так а у них же спросить "в чем проблема?" ?

сервис предоставил модуль - попинайте их техподдержку.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By sonicking
      добрый день.использую (вернее пытаюсь использовать) для импорта товаров Total Import Pro
      при импорте выскакивает ошибка:
       
      The server returned an error. If you believe this is a bug then get in touch and attach the following error message:
      Notice: Undefined offset: 0 in D:\11042016\OpenServer\domains\xxxxxxx\admin\model\catalog\product.php on line 228{"updated":51,"added":0}
       
      думал какой то vqmod мешает. поставил чистый магазин на локалке (версия 15512), ошибка пристутствует.
       
      если закоментировать в product.php строку с ошибкой - то импорт проходит нормально, но за что то ведь закоментированная строка отвечает :о)
      не хотелось бы тут избавится от ошибки, а где то получить новую...
       
      в оригинальном opencarte этих строк в файле product.php вообще нет (код со строки 224)
      if (isset($data['main_category_id']) && $data['main_category_id'] > 0) { $this->db->query("DELETE FROM " . DB_PREFIX . "product_to_category WHERE product_id = '" . (int)$product_id . "' AND category_id = '" . (int)$data['main_category_id'] . "'"); $this->db->query("INSERT INTO " . DB_PREFIX . "product_to_category SET product_id = '" . (int)$product_id . "', category_id = '" . (int)$data['main_category_id'] . "', main_category = 1"); } elseif (isset($data['product_category'])) { $this->db->query("UPDATE " . DB_PREFIX . "product_to_category SET main_category = 1 WHERE product_id = '" . (int)$product_id . "' AND category_id = '" . (int)$data['product_category'][0] . "'"); } подскажите, за что он отвечает и как избавится от ошибки
      заранее спасибо
  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.