Guest chris121 Posted November 29, 2011 Share Posted November 29, 2011 Hi, looking to try and calculate the total value of current in stock products, using cubecart 4 any info or help out there, seen some ideas for cube 3 versions but none for cube 4 any help out there for these thank you Ken Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 29, 2011 Share Posted November 29, 2011 Welcome chris121! Glad to see you made it tot he forums. If you could remind us here of where you saw the ideas for CC3, maybe we can make suggestions for CC4. After all, CC4 is mostly CC3 with a few popular requested add-ons. Mostly. Quote Link to comment Share on other sites More sharing options...
Guest chris121 Posted November 30, 2011 Share Posted November 30, 2011 Hi, was below saw the idea of total stock value from cubecart 3 etc Thanks Quote Link to comment Share on other sites More sharing options...
leeofaccy Posted December 1, 2011 Share Posted December 1, 2011 Hi Try this, it will give you the total value of all in-stock products. Open admin/sources/home/index.inc.php and find this code (around line 23) require($glob['adminFolder'].CC_DS.'includes'.CC_DS.'header.inc.php'); Add underneath... require($glob['adminFolder'].CC_DS.'includes'.CC_DS.'currencyVars.inc.php'); Just below you will see this... // no Products $query = 'SELECT count(`productId`) as noProducts FROM '.$glob['dbprefix'].'CubeCart_inventory'; $noProducts = $db->select($query); Add this below... // total product value $query = 'SELECT sum(`stock_level`*`price`) as totValue FROM '.$glob['dbprefix'].'CubeCart_inventory WHERE `stock_level` > 0'; $totValue = $db->select($query); Around line 243 find this... <tr> <td width="33%" class="tdText"><span class="tdText"><?php echo $lang['admin_common']['other_no_products'];?></span></td> <td width="50%" class="tdText"><?php echo number_format($noProducts[0]['noProducts']); ?></td> </tr> Add this under it... <tr> <td width="33%" class="tdText"><span class="tdText">Total value of in-stock products:</span></td> <td width="50%" class="tdText"><?php echo priceFormat($totValue[0]['totValue'],true); ?></td> </tr> This could be refined a little more if need be.... Lee Quote Link to comment Share on other sites More sharing options...
Guest chris121 Posted December 1, 2011 Share Posted December 1, 2011 Hi ok, thanks put that in, where should the "stock value" show up on the admin pages, any pointers to see as can't see anything obvious Quote Link to comment Share on other sites More sharing options...
Guest chris121 Posted December 1, 2011 Share Posted December 1, 2011 Hi Lee, ok we have the below done, tried to follow the format of the file and added in your lines , copied our file with the bits added to see if you think is written in correct. tried to look under View productions and do the search there but nothing new comes up in the search option boxes still 1st and 2nd one added $lang = getLang("admin".CC_DS."admin_misc.inc.php"); require($glob['adminFolder'].CC_DS."includes".CC_DS."header.inc.php"); require($glob['adminFolder'].CC_DS.'includes'.CC_DS.'currencyVars.inc.php'); // no Products $query = "SELECT count(productId) as noProducts FROM ".$glob['dbprefix']."CubeCart_inventory"; $noProducts = $db->select($query); // total product value $query = 'SELECT sum(`stock_level`*`price`) as totValue FROM '.$glob['dbprefix'].'CubeCart_inventory WHERE `stock_level` > 0'; $totValue = $db->select($query); // no Categories $query = sprintf("SELECT COUNT(S.cart_order_id) as noOrders FROM %1\$sCubeCart_order_sum AS S, %1\$sCubeCart_customer AS C WHERE C.customer_id = S.customer_id", $glob['dbprefix']); $noOrders = $db->select($query); 3rd one added below // no Products $query = "SELECT count(productId) as noProducts FROM ".$glob['dbprefix']."CubeCart_inventory"; $noProducts = $db->select($query); // total product value $query = 'SELECT sum(`stock_level`*`price`) as totValue FROM '.$glob['dbprefix'].'CubeCart_inventory WHERE `stock_level` > 0'; $totValue = $db->select($query); // no Categories $query = sprintf("SELECT COUNT(S.cart_order_id) as noOrders FROM %1\$sCubeCart_order_sum AS S, %1\$sCubeCart_customer AS C WHERE C.customer_id = S.customer_id", $glob['dbprefix']); $noOrders = $db->select($query); Quote Link to comment Share on other sites More sharing options...
leeofaccy Posted December 1, 2011 Share Posted December 1, 2011 If you click Admin Home in the menu, it should be in the 'Inventory Summary' box, under 'Number of products'. Lee Quote Link to comment Share on other sites More sharing options...
Guest chris121 Posted December 1, 2011 Share Posted December 1, 2011 Hi yep it is, many thanks, that helps alot just quick thing, we currently use the kitablue format for the site, if we change t the other default ones, the images etc are not correct and overlay the colums etc, is like the colums and layout gets shrunk to standard size and doesn't adjust is there any codes to make the other skins on the site to work the same as the kitablue, think others have asked this before Quote Link to comment Share on other sites More sharing options...
Guest Posted January 5, 2012 Share Posted January 5, 2012 I won't explain how, as others have said it needs to be done with caution, but I export the "Inventory" table through PHP-MyAdmin and read it into Excel, then you can do what you want with the data... Category Summaries, Pivot Tables, Conditional Formatting, Management Reports, etc, etc... Obviously needs to be done carefully, but if you're happy hacking program code around, you're probably competent enough to suck some data out of the database... Dave Bits4Vits 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.