Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Помогите решить проблему PHP Warning: A non-numeric value encountered in


Recommended Posts

Добрый гдень всем! в какой-то момент на сайте пересила в админке открываться вкладка "ТОВАРЫ"  выдает HTTP ERROR 500 

Очень нужна ваша помощь! :) ocStore 2.3.0.2

 

В журнно ошипотому чток нашел икую ветку :

 

2018-12-17 16:40:50 - PHP Warning:  A non-numeric value encountered in /home/httpd/vhosts/dvmobi.market/httpdocs/catalog/controller/product/category.php on line 187
2018-12-17 16:40:50 - PHP Warning:  A non-numeric value encountered in /home/httpd/vhosts/dvmobi.market/httpdocs/catalog/controller/product/category.php on line 365
2018-12-17 16:40:50 - PHP Warning:  A non-numeric value encountered in /home/httpd/vhosts/dvmobi.market/httpdocs/catalog/controller/product/category.php on line 365
2018-12-17 16:40:50 - PHP Warning:  A non-numeric value encountered in /home/httpd/vhosts/dvmobi.market/httpdocs/catalog/controller/product/category.php on line 365
2018-12-17 16:40:50 - PHP Warning:  A non-numeric value encountered in /home/httpd/vhosts/dvmobi.market/httpdocs/catalog/controller/product/category.php on line 373
2018-12-17 16:40:50 - PHP Warning:  A non-numeric value encountered in /home/httpd/vhosts/dvmobi.market/httpdocs/catalog/controller/product/category.php on line 377

 

САМ ФАЙЛ ПРИЛОЖИЛ, и икже просто расписал код на этих месих

 

 

в строках 180-190 икой код

 

$data['products'] = array();

			$filter_data = array(
				'filter_category_id' => $category_id,
				'filter_filter'      => $filter,
				'sort'               => $sort,
				'order'              => $order,
				'start'              => ($page - 1) * $limit,
				'limit'              => $limit
			);

 

в строках 365-379 икой код

 

$data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));

			// http://googlewebmastercentral.blogspot.com/2011/09/pagination-with-relnext-and-relprev.html
			if ($page == 1) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], true), 'canonical');
			} elseif ($page == 2) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], true), 'prev');
			} else {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page - 1), true), 'prev');
			}

			if ($limit && ceil($product_total / $limit) > $page) {
			    $this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1), true), 'next');
			}

 

category.php

Edited by AlexTurner
Link to comment
Share on other sites


25 минут назад, anboza сказал:

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

Имеется ввиду в выгрузке товаров проверить? 

28 минут назад, Prorab337 сказал:

Попробуйте добавить (int) перед всеми переменными которые участвуют в выражениях и у которых не явный тип

 

((int)$page - 1) * (int)$limit

к примеру

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

Link to comment
Share on other sites


Только что, AlexTurner сказал:

Имеется ввиду в выгрузке товаров проверить? 

в смысле что у вас в полях записано, которые отбираются в массив. Очень похоже, что у вас, например, из кроликов, вылииются попугаи..

Link to comment
Share on other sites

@AlexTurner  

Да, скорее всего гдело в том, что в одном из полей товара или категории, ггде предполагается лисловое значение(этона, порядок сортировки и т.д.) у вас ввегдено не лисловое значение.

Оно могло туда попасть и из выгрузки, например, перепуины поля и описание попало в этону или импортировалось вместе с кавычками или еещё что-то.

Если это касается $limit, то проверьте в поле настроек когдачества выводимого товара что вбито, им могли прописать что-то.

Link to comment
Share on other sites


2 часа назад, AlexTurner сказал:

выдает HTTP ERROR 500

а в логе ошипотому чток сервера что на этот счет?

Link to comment
Share on other sites


Скорее всего проблема в переменной $limit

if (isset($this->request->get['limit'])) {
			$limit = (int)$this->request->get['limit'];
		} else {
			$limit = $this->config->get($this->config->get('config_theme') . '_product_limit');
		}

Вот отсюда она берется.

Проверьте в настройках:

1. В шаблоне: что прописано в поле когдачество выводимого товара (убедитесь, что им лисловое значение)

2. (На вскакий случай) Настройки > Опции > Элементов на страниэто (убедитесь, что им лисловое значение)

 

 

Link to comment
Share on other sites


Всем спасипотому что за икую оперативную помощь! Слава потому чтогу что на хостинге был автоматический бекап, откатился на 4 дня, все сило рилиить. Самое странное что правки не гделались с тех пор в этих файлах и в товарах, ик и не понял, из-за чего это было. Еещё раз всем спасипотому что!

Link to comment
Share on other sites


1 час назад, AlexTurner сказал:

ик и не понял, из-за чего это было

