Jump to content

How to override Carrier Class


giwrgos88

Recommended Posts

Hello, I'm trying to override the Carrier.php which exist in classes folder. What I did is that I made a copy of this class inside the override/classes and then I deleted all the functions that I dont want and I just keep only the one that I want. I did my modification on the class but it seems is not working. here is my class

 

class Carrier extends CarrierCore
{
/**
* getCarriers method filter
*/
const PS_CARRIERS_ONLY = 1;
const CARRIERS_MODULE = 2;
const CARRIERS_MODULE_NEED_RANGE = 3;
const PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE = 4;
const ALL_CARRIERS = 5;


const SHIPPING_METHOD_DEFAULT = 0;
const SHIPPING_METHOD_WEIGHT = 1;
const SHIPPING_METHOD_PRICE = 2;
const SHIPPING_METHOD_FREE = 3;


const SHIPPING_PRICE_EXCEPTION = 0;
const SHIPPING_WEIGHT_EXCEPTION = 1;
const SHIPPING_SIZE_EXCEPTION = 2;


const SORT_BY_PRICE = 0;
const SORT_BY_POSITION = 1;


const SORT_BY_ASC = 0;
const SORT_BY_DESC = 1;


/** @var int common id for carrier historization */
public $id_reference;


/** @var string Name */
public $name;


/** @var string URL with a '@' for */
public $url;


/** @var string Delay needed to deliver customer */
public $delay;


/** @var bool Carrier statuts */
public $active = true;


/** @var bool True if carrier has been deleted (staying in database as deleted) */
public $deleted = 0;


/** @var bool Active or not the shipping handling */
public $shipping_handling = true;


/** @var int Behavior taken for unknown range */
public $range_behavior;


/** @var bool Carrier module */
public $is_module;


/** @var bool Free carrier */
public $is_free = false;


/** @var int shipping behavior: by weight or by price */
public $shipping_method = 0;


/** @var bool Shipping external */
public $shipping_external = 0;


/** @var string Shipping external */
public $external_module_name = null;


/** @var bool Need Range */
public $need_range = 0;


/** @var int Position */
public $position;


/** @var int maximum package width managed by the transporter */
public $max_width;


/** @var int maximum package height managed by the transporter */
public $max_height;


/** @var int maximum package deep managed by the transporter */
public $max_depth;


/** @var int maximum package weight managed by the transporter */
public $max_weight;


/** @var int grade of the shipping delay (0 for longest, 9 for shortest) */
public $grade;


/**
* @see ObjectModel::$definition
*/


/**
* For a given {product, warehouse}, gets the carrier available
*
* @since 1.5.0
* @param Product $product The id of the product, or an array with at least the package size and weight
* @param         $id_warehouse
* @param int     $id_address_delivery
* @param int     $id_shop
* @param Cart    $cart
* @param array   &$error  contain an error message if an error occurs
* @return array
* @throws PrestaShopDatabaseException
*/
public static function getAvailableCarrierList(Product $product, $id_warehouse, $id_address_delivery = null, $id_shop = null, $cart = null, &$error = array())
{
print_r("hello");
}

What I'm doing wrong?

 

Link to comment
Share on other sites

  • 3 months later...

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