evolution.x Posted September 6, 2011 Share Posted September 6, 2011 Hi, As the title states, I would like to know if it is possible to show 2 lots of statshome on the back office home page from 2 prestashop installs? I have 2 stores: www.store1.myshop.com www.store2.myshop.com I would like to show the condensed stats for both stores in different blocks on both the back office home pages? Please see the attached picture. Any help or ideas on this would be great! Link to comment Share on other sites More sharing options...
evolution.x Posted September 7, 2011 Author Share Posted September 7, 2011 Anybody have any ideas on this? Link to comment Share on other sites More sharing options...
evolution.x Posted September 9, 2011 Author Share Posted September 9, 2011 The code I think that needs to me changed/added is: private function getResults() { $yearFrom = intval(Configuration::get('STATSHOME_YEAR_FROM')); $monthFrom = intval(Configuration::get('STATSHOME_MONTH_FROM')); $dayFrom = intval(Configuration::get('STATSHOME_DAY_FROM')); $yearTo = intval(Configuration::get('STATSHOME_YEAR_TO')); $monthTo = intval(Configuration::get('STATSHOME_MONTH_TO')); $dayTo = intval(Configuration::get('STATSHOME_DAY_TO')); if (!$yearFrom) Configuration::updateValue('STATSHOME_YEAR_FROM', $yearFrom = date('Y')); if (!$yearFrom) Configuration::updateValue('STATSHOME_YEAR_TO', $yearTo = date('Y')); $monthFrom = $monthFrom ? ((strlen($monthFrom) == 1 ? '0' : '').$monthFrom) : '01'; $dayFrom = $dayFrom ? ((strlen($dayFrom) == 1 ? '0' : '').$dayFrom) : '01'; $monthTo = $monthTo ? ((strlen($monthTo) == 1 ? '0' : '').$monthTo) : '12'; $dayTo = $dayTo ? ((strlen($dayTo) == 1 ? '0' : '').$dayTo) : '31'; $result = Db::getInstance()->getRow(' SELECT SUM(o.`total_paid_real` / c.conversion_rate) as total_sales, COUNT(*) as total_orders FROM `'._DB_PREFIX_.'orders` o LEFT JOIN `'._DB_PREFIX_.'currency` c ON o.id_currency = c.id_currency WHERE o.valid = 1 AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween()); $result2 = Db::getInstance()->getRow(' SELECT COUNT(`id_customer`) AS total_registrations FROM `'._DB_PREFIX_.'customer` c WHERE c.`date_add` BETWEEN '.ModuleGraph::getDateBetween()); $result3 = Db::getInstance()->getRow(' SELECT SUM(pv.`counter`) AS total_viewed FROM `'._DB_PREFIX_.'page_viewed` pv LEFT JOIN `'._DB_PREFIX_.'date_range` dr ON pv.`id_date_range` = dr.`id_date_range` LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page` LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type` WHERE pt.`name` = \'product.php\' AND dr.`time_start` BETWEEN '.ModuleGraph::getDateBetween().' AND dr.`time_end` BETWEEN '.ModuleGraph::getDateBetween()); return array_merge($result, array_merge($result2, $result3)); } I need this code to connect to another database on the same server to get stats from my 2nd prestashop install? Any help would be appreciated! Link to comment Share on other sites More sharing options...
evolution.x Posted September 13, 2011 Author Share Posted September 13, 2011 Is anyone able to offer some advise on this? Link to comment Share on other sites More sharing options...
Mike Kranzler Posted September 13, 2011 Share Posted September 13, 2011 Hi evolution.x, This is something that we do not currently offer, but you should keep an eye out for this in next month's release of 1.5 with multistore. -Mike Link to comment Share on other sites More sharing options...
evolution.x Posted September 13, 2011 Author Share Posted September 13, 2011 I will have a look at the 1.5 release but to be honest my website contains too many core changes to be able to simply update to the newer 1.5 I would prefer to stay on my current version with the set up i have. Is there no possible way to connect to another database just the once to fetch the stats? I found something that says i could use this kind of code but cannot seem to implement it? SELECT * FROM OPENDATASOURCE( 'SQLOLEDB', 'Data Source=ServerName;User ID=MyUID;Password=MyPass' ).myprefix_orders Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now