Te dejo la siguiente clase, con esto puedes resolverlo:
class UnProdcarrito extends Module {
public function __construct() {
$this->name = 'oneproductcart';
$this->tab = 'front_office_features';
$this->version = '1.0';
$this->author = 'SJousse';
$this->need_instance = 0;
parent::__construct();
$this->displayName = $this->l('One Product Cart');
$this->description = $this->l('Keep only last product in cart.'); }
public function install() {
return (parent::install() && $this->registerHook('actionCartSave')); }
public function hookActionCartSave($params) { $cart = $params['cart'];
$last = $cart->getLastProduct(); $prods = $cart->getProducts();
foreach ($prods as $prod)
if ($prod['id_product'] != $last['id_product']) $cart->deleteProduct($prod['id_product']); } }