Jump to content

module error in PS8


overbags

Recommended Posts

Hello everyone
I recently switched to prestashop 8.1 and I have a problem with a decommissioned module when I activate debug
I tried to contact the developer but he no longer responds

I say that the problem is the module because if I activate the module and try to access the order page the error appears if I deactivate the module the error does not appear.

(attached image)

-----------------------------------------------------------------------------------

in src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/view.html.twig (line 91)

    {% if orderForViewing.linkedOrders.linkedOrders is not empty %}

      {% include '@PrestaShop/Admin/Sell/Order/Order/Blocks/View/linked_orders.html.twig' %}

    {% endif %}

    {{ renderhook('displayAdminOrder', {'id_order': orderForViewing.id}) }}

    {% include '@PrestaShop/Admin/Sell/Order/Order/Blocks/View/Modal/add_order_discount_modal.html.twig' %}

    {% include '@PrestaShop/Admin/Sell/Order/Order/Blocks/View/Modal/update_shipping_modal.html.twig' %}

    {% if orderForViewing.customer is not null and orderForViewing.customer.id != 0 %}

      {% include '@PrestaShop/Admin/Sell/Order/Order/Blocks/View/Modal/update_customer_address_modal.html.twig' %}

------------------------------------------------------------------------------------

in classes/Hook.php (line 431)

                }

            }

        } catch (Exception $e) {

            $environment = ServiceLocator::get('\\PrestaShop\\PrestaShop\\Adapter\\Environment');

            if ($environment->isDebug()) {

                throw new CoreException($e->getMessage(), $e->getCode(), $e);

            }

        }

        return '';

    }

------------------------------------------------------------------------------------------

errore.png

Link to comment
Share on other sites

On 09/11/2024 at 2:06 PM, Knowband Plugins dice:

Hi,

Try unregistrering the Hook displayAdminOrder of that module and confirm if the error still persists.

Regards.

 

Hi Knowband Plugins
do you think there is some error in the "public function hookDisplayAdminOrder($params)" ?

 

public function hookDisplayAdminOrder($params)
	{
		$order = new Order($params['id_order']);
		$product_extra_time = null;
		$product_extra_time_in_stock = null;
		$product_extra_time_oos = null;

		if (Validate::isLoadedObject($order))
		{
			$date_reference = ($order->invoice_date != '0000-00-00 00:00:00' ? $order->invoice_date : $order->date_add);

			if (Configuration::get('ADOD_ALLOW_ASAP_OPTION'))
			{
				$dates_delivery = array();
				
				foreach ($order->getProducts() as $product)
				{
					 if ($product['image'] != null) {
						$name = 'product_mini_'.(int)$product['product_id'].(isset($product['product_attribute_id']) ? '_'.(int)$product['product_attribute_id'] : '').'.jpg';
						// generate image cache, only for back office
						$product['image_tag'] = ImageManager::thumbnail(_PS_IMG_DIR_.'p/'.$product['image']->getExistingImgPath().'.jpg', $name, 45, 'jpg');
						if (file_exists(_PS_TMP_IMG_DIR_.$name)) {
							$product['image_size'] = getimagesize(_PS_TMP_IMG_DIR_.$name);
						} else {
							$product['image_size'] = false;
						}
					}

					$product_extra_time = false;
					$oos = false; // For out of stock management

					if (Configuration::get('PS_STOCK_MANAGEMENT'))
						if ($product['product_quantity'] > $product['product_quantity_in_stock'])
							$oos = true;

					if (Configuration::get('ADOD_FORCE_STOCK'))
						$oos = false;

					$product_extra_datas = $this->_getProductExtraTime($product['product_id'], ($product['product_attribute_id'] ? (int)$product['product_attribute_id'] : null));
					$available_date = $this->getAvailableDate($product['product_id'], ($product['product_attribute_id'] ? (int)$product['product_attribute_id'] : null), (int)$this->context->shop->id);

					if ($available_date > $date_reference)
						$date_reference = $available_date;

					if ($oos)
						$product_extra_time = ($product_extra_datas['out_stock'] > $product_extra_time ? $product_extra_datas['out_stock'] : $product_extra_time);
					else
						$product_extra_time = ($product_extra_datas['in_stock'] > $product_extra_time ? $product_extra_datas['in_stock'] : $product_extra_time);

					// Order general information
					$dates = $this->_getDatesOfDelivery($order->id_carrier, $oos, $date_reference, $product_extra_time, true);
					
					if (!isset($dates_delivery[$dates['delivery_date']['time_min']])) {
						$dates_delivery[$dates['delivery_date']['time_min']] = array(
							'date_min' => $dates['delivery_date']['date_min'],
							'time_min' => $dates['delivery_date']['time_min'],
							'date_max' => $dates['delivery_date']['date_max'],
							'time_max' => $dates['delivery_date']['time_max'],
							'shipping_date' => $dates['shipping_date'],
							'products' => array(),
						);
					}
					
					$dates_delivery[$dates['delivery_date']['time_min']]['products'][] = array(
						'product_datas' => $product,
						'date_min' => $dates['delivery_date']['date_min'],
						'time_min' => $dates['delivery_date']['time_min'],
						'date_max' => $dates['delivery_date']['date_max'],
						'time_max' => $dates['delivery_date']['time_max'],
						'shipping_date' => $dates['shipping_date'],
					);
				}

				ksort($dates_delivery);

				$this->smarty->assign(array(
					'order_dates' => $dates_delivery,
					'display_asap_option_detail' => true //Configuration::get('ADOD_ALLOW_ASAP_OPTION_DETAIL')
				));

				return $this->display(__FILE__, 'admin_asap.tpl');
			}
			else
			{				
				foreach ($order->getProducts() as $product)
				{
					$oos = false; // For out of stock management
				
					if (Configuration::get('PS_STOCK_MANAGEMENT'))
						if ($product['product_quantity'] > $product['product_quantity_in_stock'])
							$oos = true;

					if (Configuration::get('ADOD_FORCE_STOCK'))
						$oos = false;
				
					$product_extra_datas = $this->_getProductExtraTime($product['product_id'], ($product['product_attribute_id'] ? (int)$product['product_attribute_id'] : null));
					$available_date = $this->getAvailableDate($product['product_id'], ($product['product_attribute_id'] ? (int)$product['product_attribute_id'] : null), (int)$this->context->shop->id);

					if ($available_date > $date_reference)
						$date_reference = $available_date;

					if ($oos)
						$product_extra_time = ($product_extra_datas['out_stock'] > $product_extra_time ? $product_extra_datas['out_stock'] : $product_extra_time);
					else
						$product_extra_time = ($product_extra_datas['in_stock'] > $product_extra_time ? $product_extra_datas['in_stock'] : $product_extra_time);
				}

				// Order general information
				$dates = $this->_getDatesOfDelivery($order->id_carrier, $oos, $date_reference, $product_extra_time, true);

				$this->smarty->assign('order_dates', $dates);

				return $this->display(__FILE__, 'admin.tpl');
			}
		}
	}

 

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
×
×
  • Create New...