Page 1 of 1

Where is $order->product created?

Posted: Mon Apr 08, 2024 3:02 pm
by bonbec
For a shipping module, the dimensions of a product (length, width and height) must be used to determine the cardboard box for shipping.
I created the products_length, products_width and products_height fields in the products table.
I found that you can use $order->products in the shipping module, this gets information from the products table, but it doesn't give me products_length, products_width and products_height.
I can't seem to find in the files how and where this information is found. I think that would be what I need to move forward.
Unless there is another way that I haven't thought of...
Thanks in advance.

Re: Where is $order->product created?

Posted: Mon Apr 08, 2024 9:46 pm
by ecartz
https://github.com/CE-PhoenixCart/Phoen ... er.php#L33

That is the line with the hook to add columns to be copied from the cart to the order.

Code: Select all

class hook_shop_siteWide_dimensions {

  public function listen_cartOrderProductColumns($parameters) {
    $parameters['column_keys']['length'] = 'length';
    $parameters['column_keys']['width'] = 'width';
    $parameters['column_keys']['height'] = 'height';
  }

}

Re: Where is $order->product created?

Posted: Tue Apr 09, 2024 12:17 pm
by bonbec
Thank you very much :D