Post by jonagoldapple » Fri Apr 03, 2020 5:01 am

Ever since the start I see this error message when hitting the "print packing list" button for any order. The packing list shows, it just has this error message on top of the page so keep copy/paste the page into a document and delete the error message.
What should I look for in this file, on this specific line?

Code: Select all

Warning: A non-numeric value encountered in /var/www/vhosts/122/346133/webspace/httpdocs/theplanter.nl/vqmod/vqcache/vq2-admin_controller_sale_order.php on line 1907
Last edited by jonagoldapple on Fri Apr 03, 2020 9:06 pm, edited 1 time in total.

Active Member

Posts

Joined
Sun Jan 26, 2020 9:46 pm

Post by straightlight » Fri Apr 03, 2020 5:10 am

Using VQMod. What is on line 1907 of that file?

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jonagoldapple » Fri Apr 03, 2020 5:28 am

Code: Select all

$option_weight += $product_option_value_info['weight'];
I have not set a weight for my products as I didn't think I would need it. Could this have something to do with it?
Going to try setting a weight for my products tomorrow as maybe this solves the issue?

This is the entire piece of code:

Code: Select all

				$shipping_address = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\s\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));

				$this->load->model('tool/upload');

				$product_data = array();

				$products = $this->model_sale_order->getOrderProducts($order_id);

				foreach ($products as $product) {
					$option_weight = '';

					$product_info = $this->model_catalog_product->getProduct($product['product_id']);

					if ($product_info) {
						$option_data = array();

						$options = $this->model_sale_order->getOrderOptions($order_id, $product['order_product_id']);

						foreach ($options as $option) {
							if ($option['type'] != 'file') {
								$value = $option['value'];
							} else {
								$upload_info = $this->model_tool_upload->getUploadByCode($option['value']);

								if ($upload_info) {
									$value = $upload_info['name'];
								} else {
									$value = '';
								}
							}

							$option_data[] = array(
								'name'  => $option['name'],
								'value' => $value
							);

							$product_option_value_info = $this->model_catalog_product->getProductOptionValue($product['product_id'], $option['product_option_value_id']);

							if ($product_option_value_info) {
								if ($product_option_value_info['weight_prefix'] == '+') {
									$option_weight += $product_option_value_info['weight'];
								} elseif ($product_option_value_info['weight_prefix'] == '-') {
									$option_weight -= $product_option_value_info['weight'];
								}
							}
						}

						$product_data[] = array(
							'name'     => $product_info['name'],
							'model'    => $product_info['model'],
							'option'   => $option_data,
							'quantity' => $product['quantity'],
							'location' => $product_info['location'],
							'sku'      => $product_info['sku'],
							'upc'      => $product_info['upc'],
							'ean'      => $product_info['ean'],
							'jan'      => $product_info['jan'],
							'isbn'     => $product_info['isbn'],
							'mpn'      => $product_info['mpn'],
							'weight'   => $this->weight->format(($product_info['weight'] + (float)$option_weight) * $product['quantity'], $product_info['weight_class_id'], $this->language->get('decimal_point'), $this->language->get('thousand_point'))
						);
					}
				}

Active Member

Posts

Joined
Sun Jan 26, 2020 9:46 pm

Post by straightlight » Fri Apr 03, 2020 5:30 am

Replace:

Code: Select all

$option_weight = '';
with:

Code: Select all

$option_weight = 0.00;

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by jonagoldapple » Fri Apr 03, 2020 9:05 pm

Thank you a lot!
The error message disappeared.

Do I have to change the code back if I enter a weight for many of my products, to prevent further errors?

Active Member

Posts

Joined
Sun Jan 26, 2020 9:46 pm

Post by straightlight » Fri Apr 03, 2020 9:10 pm

Do I have to change the code back if I enter a weight for many of my products, to prevent further errors?
Simply leave the patch in as it is. You should be able to enter as many weight for many products.

The most generated errors being found on Opencart forum originates from contributed programming. The increased post counters are caused by redundancies of the same solutions that were already provided prior.


Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 20 guests