public function view() { $codeerror = false; $codesuccess = false; if ($this->isPost()) { if ($this->post('action') == 'update') { $data = $this->post(); $result = StoreCart::update($data); $added = $result['added']; $returndata = array('success' => true, 'quantity' => (int) $data['pQty'], 'action' => 'update', 'added' => $added); } if ($this->post('action') == 'clear') { StoreCart::clear(); $returndata = array('success' => true, 'action' => 'clear'); } if ($this->post('action') == 'remove') { $data = $this->post(); $result = StoreCart::remove($data['instance']); $returndata = array('success' => true, 'action' => 'remove'); } } $this->set('actiondata', $returndata); $this->set('cart', StoreCart::getCart()); $this->set('total', StoreCalculator::getSubTotal()); $this->requireAsset('javascript', 'jquery'); $js = \Concrete\Package\VividStore\Controller::returnHeaderJS(); $this->addFooterItem($js); $this->requireAsset('javascript', 'vivid-store'); $this->requireAsset('css', 'vivid-store'); }
public function getCartModal() { $cart = StoreCart::getCart(); $total = StoreCalculator::getSubTotal(); if (Filesystem::exists(DIR_BASE . '/application/elements/cart_modal.php')) { View::element('cart_modal', array('cart' => $cart, 'total' => $total, 'actiondata' => $this->post())); } else { View::element('cart_modal', array('cart' => $cart, 'total' => $total, 'actiondata' => $this->post()), 'vivid_store'); } }
public function view() { $this->set("itemCount", StoreCart::getTotalItemsInCart()); $this->set("total", StorePrice::format(StoreCalculator::getSubTotal())); $js = \Concrete\Package\VividStore\Controller::returnHeaderJS(); $this->requireAsset('javascript', 'jquery'); $this->addFooterItem($js); $this->requireAsset('javascript', 'vivid-store'); $this->requireAsset('css', 'vivid-store'); }
public function view() { $codeerror = false; $codesuccess = false; if ($this->isPost()) { if ($this->post('action') == 'code' && $this->post('code')) { $codesuccess = StoreCart::storeCode($this->post('code')); $codeerror = !$codesuccess; } if ($this->post('action') == 'update') { $data = $this->post(); $result = StoreCart::update($data); $added = $result['added']; $returndata = array('success' => true, 'quantity' => (int) $data['pQty'], 'action' => 'update', 'added' => $added); } if ($this->post('action') == 'clear') { StoreCart::clear(); $returndata = array('success' => true, 'action' => 'clear'); } if ($this->post('action') == 'remove') { $data = $this->post(); $result = StoreCart::remove($data['instance']); $returndata = array('success' => true, 'action' => 'remove'); } } $this->set('actiondata', $returndata); $this->set('codeerror', $codeerror); $this->set('codesuccess', $codesuccess); $this->set('cart', StoreCart::getCart()); $this->set('discounts', StoreCart::getDiscounts()); $this->set('total', StoreCalculator::getSubTotal()); $this->addHeaderItem("\n <script type=\"text/javascript\">\n var PRODUCTMODAL = '" . View::url('/productmodal') . "';\n var CARTURL = '" . View::url('/cart') . "';\n var CHECKOUTURL = '" . View::url('/checkout') . "';\n </script>\n "); $this->requireAsset('javascript', 'vivid-store'); $this->requireAsset('css', 'vivid-store'); $discountsWithCodesExist = StoreDiscountRule::discountsWithCodesExist(); $this->set("discountsWithCodesExist", $discountsWithCodesExist); }
public function isWithinRange() { $subtotal = StoreCalculator::getSubTotal(); $max = $this->getMaximumAmount(); if ($max != 0) { if ($subtotal >= $this->getMinimumAmount() && $subtotal <= $this->getMaximumAmount()) { return true; } else { return false; } } elseif ($subtotal >= $this->getMinimumAmount()) { return true; } else { return false; } }
public function getSubTotal() { echo StorePrice::format(StoreCalculator::getSubTotal()); }
public function view() { $this->set("itemCount", StoreCart::getTotalItemsInCart()); $this->set("total", StorePrice::format(StoreCalculator::getSubTotal())); }