Post by psjrules » Wed Mar 19, 2025 11:24 pm

OpenCart Version 3.0.3.6
We noticed when customers make purchases, the order (even though successful) goes to the missing order. (one of the forum solutions mentioned SMTP, this is not the issue, I've checked).
However, when I try to manually change the order, I get an internal server error. I enabled debugging and log in so on the website, I get a meaning error, instead of "internal Server error". Below is the error.
I also get this error when I click on shipping information on the order.

Error From Website (this error is also identical to the one in public_html/admin/error_log)

Fatal error: Uncaught TypeError: Unsupported operand types: string + string in/ storage/modification/admin/controller/sale/order.php:1807
Stack trace:
#0 /storage/modification/system/engine/action.php(79): ControllerSaleOrder->shipping()
#1 /public_html/admin/controller/startup/router.php(26): Action->execute(Object(Registry), Array)
#2 /storage/modification/system/engine/action.php(79): ControllerStartupRouter->index()
#3 /public_html/system/engine/router.php(67): Action->execute(Object(Registry))
#4 /public_html/system/engine/router.php(56): Router->execute(Object(Action))
#5 /public_html/system/framework.php(166): Router->dispatch(Object(Action), Object(Action))
#6 /public_html/system/startup.php(104): require_once('/home/dartprof/...')
#7 /public_html/admin/index.php(35): start('admin')
#8 {main} thrown in /storage/modification/admin/controller/sale/order.php on line 1807

New member

Posts

Joined
Fri Jan 11, 2019 6:57 pm

Post by ADD Creative » Thu Mar 20, 2025 12:04 am

Could be caused by an extension as the error is in a file in storage/modification. Try disabling any extensions that modify admin/controller/sale/order.php or look to see what is as storage/modification/admin/controller/sale/order.php line 1807.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by psjrules » Thu Mar 20, 2025 12:21 am

Below is the code section where the error is coming:

The line 1807 it is complaining about is: 'value' => $value //line 1807

There has not been any new extension installed in over 5 years. SAGEPAY direct was recently restored. I have disabled the payment and the problem persisted.

===========================

Code: Select all

public function shipping() {
		$this->load->language('sale/order');

		$data['title'] = $this->language->get('text_shipping');

		if ($this->request->server['HTTPS']) {
			$data['base'] = HTTPS_SERVER;
		} else {
			$data['base'] = HTTP_SERVER;
		}

		$data['direction'] = $this->language->get('direction');
		$data['lang'] = $this->language->get('code');

		$this->load->model('sale/order');

		$this->load->model('catalog/product');

		$this->load->model('setting/setting');

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

		$orders = array();

		if (isset($this->request->post['selected'])) {
			$orders = $this->request->post['selected'];
		} elseif (isset($this->request->get['order_id'])) {
			$orders[] = $this->request->get['order_id'];
		}

		foreach ($orders as $order_id) {
			$order_info = $this->model_sale_order->getOrder($order_id);

			// Make sure there is a shipping method
			if ($order_info && $order_info['shipping_code']) {
				$store_info = $this->model_setting_setting->getSetting('config', $order_info['store_id']);

				if ($store_info) {
					$store_address = $store_info['config_address'];
					$store_email = $store_info['config_email'];
					$store_telephone = $store_info['config_telephone'];
				} else {
					$store_address = $this->config->get('config_address');
					$store_email = $this->config->get('config_email');
					$store_telephone = $this->config->get('config_telephone');
				}

				if ($order_info['invoice_no']) {
					$invoice_no = $order_info['invoice_prefix'] . $order_info['invoice_no'];
				} else {
					$invoice_no = '';
				}

				if ($order_info['shipping_address_format']) {
					$format = $order_info['shipping_address_format'];
				} else {
					$format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
				}

				$find = array(
					'{firstname}',
					'{lastname}',
					'{company}',
					'{address_1}',
					'{address_2}',
					'{city}',
					'{postcode}',
					'{zone}',
					'{zone_code}',
					'{country}'
				);

				$replace = array(
					'firstname' => $order_info['shipping_firstname'],
					'lastname'  => $order_info['shipping_lastname'],
					'company'   => $order_info['shipping_company'],
					'address_1' => $order_info['shipping_address_1'],
					'address_2' => $order_info['shipping_address_2'],
					'city'      => $order_info['shipping_city'],
					'postcode'  => $order_info['shipping_postcode'],
					'zone'      => $order_info['shipping_zone'],
					'zone_code' => $order_info['shipping_zone_code'],
					'country'   => $order_info['shipping_country']
				);

				$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   //line 1807
							);

							$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'))
						);
					}
				}


				require_once DIR_SYSTEM . '/library/cw/SagePayCw/init.php';
				require_once ('SagePayCw/Util.php');
				require_once ('SagePayCw/Language.php');
				SagePayCw_Util::setRegistry($this->registry);
				$sagepaycw_entities = SagePayCw_Util::getEntityManager()->searchByFilterName('SagePayCw_Entity_Transaction', 'loadByOrderId', array('>orderId' => $order_id));
				$order_info['sagepaycw_pi'] = array();
				if(!empty($sagepaycw_entities)){
					foreach($sagepaycw_entities as $sagepaycw_transaction_entity) {
						if(($sagepaycw_transaction_entity->getAuthorizationStatus() == 'successful' || $sagepaycw_transaction_entity->getAuthorizationStatus() == 'authorizing') && $sagepaycw_transaction_entity->getTransactionObject() !== null && $sagepaycw_transaction_entity->getTransactionObject()->getPaymentInformation() != null) {
							$order_info['sagepaycw_pi']['title'] = (String) SagePayCw_Language::_('Payment Information');
							$order_info['sagepaycw_pi']['information'] = (String) $sagepaycw_transaction_entity->getTransactionObject()->getPaymentInformation();
							break;
						}
					}
				}
 			

				$data['orders'][] = array(
					'order_id'	       => $order_id,
					'invoice_no'       => $invoice_no,
					'date_added'       => date($this->language->get('date_format_short'), strtotime($order_info['date_added'])),
					'store_name'       => $order_info['store_name'],
					'store_url'        => rtrim($order_info['store_url'], '/'),
					'store_address'    => nl2br($store_address),
					'store_email'      => $store_email,
					'store_telephone'  => $store_telephone,
					'email'            => $order_info['email'],
					'telephone'        => $order_info['telephone'],
					'shipping_address' => $shipping_address,
					'shipping_method'  => $order_info['shipping_method'],
					'product'          => $product_data,
					'comment'          => nl2br($order_info['comment'])
				);
			}
		}

		$this->response->setOutput($this->load->view('sale/order_shipping', $data));
	}
}

New member

Posts

Joined
Fri Jan 11, 2019 6:57 pm

Post by ADD Creative » Thu Mar 20, 2025 5:17 am

That line doesn't add 2 stings together, so it's hard to see how it would produce that error. What PHP version are you using? Maybe your host has upgraded to one not compatible with your version of OpenCart.

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom
Who is online

Users browsing this forum: Majestic-12 [Bot] and 130 guests