コード例 #1
0
ファイル: AView.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Set cached content
  *
  * @param string $content Content
  *
  * @return void
  */
 protected function setCachedContent($content)
 {
     \XLite\Core\WidgetCache::getInstance()->set($this->getCacheParameters(), $content, $this->getCacheTTL());
 }
コード例 #2
0
ファイル: AAdmin.php プロジェクト: kirkbauer2/kirkxc
 /**
  * Call controller action
  *
  * @return void
  */
 protected function callAction()
 {
     parent::callAction();
     if ($this->isLogged()) {
         \XLite::getInstance()->updateModuleRegistry();
         \XLite\Core\WidgetCache::getInstance()->deleteAll();
     }
 }
コード例 #3
0
ファイル: CheckoutAbstract.php プロジェクト: kewaunited/xcart
 /**
  * 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();
         }
     }
 }
コード例 #4
0
 /**
  * Clean view cache
  *
  * @return void
  */
 public function doActionCleanViewCache()
 {
     \XLite\Core\WidgetCache::getInstance()->deleteAll();
     \XLite\Core\TopMessage::addInfo('Widgets cache has been cleaned');
 }