-
Posts
76 -
Joined
-
Last visited
Elaine Leung's Achievements
-
Error 500 , version 1.6.1.2
Elaine Leung replied to Elaine Leung's topic in Configuring and using PrestaShop
Thank you Xwioch I use notepad++ and can't see a not needed "(" <?php /* * 2007-2016 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2016 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ if (!defined('_PS_VERSION_')) { exit; } class StatsData extends Module { public function __construct() { $this->name = 'statsdata'; $this->tab = 'analytics_stats'; $this->version = '1.6.0'; $this->author = 'PrestaShop'; $this->need_instance = 0; $this->bootstrap = true; parent::__construct(); $this->displayName = $this->l('Data mining for statistics'); $this->description = $this->l('This module must be enabled if you want to use statistics.'); $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); } public function install() { if (_PS_VERSION_ >= 1.7) { $hookFooter = 'displayBeforeBodyClosingTag'; } else { $hookFooter = 'footer'; } return (parent::install() && $this->registerHook($hookFooter) && $this->registerHook('authentication') && $this->registerHook('createAccount')); } public function getContent() { $html = ''; if (Tools::isSubmit('submitStatsData')) { Configuration::updateValue('PS_STATSDATA_CUSTOMER_PAGESVIEWS', (int)Tools::getValue('PS_STATSDATA_CUSTOMER_PAGESVIEWS')); Configuration::updateValue('PS_STATSDATA_PAGESVIEWS', (int)Tools::getValue('PS_STATSDATA_PAGESVIEWS')); Configuration::updateValue('PS_STATSDATA_PLUGINS', (int)Tools::getValue('PS_STATSDATA_PLUGINS')); $html .= $this->displayConfirmation($this->l('Configuration updated')); } $html .= $this->renderForm(); return $html; } public function hookFooter($params) { if (_PS_VERSION_ < 1.7) { $script_content_plugins = $this->getScriptPlugins($params); $script_content_pages_views = $this->getScriptCustomerPagesViews($params); return $script_content_plugins . $script_content_pages_views; } return false; } public function hookDisplayBeforeBodyClosingTag($params) { if (_PS_VERSION_ >= 1.7) { $script_content_plugins = $this->getScriptPlugins($params); $script_content_pages_views = $this->getScriptCustomerPagesViews($params); return $script_content_plugins . $script_content_pages_views; } return false; } private function getScriptPlugins($params) { if (!isset($params['cookie']->id_guest)) { Guest::setNewGuest($params['cookie']); if (Configuration::get('PS_STATSDATA_PLUGINS')) { if (_PS_VERSION_ >= 1.7) { $this->context->controller->registerJavascript('modules-plugindetect', 'modules/'.$this->name.'/js/plugindetect.js', ['position' => 'bottom', 'priority' => 150]); } else { $this->context->controller->addJS($this->_path.'js/plugindetect.js'); } $token = sha1($params['cookie']->id_guest._COOKIE_KEY_); return '<script type="text/javascript"> $(document).ready(function() { plugins = new Object; plugins.adobe_director = (PluginDetect.getVersion("Shockwave") != null) ? 1 : 0; plugins.adobe_flash = (PluginDetect.getVersion("Flash") != null) ? 1 : 0; plugins.apple_quicktime = (PluginDetect.getVersion("QuickTime") != null) ? 1 : 0; plugins.windows_media = (PluginDetect.getVersion("WindowsMediaPlayer") != null) ? 1 : 0; plugins.sun_java = (PluginDetect.getVersion("java") != null) ? 1 : 0; plugins.real_player = (PluginDetect.getVersion("RealPlayer") != null) ? 1 : 0; navinfo = { screen_resolution_x: screen.width, screen_resolution_y: screen.height, screen_color:screen.colorDepth}; for (var i in plugins) navinfo = plugins; navinfo.type = "navinfo"; navinfo.id_guest = "'.(int)$params['cookie']->id_guest.'"; navinfo.token = "'.$token.'"; }); </script>'; } } return ''; } private function getScriptCustomerPagesViews($params) { // Record the guest path then increment the visit counter of the page $token_array = Connection::setPageConnection($params['cookie']); ConnectionsSource::logHttpReferer(); if (Configuration::get('PS_STATSDATA_PAGESVIEWS')) { Page::setPageViewed($token_array['id_page']); } if (Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS')) { // Ajax request sending the time spend on the page $token = sha1($token_array['id_connections'].$token_array['id_page'].$token_array['time_start']._COOKIE_KEY_); return '<script type="text/javascript"> var time_start; $(window).load( function() { time_start = new Date(); } ); $(window).unload( function() { var time_end = new Date(); var pagetime = new Object; pagetime.type = "pagetime"; pagetime.id_connections = "'.(int)$token_array['id_connections'].'"; pagetime.id_page = "'.(int)$token_array['id_page'].'"; pagetime.time_start = "'.$token_array['time_start'].'"; pagetime.token = "'.$token.'"; pagetime.time = time_end-time_start; } ); </script>'; } return ''; } public function hookCreateAccount($params) { return $this->hookAuthentication($params); } public function hookAuthentication($params) { // Update or merge the guest with the customer id (login and account creation) $guest = new Guest($params['cookie']->id_guest); $result = Db::getInstance()->getRow(' SELECT `id_guest` FROM `'._DB_PREFIX_.'guest` WHERE `id_customer` = '.(int)$params['cookie']->id_customer); if ((int)$result['id_guest']) { // The new guest is merged with the old one when it's connecting to an account $guest->mergeWithCustomer($result['id_guest'], $params['cookie']->id_customer); $params['cookie']->id_guest = $guest->id; } else { // The guest is duplicated if it has multiple customer accounts $method = ($guest->id_customer) ? 'add' : 'update'; $guest->id_customer = $params['cookie']->id_customer; $guest->{$method}(); } } public function renderForm() { $fields_form = array( 'form' => array( 'legend' => array( 'title' => $this->l('Settings'), 'icon' => 'icon-cogs' ), 'input' => array( array( 'type' => 'switch', 'label' => $this->l('Save page views for each customer'), 'name' => 'PS_STATSDATA_CUSTOMER_PAGESVIEWS', 'desc' => $this->l('Storing customer page views uses a lot of CPU resources and database space. Only enable if your server can handle it.'), 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ), array( 'type' => 'switch', 'label' => $this->l('Save global page views'), 'name' => 'PS_STATSDATA_PAGESVIEWS', 'desc' => $this->l('Global page views uses fewer resources than customer\'s, but it uses resources nonetheless.'), 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ), array( 'type' => 'switch', 'label' => $this->l('Plugins detection'), 'name' => 'PS_STATSDATA_PLUGINS', 'desc' => $this->l('Plugins detection loads an extra 20 kb JavaScript file once for new visitors.'), 'values' => array( array( 'id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled') ), array( 'id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled') ) ), ) ), 'submit' => array( 'title' => $this->l('Save'), ) ), ); $helper = new HelperForm(); $helper->show_toolbar = false; $helper->table = $this->table; $lang = new Language((int)Configuration::get('PS_LANG_DEFAULT')); $helper->default_form_language = $lang->id; $helper->allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0; $this->fields_form = array(); $helper->identifier = $this->identifier; $helper->submit_action = 'submitStatsData'; $helper->currentIndex = $this->context->link->getAdminLink('AdminModules', false).'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name; $helper->token = Tools::getAdminTokenLite('AdminModules'); $helper->tpl_vars = array( 'fields_value' => $this->getConfigFieldsValues(), 'languages' => $this->context->controller->getLanguages(), 'id_language' => $this->context->language->id ); return $helper->generateForm(array($fields_form)); } public function getConfigFieldsValues() { return array( 'PS_STATSDATA_CUSTOMER_PAGESVIEWS' => Tools::getValue('PS_STATSDATA_CUSTOMER_PAGESVIEWS', Configuration::get('PS_STATSDATA_CUSTOMER_PAGESVIEWS')), 'PS_STATSDATA_PAGESVIEWS' => Tools::getValue('PS_STATSDATA_PAGESVIEWS', Configuration::get('PS_STATSDATA_PAGESVIEWS')), 'PS_STATSDATA_PLUGINS' => Tools::getValue('PS_STATSDATA_PLUGINS', Configuration::get('PS_STATSDATA_PLUGINS')), ); } } The above is the statsdata.php code Thanks. -
Error 500 , version 1.6.1.2
Elaine Leung replied to Elaine Leung's topic in Configuring and using PrestaShop
Thank you so much for the helpful tips. My website was experiencing an error. The hosting support team said when visiting my site, they saw a blank page (500 error). This error is due to an error in the sites code. The problem is /home/natur061/public_html/modules/statsdata/statsdata.php. There is a syntax error in the statsdata module. They went ahead and disabled the statsdata module by renaming the statsdata folder to statsdata.disabled and the site is now loading. The problem is not solved and it only enable the website to load. My site is www.naturalskincarelondon.co.uk -
Hi I went into the modules and see some modules needed to upgrade. Just press the button. Now I am in a big problem. When visiter visits my site, it has HTTP 500 error That’s odd… the website can’t display this page. When I in the back office, press modules I get this: [PrestaShop] Fatal error in module file :/home/natur061/public_html/modules/statsdata/statsdata.php: syntax error, unexpected '[' Please help: what can I do to solve this problem. Thank you in advance.
-
Missing sitemap
Elaine Leung replied to Elaine Leung's topic in Addons, modules and themes developers
I use the Google sitemap module of Prestashop now. -
php version 5.4
Elaine Leung replied to Elaine Leung's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
Thank you for your reply. The Prestashop version is :1.6.1.2 I shall follow your advise not to change the php version. Thank you. Kind regards Elaine -
Hi In my back office, Configuration Information Optional parameters Please fix the following error(s) You are using PHP 5.3.29 version. Soon, the latest PHP version supported by PrestaShop will be PHP 5.4. To make sure you’re ready for the future, we recommend you to upgrade to PHP 5.4 now! I went to cpanel. submit the version as 5.4. Then my back office has problem 500 internal error. I therefore changed it back to version 5.3.29 Have I changed the php version in the wrong place. Thank you in advance for tips. Kind regards Elaine
-
Hi I was trying to upgrade. I saved the Disable non-native modules as yes. I have not pressed the upgrade button. Then it have the internal error occurred. Then Orignal version have Error: Unable to check md5 files Differences between versions has a cycle round and round non stop. What should I do now? Please Please help http://naturalskincarelondon.co.uk Elaine Hi I have used back up to restore to previous version. Then I do the upgrade again and is successful. Thank you for spending the time here. Kind regards Elaine
-
Hi Thank you sooooooooo much. It works. Kind regards Elaine
-
Hi Thank you for reply. What problem does that script gives? https://www.prestashop.com/blog/en/guest-blogger-series-prestashop-ssl-installation-troubleshooting/ From this link it said in all cases, when you use SSL, your image/stylesheets/javascripts references MUST begin with {$base_dir_ssl}. I don't understand this instructions. Can you or someone give me some advice. Kind regards Elaine
-
Hi Google and Firefox labeled my website as unsecured even I have installed SSL as my SSL used SHA 1. I have changed the SSL with SHA 2. It makes no difference. In the end I have to make SSL on all pages. Google is ok now. Firefox is still not happy with my website. I was advised all resources need to be linked into the site using https. This includes any image, css or javescript files. I don't know how to do this. Please help me and give me detail advice. Thank you in advance! Kind regards Elaine
-
Missing Ecommerce Data on Google Analytics
Elaine Leung replied to Elaine Leung's topic in Online sales and SEO
Hi Nemo1 Thank you for replying. In the GA API module said only work if either (1) have installed and configured the GA module or (2) have already embedded the GA script into the shop I therefore installed both GA and GA API. Please advise me what should I do now. Is it true that better embedded the GA script, if it is, which file should I embedded it in. Thank you Elaine -
Missing Ecommerce Data on Google Analytics
Elaine Leung replied to Elaine Leung's topic in Online sales and SEO
Hi Nemo1 Thank you for your reply. The Google Analytics module is hooking on displayOrderConfirmation. The Google Analytics APL is not hooking on anything. Please advise what can I do to solve the problem. Thank you. Kind Regards Elaine -
Missing Ecommerce Data on Google Analytics
Elaine Leung replied to Elaine Leung's topic in Online sales and SEO
Hi Nemo1 Thank you for the reply and sorry for not able to reply earlier as I was away for 10 days. How can I tell if I have enable GA properly? Please advise me what can I do to fix the problem. Thank you. Elaine -
Hi I hope someone can help me with the Missing Ecommerce Data on Google Analytics problem. What do I need to do to solve this problem? Thank you in advance Elaine Leung