Jump to content

add field to order details prestashop 1.7


Recommended Posts

hello,

i'm trying to add a part of the value of the product_refernce in a new field of the order_detail database.

i create the new field in the database but i can't manage to add a value in the new field.

i modificated the OrderDetail.php file in the claases/order. but nothing happen. i tried to put only the 3 value on the field but nothing

-----------------here is a part of my overide

<?php
class OrderDetail extends OrderDetailCore {
//Nouveaux paramètres de classe
public $id_abo;
  protected function create(Order $order, Cart $cart, $product, $id_order_state, $id_order_invoice, $use_taxes = true, $id_warehouse = 0)
    {


        if ($use_taxes) {
            $this->tax_calculator = new TaxCalculator();
        }

        $this->id = null;
    $this->id_abo = '22'; // new field
---------------------------------------------------

 

thank you in advance

 

Link to comment
Share on other sites

  • 3 months later...

First to able to the Class control the field you need add it to the $definition not just like a public var

 

Second you can set the value before add the register on the database using the

 
public function add($autodate = true, $null_values = false){
 
$this->yourvar = 'anything';
 
return parent::add($autodate, $null_values);
 
}

 

 

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