protected function _getProducts($refresh = false, $id_product = false, $id_country = null) { $products = parent::getProducts($refresh, $id_product, $id_country); if (_PS_VERSION_ >= 1.6) { $params = Hook::exec('ppbsGetProducts', array('products' => $products), null, true); if (isset($params['productpricebysize']['products'])) { return $params['productpricebysize']['products']; } else { return $products; } } else { $params = Hook::exec('ppbsGetProducts', array('products' => $products), null); $params = Tools::jsonDecode($params, true); if (isset($params['products'])) { return $params['products']; } else { return $products; } } }
protected function getFormattedProducts($cartId) { $formattedProducts = array(); $link = new Link(); $cart = new CartCore($cartId); $products = $cart->getProducts(); $currencyId = (int) Configuration::get('PS_CURRENCY_DEFAULT'); foreach ($products as $product) { $formattedProducts[] = array('name' => $product['name'], 'description' => strip_tags($product['description_short']), 'thumbnail' => 'http://' . $link->getImageLink($product['link_rewrite'], $product['id_image'], 'home_default'), 'quantity' => $product['quantity'], 'price' => Tools::displayPrice($product['price_wt'], $currencyId)); } return $formattedProducts; }