public function init() { parent::init(); if (Module::isEnabled('aimultidimensions')) { if (Tools::getIsset('add') && $this->context->cart->id) { require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'aimultidimensions.php'; require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'config.php'; require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'functions' . $GLOBALS['aimd_config_suffix'] . '.php'; $add = 1; $idProduct = (int) Tools::getValue('id_product', NULL); if (checkLink($idProduct)) { $idProductAttribute = (int) Tools::getValue('id_product_attribute', Tools::getValue('ipa')); $customizationId = (int) Tools::getValue('id_customization', 0); $qty = (int) abs(Tools::getValue('qty', 1)); if ($add && $qty >= 0 && getProducts($idProduct)) { $quantity = (int) Db::getInstance()->getValue('SELECT quantity FROM ' . _DB_PREFIX_ . 'cart_product WHERE id_cart = ' . $this->context->cart->id . ' AND id_product = ' . $idProduct . ' AND ' . 'id_product_attribute = ' . $idProductAttribute); if (Tools::getValue('op', 'up') == 'up') { $quantity += (int) $qty; } else { $quantity -= (int) $qty; } $cookie = $this->context->cookie; $cart = $this->context->cart; include_once 'modules/aimultidimensions/includes/cart.php'; Product::flushPriceCache(); } } } } }
/** * Flush local cache */ protected function flushCache() { AphCustomPrice::$_customPriceCache = array(); AphCustomPrice::$_filterOutCache = array(); AphCustomPrice::$_cache_priorities = array(); AphCustomPrice::$_no_custom_values = array(); Product::flushPriceCache(); }
/** * Flush local cache */ protected function flushCache() { SpecificPrice::$_specificPriceCache = array(); SpecificPrice::$_filterOutCache = array(); SpecificPrice::$_cache_priorities = array(); SpecificPrice::$_no_specific_values = array(); Product::flushPriceCache(); }
public function delete() { if (parent::delete()) { // Flush cache when we deletind a new specific price self::$_specificPriceCache = array(); Product::flushPriceCache(); // Refresh cache of feature detachable Configuration::updateGlobalValue('PS_SPECIFIC_PRICE_FEATURE_ACTIVE', SpecificPrice::isCurrentlyUsed($this->def['table'])); return true; } return false; }
/** * Preparing hidden form with payment data before sending it to Dotpay */ public function initContent() { parent::initContent(); $this->display_column_left = false; $this->display_header = false; $this->display_footer = false; $cartId = 0; if (Tools::getValue('order_id') == false) { $cartId = $this->context->cart->id; $exAmount = $this->api->getExtrachargeAmount(true); if ($exAmount > 0 && !$this->isExVPinCart()) { $productId = $this->config->getDotpayExchVPid(); if ($productId != 0) { $product = new Product($productId, true); $product->price = $exAmount; $product->save(); $product->flushPriceCache(); $this->context->cart->updateQty(1, $product->id); $this->context->cart->update(); $this->context->cart->getPackageList(true); } } $discAmount = $this->api->getDiscountAmount(); if ($discAmount > 0) { $discount = new CartRule($this->config->getDotpayDiscountId()); $discount->reduction_amount = $this->api->getDiscountAmount(); $discount->reduction_currency = $this->context->cart->id_currency; $discount->reduction_tax = 1; $discount->update(); $this->context->cart->addCartRule($discount->id); $this->context->cart->update(); $this->context->cart->getPackageList(true); } $result = $this->module->validateOrder($this->context->cart->id, (int) $this->config->getDotpayNewStatusId(), $this->getDotAmount(), $this->module->displayName, NULL, array(), NULL, false, $this->customer->secure_key); } else { $this->context->cart = Cart::getCartByOrderId(Tools::getValue('order_id')); $this->initPersonalData(); $cartId = $this->context->cart->id; } $this->api->onPrepareAction(Tools::getValue('dotpay_type'), array('order' => Order::getOrderByCartId($cartId), 'customer' => $this->context->customer->id)); $sa = new DotpaySellerApi($this->config->getDotpaySellerApiUrl()); if ($this->config->isDotpayDispInstruction() && $this->config->isApiConfigOk() && $this->api->isChannelInGroup(Tools::getValue('channel'), array(DotpayApi::cashGroup, DotpayApi::transfersGroup)) && $sa->isAccountRight($this->config->getDotpayApiUsername(), $this->config->getDotpayApiPassword(), $this->config->getDotpayApiVersion())) { $this->context->cookie->dotpay_channel = Tools::getValue('channel'); Tools::redirect($this->context->link->getModuleLink($this->module->name, 'confirm', array('order_id' => Order::getOrderByCartId($cartId)))); die; } $this->context->smarty->assign(array('hiddenForm' => $this->api->getHiddenForm())); $cookie = new Cookie('lastOrder'); $cookie->orderId = Order::getOrderByCartId($cartId); $cookie->write(); $this->setTemplate("preparing.tpl"); }
public static function flushCache() { parent::flushPriceCache(); parent::$_frontFeaturesCache = array(); parent::$producPropertiesCache = array(); }