Jump to content
Sign in to follow this  
IgorIv

Ошибка при оформлении заказа

Recommended Posts

При оформлении способов доставки и оплаты

 появляется эта надпись:

 

Warning: Division by zero in /home/users2/i/ito/domains/ito-shop.ru/system/library/weight.php on line 38Warning: Division by zero in /home/users2/i/ito/domains/ito-shop.ru/system/library/weight.php on line 38

 

Тем не менее оформление возможно сделать.

Что это значит?

Share this post


Link to post
Share on other sites

Откройте файлы и смотрите операции в этой строке, вероятно какая то переменная не получает значение и получается деление на ноль

Share this post


Link to post
Share on other sites


<?php

class Weight {

private $weights = array();

public function __construct($registry) {

$this->db = $registry->get('db');

$this->config = $registry->get('config');

$weight_class_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "weight_class wc LEFT JOIN " . DB_PREFIX . "weight_class_description wcd ON (wc.weight_class_id = wcd.weight_class_id) WHERE wcd.language_id = '" . (int)$this->config->get('config_language_id') . "'");

foreach ($weight_class_query->rows as $result) {

$this->weights[$result['weight_class_id']] = array(

'weight_class_id' => $result['weight_class_id'],

'title' => $result['title'],

'unit' => $result['unit'],

'value' => $result['value']

);

}

}

public function convert($value, $from, $to) {

if ($from == $to) {

return $value;

}

if (isset($this->weights[$from])) {

$from = $this->weights[$from]['value'];

 } else {

$from = 0;

}

if (isset($this->weights[$to])) {

$to = $this->weights[$to]['value'];

} else {

$to = 0;

}

38 return $value * ($to / $from);                                                                                            

}

public function format($value, $weight_class_id, $decimal_point = '.', $thousand_point = ',') {

if (isset($this->weights[$weight_class_id])) {

return number_format($value, 2, $decimal_point, $thousand_point) . $this->weights[$weight_class_id]['unit'];

} else {

return number_format($value, 2, $decimal_point, $thousand_point);

}

}

public function getUnit($weight_class_id) {

if (isset($this->weights[$weight_class_id])) {

return $this->weights[$weight_class_id]['unit'];

} else {

return '';

}

}

}

?>

Share this post


Link to post
Share on other sites

Извините, что реанимирую старую тему, но столкнулся с проблемой.

Обновил PHP до версии 5.6 b столкнулся с ошибкой:

PHP Fatal error:  Using $this when not in object context in ... [имя файла]

Поискал в коде - вот кусок в котором проблема:

       function int_convert($value, $from, $to) {
                                if ($from == $to) {
                                           return $value;
                                }

                                if (isset($this->lengths[$from])) {
                                        $from = $this->lengths[$from]['value'];
                                } else {
                                        $from = 0;
                                }

                                if (isset($this->lengths[$to])) {
                                        $to = $this->lengths[$to]['value'];
                                } else {
                                        $to = 0;
                                }               
                return $value * ($to / $from);
}

Помогите, пожалуйста, исправить.

Edited by greendruid

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  

  • 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.