function getProducts(&$categories) { foreach ($categories as &$cat) { $cat['products'] = ocshop::products($cat['id'], false); foreach ($cat['products'] as &$product) { $product['active'] = $product['product_id'] == ocshop::$pid; } getProducts($cat['children']); } }
public static function init($cid = null) { if (!$cid && isset(oc::$request->get['path'])) { //get current $parts = explode('_', (string) oc::$request->get['path']); $cid = (int) array_pop($parts); } if ($cid) { self::$cid = $cid; $category = self::category($cid); for (; $category['parent']; self::$level++) { $category = $category['parent']; } self::$rootcid = $category['category_id']; self::$root = $category; self::$tree = self::getCategoriesTree(self::$rootcid, self::$cid); tpl::set('catTree', self::$tree); } self::$pid = isset(oc::$request->get['product_id']) ? oc::$request->get['product_id'] : false; self::$page = isset(oc::$request->get['page']) ? oc::$request->get['page'] : 1; self::$limit = isset(oc::$request->get['limit']) ? oc::$request->get['limit'] : oc::$config->get('config_catalog_limit'); }
public function purchased() { $totals = array(); occheckout::cart_total($totals); $this->response->setOutput(json_encode(array('products' => ocshop::purchased(), 'totals' => $totals))); }
public function product() { $this->response->setOutput(json_encode(ocshop::product($_REQUEST['pid']))); }