Jump to content

Delivery Slip Bulk order of PDF


Henrik41

Recommended Posts

When I bulk print my delivery slips via 

  Order >> Delivery Slips >> Print PDF (from date to date)

  My Delivery slips prints by delivery number and includes delivery slips out of the date range requested!

  Is there a way to print the delivery slip by the date on the delivery slip itself???

   I understand that this date changes depending on the status but still I want them organise by date written on the delivery slip.

 

Thanks

 

Link to comment
Share on other sites

I will answer my own question:

I changed the core so that the delivery slip generator get a list of slips in date order

in OrderInvoice.php
was:

 public static function getByDeliveryDateInterval($date_from, $date_to)
    {
        $order_invoice_list = Db::getInstance()->executeS('
            SELECT oi.*
            FROM `' . _DB_PREFIX_ . 'order_invoice` oi
            LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.`id_order` = oi.`id_order`)
            WHERE DATE_ADD(oi.delivery_date, INTERVAL -1 DAY) <= \'' . pSQL($date_to) . '\'
            AND oi.delivery_date >= \'' . pSQL($date_from) . '\'
            ' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
            ORDER BY oi.delivery_date ASC
        ');

        return ObjectModel::hydrateCollection('OrderInvoice', $order_invoice_list);
    }

becomes:

public static function getByDeliveryDateInterval($date_from, $date_to)
    {
        $order_invoice_list = Db::getInstance()->executeS('
        SELECT oi.*
        FROM `' . _DB_PREFIX_ . 'order_invoice` oi
        LEFT JOIN `' . _DB_PREFIX_ . 'orders` o ON (o.`id_order` = oi.`id_order`)
        WHERE DATE_ADD(oi.date_add, INTERVAL -1 DAY) <= \'' . pSQL($date_to) . '\'
        AND oi.date_add >= \'' . pSQL($date_from) . '\'
        ' . Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o') . '
        AND oi.delivery_number > 0
        ORDER BY oi.date_add ASC, oi.delivery_date ASC
        ');

        return ObjectModel::hydrateCollection('OrderInvoice', $order_invoice_list);
    }

Ultimately never a good idea to change the core. Could have done a module but I had a time constraint.

 

 

Edited by Henrik41 (see edit history)
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...