public function applyPromotion($code, $auto = false) { $code = strtoupper($code); $promotion = new Cart66Promotion(); if ($promotion->validateCustomerPromotion($code)) { $this->clearPromotion(); Cart66Session::set('Cart66Promotion', $promotion); Cart66Session::set('Cart66PromotionCode', $code); } else { $this->clearPromotion(); if ($auto == false) { Cart66Session::set('Cart66PromotionErrors', $promotion->getErrors()); } } }