static function getInstance() { if (!self::$instance) { self::$instance = new myBasket(); } return self::$instance; }
public function executeRenderf2() { $this->curNode = $this->getRoute()->getObject(); $this->nodes = Doctrine::getTable('Structure')->createQuery('all')->select('sl.*')->from('Structure sl')->where('sl.parameter = ?', 'festival')->andWhere('sl.lang = ?', $this->getRoute()->getObject()->getLang())->setHydrationMode(Doctrine::HYDRATE_RECORD)->execute(); //echo '<pre>'; //print_r($this->nodes[14]); //echo '</pre>'; //$this->nodes = $this->getNodes(); $this->basket = myBasket::getInstance(); }
public function executeBasket() { $this->itemsInBasket = myBasket::getInstance()->isEmpty() ? false : myBasket::getInstance()->prepareDataForView(); $this->totalItems = myBasket::getInstance()->countItems(); $this->totalPrice = myBasket::getInstance()->getTotalPrice(); }
public function executeRestartOrder($request) { $this->setLayout(false); sfProjectConfiguration::getActive()->loadHelpers(array('I18N')); foreach (myBasket::getInstance()->getProducts() as $id => $qty) { myBasket::getInstance()->deleteProduct($id); } $order = Doctrine::getTable('ProductOrder')->find($request->getParameter('orderID')); $this->forward404Unless($this->getUser()->isMyOrder($order)); $deleted = array(); foreach ($order->OrederedItems as $item) { # check if product is still in DB if (!Doctrine::getTable('Product')->find($item['product_id'])) { $deleted[] = $item['name']; continue; } myBasket::getInstance()->addProduct($item['product_id'], $item['quanity']); } if ($deleted) { $this->getUser()->setFlash('basket.error', __('Products %1% are currently out of stock', array('%1%' => strtoupper(implode(', ', $deleted))))); } $this->redirect($this->getComponent('linker', 'basket', array())); }