/** * Set cached content * * @param string $content Content * * @return void */ protected function setCachedContent($content) { \XLite\Core\WidgetCache::getInstance()->set($this->getCacheParameters(), $content, $this->getCacheTTL()); }
/** * Call controller action * * @return void */ protected function callAction() { parent::callAction(); if ($this->isLogged()) { \XLite::getInstance()->updateModuleRegistry(); \XLite\Core\WidgetCache::getInstance()->deleteAll(); } }
/** * Checkout * TODO: to revise * * @return void */ protected function doActionCheckout() { $itemsBeforeUpdate = $this->getCart()->getItemsFingerprint(); $this->updateCart(); $itemsAfterUpdate = $this->getCart()->getItemsFingerprint(); if ($itemsAfterUpdate !== $itemsBeforeUpdate || $this->get('absence_of_product') || $this->getCart()->isEmpty()) { // Cart is changed $this->set('absence_of_product', true); $this->redirect($this->buildURL('cart')); } elseif (!$this->checkCheckoutAction()) { // Check access $this->redirect($this->buildURL('checkout')); } else { $data = is_array(\XLite\Core\Request::getInstance()->payment) ? \XLite\Core\Request::getInstance()->payment : array(); $errors = array(); $firstOpenTransaction = $this->getCart()->getFirstOpenPaymentTransaction(); if ($firstOpenTransaction) { $errors = $firstOpenTransaction->getPaymentMethod()->getProcessor()->getInputErrors($data); } if ($errors) { foreach ($errors as $error) { \XLite\Core\TopMessage::addError($error); } $this->redirect($this->buildURL('checkout')); } else { $shippingMethod = \XLite\Core\Database::getRepo('XLite\\Model\\Shipping\\Method')->findOneBy(array('method_id' => $this->getCart()->getShippingId())); if ($shippingMethod) { $this->getCart()->setShippingMethodName($shippingMethod->getName()); } else { $this->getCart()->setShippingMethodName(null); } // Register 'Place order' event in the order history \XLite\Core\OrderHistory::getInstance()->registerPlaceOrder($this->getCart()->getOrderId()); // Register 'Order packaging' event in the order history \XLite\Core\OrderHistory::getInstance()->registerOrderPackaging($this->getCart()->getOrderId(), $this->getCart()->getModifier(\XLite\Model\Base\Surcharge::TYPE_SHIPPING, 'SHIPPING')); $this->getCart()->setPaymentStatus(\XLite\Model\Order\Status\Payment::STATUS_QUEUED); $this->getCart()->decreaseInventory(); // Clean widget cache (for products lists widgets) \XLite\Core\WidgetCache::getInstance()->deleteAll(); // Make order payment step $this->doPayment(); } } }
/** * Clean view cache * * @return void */ public function doActionCleanViewCache() { \XLite\Core\WidgetCache::getInstance()->deleteAll(); \XLite\Core\TopMessage::addInfo('Widgets cache has been cleaned'); }