public function findAction() { if ($value_id = $this->getRequest()->getParam('value_id') and $set_meal_id = $this->getRequest()->getParam('set_meal_id')) { $set_meal = new Catalog_Model_Product(); $set_meal->find($set_meal_id); $option_value = $this->getCurrentOptionValue(); $data = array(); if ($set_meal->getData("type") == "menu") { $data = array("name" => $set_meal->getName(), "conditions" => $set_meal->getConditions(), "description" => $set_meal->getDescription(), "price" => $set_meal->getPrice() > 0 ? $set_meal->getFormattedPrice() : null, "picture" => $set_meal->getPictureUrl(), "social_sharing_active" => $option_value->getSocialSharingIsActive()); } $this->_sendHtml($data); } }
public function findallAction() { if ($value_id = $this->getRequest()->getParam('value_id')) { $data = array("collection" => array()); $menu = new Catalog_Model_Product(); $offset = $this->getRequest()->getParam('offset', 0); $menus = $menu->findAll(array('value_id' => $value_id, 'type' => 'menu'), array(), array("offset" => $offset, "limit" => Catalog_Model_Product::DISPLAYED_PER_PAGE)); foreach ($menus as $menu) { switch ($this->getCurrentOptionValue()->getLayoutId()) { case 2: case 3: $data["collection"][] = array("title" => $menu->getName(), "subtitle" => $menu->getFormattedPrice(), "picture" => $menu->getThumbnailUrl(), "url" => $this->getPath("catalog/mobile_setmeal_view", array("value_id" => $value_id, "set_meal_id" => $menu->getId()))); break; case 1: default: $data["collection"][] = array("title" => $menu->getName(), "subtitle" => $menu->getConditions(), "picture" => $menu->getThumbnailUrl(), "url" => $this->getPath("catalog/mobile_setmeal_view", array("value_id" => $value_id, "set_meal_id" => $menu->getId()))); break; } } $data["page_title"] = $this->getCurrentOptionValue()->getTabbarName(); $data["displayed_per_page"] = Catalog_Model_Product::DISPLAYED_PER_PAGE; $this->_sendHtml($data); } }
public function findAction() { if ($value_id = $this->getRequest()->getParam('value_id') and $product_id = $this->getRequest()->getParam('product_id')) { $product = new Catalog_Model_Product(); $product->find($product_id); $option_value = $this->getCurrentOptionValue(); $data = array(); if ($product->getData("type") != "menu") { $format = array(); if ($product->getData("type") == "format") { foreach ($product->getType()->getOptions() as $option) { $format[] = array("id" => $option->getId(), "title" => $option->getTitle(), "price" => $option->getFormattedPrice()); } } $data = array("name" => $product->getName(), "conditions" => $product->getConditions(), "description" => $product->getDescription(), "price" => $product->getPrice() > 0 ? $product->getFormattedPrice() : null, "picture" => $product->getPictureUrl(), "formats" => $format, "social_sharing_active" => $option_value->getSocialSharingIsActive()); } $this->_sendHtml($data); } }