Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

(Решено)Ошибка PHP Warning: Missing argument 2 for Cart\Currency::format()


Recommended Posts

Привет народ!

 

Кто подскажет почему выдает ошибку на следующий код:

Строчка на которую ругается: 

$oprice = $this->currency->format($this->tax->calculate($option_value['price'], $result['tax_class_id'], $this->config->get('config_tax') ? 'P' : false));

Полный код в модификаторе:

	$options= array();
                foreach ($this->model_catalog_product->getProductOptions($result['product_id']) as $option) {
                    $product_option_value_data = array();
                    foreach ($option['product_option_value'] as $option_value) {
                        if (!$option_value['subtract'] || ($option_value['quantity'] > 0)) {
                            if ((($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) && (float)$option_value['price']) {
                                $oprice = $this->currency->format($this->tax->calculate($option_value['price'], $result['tax_class_id'], $this->config->get('config_tax') ? 'P' : false));
                            } else {
                                $oprice = false;
                            }

                            $product_option_value_data[] = array(
                                'product_option_value_id' => $option_value['product_option_value_id'],
                                'option_value_id'         => $option_value['option_value_id'],
                                'name'                    => $option_value['name'],
                                'image'                   => $this->model_tool_image->resize($option_value['image'], 36, 36),
                                'price'                   => $oprice,
                                'price_prefix'            => $option_value['price_prefix']
                            );
                        }
                    }
                    $options[] = array(
                        'product_option_id'    => $option['product_option_id'],
                        'product_option_value' => $product_option_value_data,
                        'option_id'            => $option['option_id'],
                        'name'                 => $option['name'],
                        'type'                 => $option['type'],
                        'value'                => $option['value'],
                        'required'             => $option['required']
                    );
                }

 Ошибка следующего вида:

2018-07-24 21:00:57 - PHP Warning:  Missing argument 2 for Cart\Currency::format(), called in /home//system/storage/modification/catalog/controller/product/product.php on line 866 and defined in /home/system/library/cart/currency.php on line 29
2018-07-24 21:00:57 - PHP Notice:  Undefined variable: currency in /home/system/library/cart/currency.php on line 30
2018-07-24 21:00:57 - PHP Notice:  Undefined index:  in /home/system/library/cart/currency.php on line 30
2018-07-24 21:00:57 - PHP Notice:  Undefined variable: currency in /home/system/library/cart/currency.php on line 31
2018-07-24 21:00:57 - PHP Notice:  Undefined index:  in /home/system/library/cart/currency.php on line 31
2018-07-24 21:00:57 - PHP Notice:  Undefined variable: currency in /home/library/cart/currency.php on line 32
2018-07-24 21:00:57 - PHP Notice:  Undefined index:  in /home/system/library/cart/currency.php on line 32
2018-07-24 21:00:57 - PHP Notice:  Undefined variable: currency in /home/system/library/cart/currency.php on line 35
2018-07-24 21:00:57 - PHP Notice:  Undefined index:  in /home/system/library/cart/currency.php on line 35

Edited by DrBraun
Link to comment
Share on other sites


Должно быть так:

$oprice = $this->currency->format($this->tax->calculate($option_value['price'], $result['tax_class_id'], $this->config->get('config_tax') ? 'P' : false), $this->session->data['currency']);

 

Link to comment
Share on other sites

Может быть что-то связано с файлом /home/system/library/cart/currency.php

Вот строчки на которые ругается (30,31,32,35):

	public function format($number, $currency, $value = '', $format = true) {
		$symbol_left = $this->currencies[$currency]['symbol_left'];
		$symbol_right = $this->currencies[$currency]['symbol_right'];
		$decimal_place = $this->currencies[$currency]['decimal_place'];

		if (!$value) {
			$value = $this->currencies[$currency]['value'];
		}

 

 

Link to comment
Share on other sites


26 минут назад, DrBraun сказал:

Может быть что-то связано с файлом /home/system/library/cart/currency.php

Вот строчки на которые ругается (30,31,32,35):

Так а текст ошибки какой?

 

  • +1 1
Link to comment
Share on other sites

7 минут назад, mpn2005 сказал:

Так а текст ошибки какой?

 

Все! Заработало! Оказалось что при копировании что-то с кодировкой символов. Переписал Ваш код в ручную все ошибки нет... 

Огромное спасибо! 

++++++ 50 тыщ плюсов... 

Edited by DrBraun
Link to comment
Share on other sites


Guest
This topic is now closed to further replies.
 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.