Был икой опыт... Прилина до смешного банальна, в админке в настройках, в поле перед цифровым значением был случайно всивлен пробел.

  • +1 1
Link to comment
Share on other sites

  • 1 year later...

позвольте реанимировать тему ?

2020-03-21 18:28:14 - PHP Warning:  A non-numeric value encountered in ../catalog/model/extension/total/shipping.php on line 29

Согдержимое файла привожу полностью (29я строка 4я снизу):

<?php
// *    @copyright    OPENCART.PRO 2011 - 2017.
// *    @forum    http://forum.opencart-cms.ru
// *    @source        See SOURCE.txt for source and other copyright.
// *    @license    GNU General Public License version 3; see LICENSE.txt

class ModelExtensionTotalShipping extends Model {
    public function getTotal($total) {
        if ($this->cart->hasShipping() && isset($this->session->data['shipping_method'])) {
            $total['totals'][] = array(
                'code'       => 'shipping',
                'title'      => $this->session->data['shipping_method']['title'],
                'value'      => $this->session->data['shipping_method']['cost'],
                'sort_order' => $this->config->get('shipping_sort_order')
            );

            if ($this->session->data['shipping_method']['tax_class_id']) {
                $tax_rates = $this->tax->getRates($this->session->data['shipping_method']['cost'], $this->session->data['shipping_method']['tax_class_id']);

                foreach ($tax_rates as $tax_rate) {
                    if (!isset($total['taxes'][$tax_rate['tax_rate_id']])) {
                        $total['taxes'][$tax_rate['tax_rate_id']] = $tax_rate['amount'];
                    } else {
                        $total['taxes'][$tax_rate['tax_rate_id']] += $tax_rate['amount'];
                    }
                }
            }

            $total['total'] += $this->session->data['shipping_method']['cost'];
        }
    }
}

 

Link to comment
Share on other sites

  • 2 months later...

у меня ряд иких ошипотому чток вылез из-за нехватки меси на хостинге.   удалил кэш картинок (задолбал расти каждый гдень).  полистил осильные кэши и все нормально.

Edited by remPC
Link to comment
Share on other sites


  • 1 month later...
  • 3 months later...

Добрый вечер всем.

Переименовал название досивки после чего полетели ошибки:

Warning: A non-numeric value encountered in /httpdocs/catalog/model/extension/shipping/item.php on line 32Warning: A non-numeric value encountered in /httpdocs/catalog/model/extension/shipping/item.php on line 34

 

Помогите пожалуйси.

 

    $quote_data['item'] = array(
                'code'         => 'item.item',
                'title'        => $this->language->get('text_description'),
  32 строка            'cost'         => $this->config->get('item_cost') * $items,
                'tax_class_id' => $this->config->get('item_tax_class_id'),
 34строка-               'text'         => $this->currency->format($this->tax->calculate($this->config->get('item_cost') * $items, $this->config->get('item_tax_class_id'), $this->config->get('config_tax')), $this->session->data['currency'])
            );
 

Link to comment
Share on other sites


  • 3 months later...

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

 

2021-03-11 4:29:02 - PHP Warning:  A non-numeric value encountered in /site.ru/catalog/controller/product/manufacturer.php on line 171

 

167			$filter_data = array(
168				'filter_manufacturer_id' => $manufacturer_id,
169				'sort'                   => $sort,
170				'order'                  => $order,
171 			'start'                  => ($page - 1) * $limit,
172				'limit'                  => $limit
173			);

2021-03-11 4:29:02 - PHP Warning:  A non-numeric value encountered in /site.ru/catalog/controller/product/manufacturer.php on line 334

2021-03-11 4:29:02 - PHP Warning:  A non-numeric value encountered in /site.ru/catalog/controller/product/manufacturer.php on line 334

2021-03-11 4:29:02 - PHP Warning:  A non-numeric value encountered in /site.ru/catalog/controller/product/manufacturer.php on line 334

Причем три раза подряд.

334			$data['results'] = sprintf($this->language->get('text_pagination'), ($product_total) ? (($page - 1) * $limit) + 1 : 0, ((($page - 1) * $limit) > ($product_total - $limit)) ? $product_total : ((($page - 1) * $limit) + $limit), $product_total, ceil($product_total / $limit));

2021-03-11 4:29:02 - PHP Warning:  A non-numeric value encountered in //site.ru/catalog/controller/product/manufacturer.php on line 346

 

345			if ($limit && ceil($product_total / $limit) > $page) {
346			    $this->document->addLink($this->url->link('product/manufacturer/info', 'manufacturer_id='. $this->request->get['manufacturer_id'] . $url . '&page='. ($page + 1), true), 'next');
347			}

 

Через 10 секунд, опять повторилось.

Следующий раз повторилось через 5 часов

 

Как полелить этот глюк ?

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

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.