public function setUp() { parent::setUp(); BusinessRuleController::clearCache(); ActiveRecord::executeUpdate('DELETE FROM DeliveryZone'); ActiveRecord::executeUpdate('DELETE FROM Tax'); ActiveRecord::executeUpdate('DELETE FROM TaxRate'); ActiveRecord::executeUpdate('DELETE FROM DiscountCondition'); ActiveRecord::executeUpdate('DELETE FROM DiscountAction'); ActiveRecord::executeUpdate('DELETE FROM Currency'); $this->root = DiscountCondition::getRootNode(); $this->usd = ActiveRecordModel::getInstanceByIDIfExists('Currency', 'USD'); $this->usd->save(); $this->user = User::getNewInstance('discount.condition@test'); $this->user->save(); $this->order = CustomerOrder::getNewInstance($this->user); $this->order->currency->set($this->usd); $this->order->save(true); $this->product1 = Product::getNewInstance(Category::getRootNode()); $this->product1->isEnabled->set(true); $this->product1->setPrice('USD', 10); $this->product1->save(); $this->product2 = Product::getNewInstance(Category::getRootNode()); $this->product2->isEnabled->set(true); $this->product2->setPrice('USD', 20); $this->product2->save(); ActiveRecordModel::getApplication()->getConfig()->setRuntime('INVENTORY_TRACKING', 'DISABLE'); }
private function updateConditionRecordCount($increase = true) { BusinessRuleController::clearCache(); $update = new ARUpdateFilter(); $update->addModifier('recordCount', new ARExpressionHandle('recordCount' . ($increase ? '+' : '-') . '1')); $this->condition->get()->updateRecord($update); $this->condition->get()->reload(); }
public function setUp() { parent::setUp(); ActiveRecordModel::executeUpdate('DELETE FROM Tax'); ActiveRecordModel::executeUpdate('DELETE FROM TaxRate'); ActiveRecordModel::executeUpdate('DELETE FROM Currency'); ActiveRecordModel::executeUpdate('DELETE FROM DiscountCondition'); ActiveRecordModel::executeUpdate('DELETE FROM DiscountAction'); ActiveRecordModel::executeUpdate('DELETE FROM DeliveryZone'); ActiveRecordModel::executeUpdate('DELETE FROM ShippingService'); BusinessRuleController::clearCache(); $this->initOrder(); $this->config->setRuntime('DELIVERY_TAX', ''); }
public function save() { BusinessRuleController::clearCache(); return parent::save(); }
public function getDiscountActions($reload = false) { if ($reload) { BusinessRuleController::clearCache(); } if (!$this->orderedItems) { return array(); } $controller = new BusinessRuleController($this->getBusinessRuleContext()); return $controller->getActions(); }