Jump to content
thirty bees forum

Out standing module in Admin


AndyC

Recommended Posts

Hi

I was going though some tabs and my outstanding tab has a 500 page error ( Never really used it to be honest)

Anyway turned on debug mode and got this error message with line 175 in red

Is this a easy fix

Source file: controllers/admin/AdminOutstandingController.php

156:    /**
157:     * Print outstanding calculation
158:     *
159:     * @param int   $idInvoice
160:     * @param array $tr
161:     *
162:     * @return string
163:     * @throws PrestaShopException
164:     *
165:     * @since 1.0.0
166:     */
167:    public function printOutstandingCalculation($idInvoice, $tr)
168:    {
169:        $orderInvoice = new OrderInvoice($idInvoice);
170:        if (!Validate::isLoadedObject($orderInvoice)) {
171:            throw new PrestaShopException('object OrderInvoice cannot be loaded');
172:        }
173:        $order = new Order($orderInvoice->id_order);
174:        if (!Validate::isLoadedObject($order)) {
175:            throw new PrestaShopException('object Order cannot be loaded');
176:        }
177:        $customer = new Customer((int) $order->id_customer);
178:        if (!Validate::isLoadedObject($orderInvoice)) {
179:            throw new PrestaShopException('object Customer cannot be loaded');
180:        }
181:
182:        return '<b>'.Tools::displayPrice($customer->getOutstanding(), $this->context->currency).'</b>';
183:    }
184:
185:    /**
Link to comment
Share on other sites

Looking at code, it may happen in few cases:

  • OrderInvoice is not assigned properly to ID order (or rather order is not properly assigned to orderInvocie in database). Can be caused by a module or core itself
  • Order does not exist anymore - quite common if you use any kind of removeOrder module

In both cases, this OrderInvoice does not have properly assigned Order ID (Missing or wrong) which should not happen.

 

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