Jump to content

LeeFoster

Members
  • Content count

    1,560
  • Joined

  • Last visited

  • Days Won

    11

Everything posted by LeeFoster

  1. LeeFoster

    Google Analytic Ecommerce header tag

    I'm not sure, I've never taken much notice.
  2. LeeFoster

    Google Analytic Ecommerce header tag

    That's where your sales should appear.
  3. LeeFoster

    Google Analytic Ecommerce header tag

    @Psytanium go to Admin -> Ecommerce Settings and enable ecommerce Then go back to All Web Site Data (the home screen) and at the bottom you should have the below next to 'How well do you retain users?'
  4. LeeFoster

    Google Analytic Ecommerce header tag

    Do you see the what are your top selling products box at the bottom of the all data view?
  5. LeeFoster

    Google Analytic Ecommerce header tag

    Have you turned on the ecommerce settings in Google Analytics?
  6. LeeFoster

    Admin - Redirect after login

    I have recently installed a multi level admin and I'd like to add a redirect function so admins are directed to a specific page based on their groups. I know how to add the page to the database for the redirect what I'm struggling with is how to inject the redirect into the core login function (without core changes). Has anyone done anything similar?
  7. LeeFoster

    Admin - Redirect after login

    1. I didn't want to add one in that would be over written 2. I know I was testing with my on hook before requesting one I actually managed to fix it without a hook.
  8. LeeFoster

    Admin - Redirect after login

    I literally just did this $_SESSION['admin'] = [ 'id' => $check['id'], 'username' => $check['user_name'], 'user_group_id' => $check['user_group_id'], 'default_page' => $check['default_page'] ]; echo '<script> window.location.replace("'.$check['default_page'].'"); </script>'; Testing it now.
  9. LeeFoster

    Admin - Redirect after login

    Could I do the redirect in this code to avoid any core changes? <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2020 osCommerce Released under the GNU General Public License */ function check_admin_group($administrator_group_access_file){ global $PHP_SELF, $language, $cfgModules, $admin; $is_valid_access = true; $exclude_pages = array( 'index.php', 'login.php', 'invoice.php', 'packingslip.php', 'popup_image.php' ); $administrator_group_id = (int)$admin['user_group_id']; if($administrator_group_id != '' && $administrator_group_id > 0 && !in_array($administrator_group_access_file, $exclude_pages)){ $check_file_access = tep_db_query("select ag.administrator_group_id from administrator_groups ag, administrator_group_access aga where aga.administrator_group_id = ag.administrator_group_id and ag.administrator_group_id = '" . (int)$administrator_group_id . "' and aga.administrator_group_access_file = '" . $administrator_group_access_file . "'"); if(!tep_db_num_rows($check_file_access))$is_valid_access = false; } return $is_valid_access; } function display_block_to_admin_group($administrator_group_block){ global $PHP_SELF, $language, $cfgModules, $admin; $display_block_to_admin_group = false; $administrator_group_id = (int)$admin['user_group_id']; if($administrator_group_id <= 0){ $display_block_to_admin_group = true; } if($administrator_group_block != '' && $administrator_group_id > 0){ $check_file_access = tep_db_query("select ag.administrator_group_id from administrator_groups ag, administrator_group_access aga where aga.administrator_group_id = ag.administrator_group_id and ag.administrator_group_id = '" . (int)$administrator_group_id . "'"); if(tep_db_num_rows($check_file_access))$display_block_to_admin_group = true; } return $display_block_to_admin_group; } if ( file_exists(DIR_FS_ADMIN . 'includes/languages/english/hooks/iMenu.php') ) { include_once(DIR_FS_ADMIN . 'includes/languages/english/hooks/iMenu.php') ; } class hook_admin_siteWide_aMenu { var $version = '1.0.0'; var $siteend = null; function listen_injectSiteStart() { global $PHP_SELF, $language, $cfgModules, $admin , $current_page; $administrator_group_id = isset($_SESSION['admin']['user_group_id']); if( $administrator_group_id <=0) { $check_query = tep_db_query("SELECT id, user_name, user_password, user_group_id, default_page FROM administrators as a join administrator_groups as ag on a.user_group_id = ag.administrator_group_id WHERE id = '" .(int)$admin['id'] . "'"); if (tep_db_num_rows($check_query) == 1) { $check = tep_db_fetch_array($check_query); // unset($_SESSION['admin']); $_SESSION['admin'] = [ 'id' => $check['id'], 'username' => $check['user_name'], 'user_group_id' => $check['user_group_id'], 'default_page' => $check['default_page'] ]; } } if(!check_admin_group($current_page)){ // tep_redirect(tep_href_link('index.php')); echo '<script> window.location.replace("'.DIR_WS_HTTPS_ADMIN.'/index.php"); </script>'; } } function listen_injectBodyStart() { global $PHP_SELF, $language, $cfgModules, $admin; $output = null; if (basename($PHP_SELF) != 'login.php') { $cl_box_groups = array(); if ($dir = @dir(DIR_FS_ADMIN . 'includes/boxes')) { $files = array(); while ($file = $dir->read()) { if (!is_dir($dir->path . '/' . $file)) { if (substr($file, strrpos($file, '.')) == '.php') { if ((strpos($file, 'paypal2') === false) &&($file!='configuration_administrators.php')) $files[] = $file; } } } $dir->close(); natcasesort($files); foreach ( $files as $file ) { if ( file_exists(DIR_FS_ADMIN . 'includes/languages/' . $language . '/modules/boxes/' . $file) ) { include_once(DIR_FS_ADMIN . 'includes/languages/' . $language . '/modules/boxes/' . $file); } include_once($dir->path . '/' . $file); } } function tep_sort_a_boxes($a, $b) { return strcasecmp(strip_tags($a['heading']), strip_tags($b['heading'])); } usort($cl_box_groups, 'tep_sort_a_boxes'); function tep_sort_a_boxes_links($a, $b) { return strcasecmp($a['title'], $b['title']); } foreach ( $cl_box_groups as &$group ) { usort($group['apps'], 'tep_sort_a_boxes_links'); } $n = 1; $mr = null; foreach ($cl_box_groups as $groups) { if(display_block_to_admin_group($groups['heading'])) { $mr .= '<li class="nav-item dropdown">'; $mr .= '<a class="nav-link dropdown-toggle" href="#" id="navbar_' . $n . '" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">' . $groups['heading'] . '</a>'; $al = ($n > 6) ? ' dropdown-menu-right' : ''; $mr .= '<div class="dropdown-menu' . $al . '" aria-labelledby="navbar_' . $n . '">'; foreach ($groups['apps'] as $app) { if(check_admin_group($app['code'])) $mr .= '<a class="dropdown-item" href="' . $app['link'] . '">' . $app['title'] . '</a>'; } $mr .= '</div>'; $mr .= '</li>' . PHP_EOL; $n++; } } $output .= '<nav id="iMenu" class="navbar navbar-expand-md sticky-top navbar-dark bg-dark">'; $output .= '<a class="navbar-brand" href="' . tep_href_link('index.php') . '">' . tep_image('images/CE-Phoenix-30-30.png', 'OSCOM CE Phoenix v' . tep_get_version(), 30, 30, null, false) . '</a>'; $output .= '<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarAdmin" aria-controls="navbarAdmin" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>'; $output .= '<div class="collapse navbar-collapse" id="navbarAdmin">'; $output .= '<ul class="navbar-nav mr-auto">' . $mr . '</ul>'; $output .= '</div>'; $output .= '</nav>'; $output .= '<div class="col bg-light">'; $output .= '<ul class="nav justify-content-end" id="a1">'; $output .= '<li class="nav-item"><a class="nav-link" target="_blank" href="https://forums.oscommerce.com/clubs/1-phoenix/">' .tep_image('images/icon_phoenix.png', 'Phoenix') . ' ' . HEADER_TITLE_PHOENIX_CLUB . '</a></li>'; $output .= '<li class="nav-item"><a class="nav-link" href="' . tep_href_link('certified_addons.php') . '">' . tep_image('images/icon_phoenix.png', 'Phoenix') . ' ' . HEADER_TITLE_CERTIFIED_ADDONS . '</a></li>'; $output .= '<li class="nav-item"><a class="nav-link" href="' . tep_catalog_href_link() . '">' . HEADER_TITLE_ONLINE_CATALOG . '</a></li>'; $output .= '<li class="nav-item"><a class="nav-link text-danger" href="' . tep_href_link('login.php', 'action=logoff') . '">' . sprintf(HEADER_TITLE_LOGOFF, $admin['username']) . '</a></li>'; $output .= '</ul>'; $output .= '</div>'; $output .= '<hr class="w-100 m-0 p-0 mb-0">'; //$output .= '<script>$(".navbar").hide(); $("#iMenu").show(); </script>'; //$output .= '<script>$(".justify-content-end").hide(); $("#a1").show(); </script>'; return $output; } } function listen_injectSiteEnd() { $this->siteend .= '<script>$(".navbar").hide(); $("#iMenu").show(); </script>'; $this->siteend .= '<script>$(".justify-content-end").hide(); $("#a1").show(); </script>'; return $this->siteend; } }
  10. LeeFoster

    Admin - Redirect after login

    Probably not, just wanted to cover my bases for in future though.
  11. LeeFoster

    Admin - Redirect after login

    Would this not result in it always redirect though not just on login?
  12. LeeFoster

    Admin - Redirect after login

    I'm happy for it to be moved. I may have to go down this route as the issue I am now having is that the admin group id isn't set in the preAction, meaning I can't get the redirect page. class hook_admin_login_admin_group_redirect { var $version = '1.0.0'; function listen_preAction() { //$default_page_query = tep_db_query('select default_page from administrator_groups where administrator_group_id = '.$_SESSION['user_group_id'].''); //$default_page = tep_db_fetch_array($default_page_query); $_SESSION['redirect_origin'] = [ 'page' => 'info_pages.php, 'get' => '', ]; } } The above works, the below doesnt class hook_admin_login_admin_group_redirect { var $version = '1.0.0'; function listen_preAction() { $default_page_query = tep_db_query('select default_page from administrator_groups where administrator_group_id = '.$_SESSION['user_group_id'].''); $default_page = tep_db_fetch_array($default_page_query); $_SESSION['redirect_origin'] = [ 'page' => $default_page['default_page'], 'get' => '', ]; } }
  13. LeeFoster

    Admin - Redirect after login

    No, I was trying to look for the admin array.
  14. LeeFoster

    Admin - Redirect after login

    I've created a hook for this but so far it is not working. I am using $OSCOM_Hooks->call('login', 'processAction'); in admin/login.php to hook to and my hook code is below class hook_admin_login_admin_group_redirect { var $version = '1.0.0'; function listen_processAction() { if (isset($_SESSION['admin'])) { $default_page_query = teb_db_query('select default_page from administrator_groups where administrator_group_id = '.$_SESSION['user_group_id'].''); $default_page = tep_db_fetch_array($default_page_query); tep_redirect(tep_href_link($default_page)); } } } Any pointers on where I'm going wrong?
  15. LeeFoster

    Easy Admin Group - Login Issues

    Right I have this working but I want to add to it. I'd like to set a default page for a group, I have a content creators group and I'd like to send them straight to info_pages.php. Any thoughts on how to achieve this before I start digging?
  16. LeeFoster

    Subscription as a Product

    Has anyone set OsCommerce up to have a product create a recurring payment? So you choose your support level, click buy now and it sets up a monthly paypal payment. In case it's needed I'm using Phoenix 1.0.7.10
  17. LeeFoster

    Easy Admin Group - Login Issues

    @hungryfrank As soon as I create a group and add someone to it I get this error. I'm on Phoenix 1.0.7.10
  18. You didn't give us that addon yet, lol
  19. LeeFoster

    I can't log in to the admin panel

    Never mind, I got the correct details by installing a fresh version of 1.0.7.7 and then copied them into my admin->local->configure.php and all is working.
  20. LeeFoster

    I can't log in to the admin panel

    Error message is - I suspect it is to do with the fact I have my admin->configure.php and admin->local->configure.php or at the very least an issue with admin->local->configure.php Here is the file - const HTTP_SERVER = 'http://127.0.0.1/360v3'; // eg, http://localhost - should not be empty for productive servers const COOKIE_OPTIONS = [ 'lifetime' => 0, 'domain' => '127.0.0.1', 'path' => '', 'samesite' => 'Lax', ]; define('DIR_FS_DOCUMENT_ROOT', 'C:/xampp/htdocs/360v3/'); // where your pages are located on the server. if $DOCUMENT_ROOT doesn't suit you, replace with your local path. (eg, /usr/local/apache/htdocs) const DIR_WS_ADMIN = '/admin/'; const DIR_FS_ADMIN = DIR_FS_DOCUMENT_ROOT . DIR_WS_ADMIN; const DIR_FS_BACKUP = DIR_FS_ADMIN . 'backups/'; // leave blank or omit to use MySQL sessions const DIR_FS_SESSION = ''; const HTTP_CATALOG_SERVER = 'http://127.0.0.1/'; const DIR_WS_CATALOG = '/'; const DIR_FS_CATALOG = DIR_FS_DOCUMENT_ROOT . DIR_WS_CATALOG; // set default timezone if none exists (PHP 5.3 throws an E_WARNING) date_default_timezone_set(date_default_timezone_get()); // define our database connection const DB_SERVER = 'localhost'; // eg, localhost - should not be empty for productive servers const DB_SERVER_USERNAME = 'root'; const DB_SERVER_PASSWORD = ''; const DB_DATABASE = '360v3';
  21. LeeFoster

    I can't log in to the admin panel

    I have the same issue on a 1.0.7.7 site.
  22. You've clearly never written any code. The developers are updating their platform, there are only 2 of them for core and they are prioritizing things You seem to be the only person asking for this so yes, you hire someone to do it. If it's written well and other people want to use it release it to @burt and it 'may' find it's way into core.
  23. I am using paypal standard as my payment method and when you get to the Paypal payment screen there is no order breakdown, is this due to oscommerce not sending the details or is it a setting in Paypal? Using Phoenix 1.0.2.8
×