Guest nacidoporfe Posted September 21, 2005 Share Posted September 21, 2005 Does abybody knows how to reset statistics? Please help me. Thanks, Hector Quote Link to comment Share on other sites More sharing options...
Guest hartmurmur Posted September 21, 2005 Share Posted September 21, 2005 Go into phpMyAdmin or from the mysql command line and enter the following (back up your database first. I will not be responsible for mistakes or typos): For product views stats: UPDATE CubeCart_inventory SET popularity = 0 You will then need to view at least one product or else the admin page will throw some errors about not being able to divide by 0. Be aware that these stats are kind of bogus. (Example: A customer may refresh the product page 100 times. Each page view/refresh gets a click.) Check out your web hosts' stats package for better info (Urchin, Webalizer, etc.). You may want to change product popularity to count the number or orders placed for the item, not how many times it was viewed. For search terms: DELETE FROM CubeCart_search Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted April 21, 2006 Share Posted April 21, 2006 I ran across this post (below) while searching for a way to reset my statistics. This post however, addresses my problem more closely to what I want. Unfortunately, I can't figure out how to change my product popularity to count number of orders rather than views - how do I change this? Thanks, Mark <snip> Check out your web hosts' stats package for better info (Urchin, Webalizer, etc.). You may want to change product popularity to count the number or orders placed for the item, not how many times it was viewed. Quote Link to comment Share on other sites More sharing options...
convict Posted April 21, 2006 Share Posted April 21, 2006 I see you want to replace product popularity box with best order placed products Only you need is replace the SQL query in includes/boxes/popularProducts.inc.php with: "SELECT ".$glob['dbprefix']."CubeCart_inventory.productId, ".$glob['dbprefix']."CubeCart_inventory.productCode, ".$glob['dbprefix']."CubeCart_inventory.name, sum(".$glob['dbprefix']."CubeCart_order_inv.quantity) as salesCount FROM ".$glob['dbprefix']."CubeCart_inventory LEFT JOIN ".$glob['dbprefix']."CubeCart_order_inv ON ".$glob['dbprefix']."CubeCart_inventory.productId = ".$glob['dbprefix']."CubeCart_order_inv.productId LEFT JOIN ".$glob['dbprefix']."CubeCart_order_sum ON ".$glob['dbprefix']."CubeCart_order_inv.cart_order_id = ".$glob['dbprefix']."CubeCart_order_sum.cart_order_id " GROUP BY productId ORDER BY salesCount DESC LIMIT 10"; Query result is what you would like PS: i have made just copy & paste and WHERE conditon deletion from ..... (advertisment is not allowed) LOL Quote Link to comment Share on other sites More sharing options...
Guest Posted April 21, 2006 Share Posted April 21, 2006 I tried using your SQL select statement and received this error: Parse error: parse error, unexpected T_STRING in /home/powerkey/public_html/includes/boxes/popularProducts.inc.php on line 37 I tried several variations, but kept getting the same error message. Could you please post a replacement line? Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted April 22, 2006 Share Posted April 22, 2006 Ouch - I just got the same error message... Is there something else I should do besides replace the query part? Thanks, Mark Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted April 22, 2006 Share Posted April 22, 2006 Okay, just making sure that I did this right - I replaced the section in the code (labeled between the REPLACE FROM HERE..... to TO HERE..... with your code, as shown above: <?php /* +-------------------------------------------------------------------------- | CubeCart v3.0.8 | ======================================== | by Alistair Brookbanks | CubeCart is a Trade Mark of Devellion Limited | Copyright Devellion Limited 2005 - 2006. All rights reserved. | Devellion Limited, | 22 Thomas Heskin Court, | Station Road, | Bishops Stortford, | HERTFORDSHIRE. | CM23 3EE | UNITED KINGDOM | http://www.devellion.com | UK Private Limited Company No. 5323904 | ======================================== | Web: http://www.cubecart.com | Date: Monday, 23rd January 2006 | Email: info (at) cubecart (dot) com | License Type: CubeCart is NOT Open Source Software and Limitations Apply | Licence Info: http://www.cubecart.com/site/faq/license.php +-------------------------------------------------------------------------- | popularProducts.inc.php | ======================================== | Display the most Popular Products +-------------------------------------------------------------------------- */ if (ereg(".inc.php",$HTTP_SERVER_VARS['PHP_SELF'])) { echo "<html>\r\n<head>\r\n<title>Forbidden 403</title>\r\n</head>\r\n<body><h3>Forbidden 403</h3>\r\nThe document you are requesting is forbidden.\r\n</body>\r\n</html>"; exit; } // query database REPLACE FROM HERE..... $popularProds = $db->select("SELECT name, image, productId FROM ".$glob['dbprefix']."CubeCart_inventory ORDER BY popularity DESC",$config['noPopularBoxItems']); $box_content = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/boxes/popularProducts.tpl"); $box_content->assign("LANG_POPULAR_PRODUCTS_TITLE",$lang['front']['boxes']['popular_products']); if($popularProds == TRUE){ // start loop for ($i=0; $i<count($popularProds); $i++){ if(($val = prodAltLang($popularProds[$i]['productId'])) == TRUE){ $popularProds[$i]['name'] = $val['name']; } $popularProds[$i]['name'] = validHTML($popularProds[$i]['name']); TO HERE..... //MOD Popular Product Images - START if(file_exists($GLOBALS['rootDir']."/images/uploads/thumbs/thumb_".$popularProds[$i]['image'])){ $box_content->assign("PROD_IMG_SRC",$GLOBALS['rootRel']."images/uploads/thumbs/thumb_".$popularProds[$i]['image']); } else { $box_content->assign("PROD_IMG_SRC",$GLOBALS['rootRel']."skins/".$config['skinDir']."/styleImages/thumb_nophoto.gif"); } //MOD Popular Product Images - END $box_content->assign("DATA",$popularProds[$i]); $box_content->parse("popular_products.li"); } // end loop } $box_content->parse("popular_products"); $box_content = $box_content->text("popular_products"); ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted April 22, 2006 Share Posted April 22, 2006 I believe the new SQL statement would simply replace the one in this line: $popularProds = $db->select("SELECT name, image, productId FROM ".$glob['dbprefix']."CubeCart_inventory ORDER BY popularity DESC",$config['noPopularBoxItems']); making it something like: $popularProds = $db->select("SELECT ".$glob['dbprefix']."CubeCart_inventory.productId, ".$glob['dbprefix']."CubeCart_inventory.productCode, ".$glob['dbprefix']."CubeCart_inventory.name, sum(".$glob['dbprefix']."CubeCart_order_inv.quantity) as salesCount FROM ".$glob['dbprefix']."CubeCart_inventory LEFT JOIN ".$glob['dbprefix']."CubeCart_order_inv ON ".$glob['dbprefix']."CubeCart_inventory.productId = ".$glob['dbprefix']."CubeCart_order_inv.productId LEFT JOIN ".$glob['dbprefix']."CubeCart_order_sum ON ".$glob['dbprefix']."CubeCart_order_inv.cart_order_id = ".$glob['dbprefix']."CubeCart_order_sum.cart_order_id " GROUP BY productId ORDER BY salesCount DESC LIMIT 10", $config['noPopularBoxItems']); At least that's the closest I could figure. Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted April 22, 2006 Share Posted April 22, 2006 Hmmm... Okay, I tried that and it still didn't work Any other ideas? Thanks, Mark Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted May 5, 2006 Share Posted May 5, 2006 Alan - did you ever figure this out? What's the trick? I've been pretty busy lately and haven't had time until today to revisit this question. Certainly not a burning question, but I would like to figure it out. My Scrolling Popular Products is showing a set of products that doesn't reflect what is really popular (in my mind) - what people are buying. I see one product in there that I've never even sold - not one! Oh well, if anybody can look at the code and figure out what we could be doing wrong, please advise. Many thanks! Mark Quote Link to comment Share on other sites More sharing options...
Guest Posted May 5, 2006 Share Posted May 5, 2006 Sorry, forgot about this thread after I found the one on the CubeCart.org forum. We did figure out what I did wrong and got it working. Here is the working SQL line: $popularProds = $db->select("SELECT ".$glob['dbprefix']."CubeCart_inventory.productId, ".$glob['dbprefix']."CubeCart_inventory.productCode, ".$glob['dbprefix']."CubeCart_inventory.name, sum(".$glob['dbprefix']."CubeCart_order_inv.quantity) as salesCount FROM ".$glob['dbprefix']."CubeCart_inventory LEFT JOIN ".$glob['dbprefix']."CubeCart_order_inv ON ".$glob['dbprefix']."CubeCart_inventory.productId = ".$glob['dbprefix']."CubeCart_order_inv.productId LEFT JOIN ".$glob['dbprefix']."CubeCart_order_sum ON ".$glob['dbprefix']."CubeCart_order_inv.cart_order_id = ".$glob['dbprefix']."CubeCart_order_sum.cart_order_id WHERE (".$glob['dbprefix']."CubeCart_order_sum.status = 2 OR ".$glob['dbprefix']."CubeCart_order_sum.status = 3) GROUP BY productId ORDER BY salesCount DESC LIMIT " . $config['noPopularBoxItems']); Quote Link to comment Share on other sites More sharing options...
convict Posted May 5, 2006 Share Posted May 5, 2006 Alan yes this is my best sellers SQL query, Best order placed prods: $popularProds = $db->select("SELECT ".$glob['dbprefix']."CubeCart_inventory.productId, ".$glob['dbprefix']."CubeCart_inventory.productCode, ".$glob['dbprefix']."CubeCart_inventory.name, sum(".$glob['dbprefix']."CubeCart_order_inv.quantity) as pCount FROM ".$glob['dbprefix']."CubeCart_inventory LEFT JOIN ".$glob['dbprefix']."CubeCart_order_inv ON ".$glob['dbprefix']."CubeCart_inventory.productId = ".$glob['dbprefix']."CubeCart_order_inv.productId GROUP BY productId ORDER BY pCount DESC LIMIT " . $config['noPopularBoxItems']); Never tested i guess it works. Quote Link to comment Share on other sites More sharing options...
Guest saturnnights Posted May 5, 2006 Share Posted May 5, 2006 Thanks! I'll see if I can get this working now Mark Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.