Jump to content

[Solved] Delivery slip, reference number sort from high to low


Recommended Posts

Is it possible to sort the reference number in the delivery slip ?
I want to sort them from high to low, for example

40-001
40-002
41-010
45-101

and so on.

I know that i can edit the pdf.php but i don't know what to look for and how to change it.

Link to comment
Share on other sites

The PDF.php or pdf.php have nothing to do with it.

You have to edit the Order.php file
Around line 292


   public function getProductsDetail()
   {
       return Db::getInstance()->ExecuteS('
       SELECT *
       FROM `'._DB_PREFIX_.'order_detail` od
       WHERE od.`id_order` = '.intval($this->id));
   }


You have to add Order by product refrence and ASC of DESC

ASC:
40-001
40-002
41-010
45-101

DESC
45-101
41-010
40-002
40-001




    
public function getProductsDetail()
   {
       return Db::getInstance()->ExecuteS('
       SELECT *
       FROM `'._DB_PREFIX_.'order_detail` od
       WHERE od.`id_order` = '.intval($this->id).' ORDER BY od.`product_reference` ASC');
   }



If this helps, remember to edit the title with solved.

Link to comment
Share on other sites

  • 5 years later...

Well let's reopen this topic again ;-)

How can this be done in 1.6.1.1?

The mentioned line now looks like:

 

                if ($order_detail->product_quantity == 0)
                {
                        if (!$order_detail->delete())
                                return false;
                        if (count($this->getProductsDetail()) == 0)
                        {
                                $history = new OrderHistory();
                                $history->id_order = (int)$this->id;
                                $history->changeIdOrderState(Configuration::get('PS_OS_CANCELED'), $this);
                                if (!$history->addWithemail())
                                        return false;
                        }
                        return $this->update();
                }
                else
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...