Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static function addOffersMobile(&$catalog, $lang)
- {
- $offersModel = new Lmc_Core_Model_Offers_Model();
- foreach($catalog as $n => $val) {
- $catalog[$n]['offers'] = $offersModel->getOffersForProducts(array(array('ProductId' => $val['ProductId'])), array('Site' => $lang))->toArray();
- }
- }
- /**
- * Get all products for a given category id
- *
- * @param string $token the session token
- * @param string $categoryId the category id (as returned by getMobileLensCategories)
- * @param string $lang [optional] the language
- * @return Lmc_Ws_Response
- */
- public function getLensByCategory($token, $categoryId, $lang = null)
- {
- $response = new Lmc_Ws_Response(__METHOD__);
- $catalog = new Lmc_Ws_Catalog();
- try {
- $this->_session->load($token);
- $lang = $this->getLangIfInvalid($lang);
- $response->status = true;
- $response->data->categories = $catalog->getLensByCategory($categoryId, $lang);
- self::addOffersMobile($response->data->categories, $lang);
- } catch (Exception $e) {
- $response->error = true;
- $response->status = false;
- $response->errorMessage = $e->getMessage();
- $response->errorCode = $e->getCode();
- }
- return $this->addDebugAndReturnResponse($response);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement