Hacktor Posted June 26, 2011 Share Posted June 26, 2011 Hi, I've made a cron.php with these settings. It's my first programming but never to old to learn :-)I call this cron.php with:http://www.webshopdesigners.nl/webshopdesigners_demo/modules/statshome/cron.php?secure_key=password <?php $secureKey = "password"; include(dirname(__FILE__).'/../../config/config.inc.php'); include(dirname(__FILE__).'/../../init.php'); include(dirname(__FILE__).'/statshome.php'); if (isset($_GET['secure_key'])) { if (empty($secureKey) OR $secureKey !== $_GET['secure_key']) die ('statshome not updated'); if (!empty($secureKey) AND $secureKey !== $_GET['secure_key']) die ('statshome not updated'); if (!empty($secureKey) AND $secureKey === $_GET['secure_key']) { $statshome = new StatsHome(); $statshome->cronTask(); } } ?> The cron.php calls the statshome.php: public function cronTask($params) { global $cookie; /* Email generation */ $subject = $this->l('Statshome'); /* Email sending */ $templateVars = array( '{verkocht}' => Tools::displayPrice($results['total_sales'], $currency), '{total_registrations}' => intval($results['total_registrations']), '{total_orders}' => intval(Tools::getValue('total_orders')), '{total_viewed}' => intval(Tools::getValue('total_viewed')), '{total_carts}' => intval(Tools::getValue('total_carts')), '{total_visitors}' => intval(Tools::getValue('total_visitors')) ); $iso = Language::getIsoById(intval($cookie->id_lang)); if (!Mail::Send(intval(Configuration::get('PS_LANG_DEFAULT')), 'guestbook', $subject, $templateVars, Configuration::get('PS_SHOP_EMAIL'), NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/')) $error = $this->l('Er is een fout opgetreden, probeer het nog eens!'); echo $this->l('Cron mail statshome succes'); } public function hookBackOfficeHome($params) { global $cookie; $this->_postProcess(); $currency = Currency::getCurrency(intval(Configuration::get('PS_CURRENCY_DEFAULT'))); $results = $this->getResults(); $employee = new Employee(intval($cookie->id_employee)); $id_tab_stats = Tab::getIdFromClassName('AdminStats'); $access = Profile::getProfileAccess($employee->id_profile, $id_tab_stats); if (!$access['view']) return ''; $this->_html = ' '.Tools::displayPrice($results['total_sales'], $currency).' '.$this->l('Verkocht').' '.intval($results['total_registrations']).' etc.... Link to comment Share on other sites More sharing options...
Hacktor Posted June 27, 2011 Author Share Posted June 27, 2011 Mmmm great support on this forum? Is my question so difficult? Link to comment Share on other sites More sharing options...
Hacktor Posted July 2, 2011 Author Share Posted July 2, 2011 Is there nobody who can/will help me with this little problem? :-/ 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