readCache(); if (!$cache->cacheStatus) { $popularProds = $db->select("SELECT I.name, I.productId , COUNT(I.productId) AS total FROM ".$glob['dbprefix']."CubeCart_order_inv AS O INNER JOIN ".$glob['dbprefix']."CubeCart_inventory AS I ON O.productId = I.productId WHERE I.disabled != '1' AND I.cat_id > 0 GROUP BY I.name DESC ORDER BY total DESC", $config['noPopularBoxItems']); $cache->writeCache($popularProds); } } else { ## we wont cache this as it changes too quickly $popularProds = $db->select("SELECT name, productId FROM ".$glob['dbprefix']."CubeCart_inventory WHERE cat_id > 0 AND disabled != '1' ORDER BY popularity DESC",$config['noPopularBoxItems']); } $box_content = new XTemplate("boxes".CC_DS."popularProducts.tpl"); $box_content->assign("LANG_POPULAR_PRODUCTS_TITLE", $lang['popularProducts']['popular_products']); if ($popularProds){ for ($i=0; $iassign("DATA",$popularProds[$i]); $box_content->parse("popular_products.li"); } } $box_content->parse("popular_products"); $box_content = $box_content->text("popular_products"); ?>