It's hard to advise when you can't see the whole example !!!
The part you put here is useless.
class myCustomCartClass { protected $module = false; protected $namef_class; private $context; public function __construct(Module $module = null) { $this->_namef_class = get_class($this); $this->module = $module; $this->context = Context::getContext(); } public static function cart() { $this->addToCart(); } public function addToCart() { $cart_id = Tools::getvalue('cart_id'); $cart = new Cart((int)$cart_id); $order_status = (int)Configuration::get('PS_OS_PAYMENT'); $order_total = $cart->getOrderTotal(true, Cart::BOTH); $this->module->validateOrder($cart->id, $order_status, $order_total, "Bankwire module", null, array(), null, false, $cart->secure_key); } } /* IN YOUR MODULE require_once(dirname(__FILE__).'/classes/myCustomCartClass.php'); $foo = new myCustomCartClass($this); $foo->cart(); */