hawken Posted May 28, 2011 Share Posted May 28, 2011 Hi, I am trying to add a login infobox to my shop, but using Amember login, not OSC. Is anyone out there able to assist me on editing the box to use the ammeber functions? Thank you in advance!! Here is the code needed to add amemebr login: session_start(); if ($au = $_SESSION['_amember_user']){ print "Welcome $au[name_f] $au[name_l] !"; } else { print "<form method=post action='/amember/login.php'> <input type=text name=amember_login size=10> <input type=password name=amember_pass size=10> <input type=submit value='Login'> </form> "; } Here is a nice looking login box, but using OSC data: <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2010 osCommerce Released under the GNU General Public License */ class bm_login { var $code = 'bm_login'; var $group = 'boxes'; var $title; var $description; var $sort_order; var $enabled = false; var $my_account_links; var $greeting; function bm_login() { $this->title = MODULE_BOXES_LOGIN_TITLE; $this->description = MODULE_BOXES_LOGIN_DESCRIPTION; if ( defined('MODULE_BOXES_LOGIN_STATUS') ) { $this->sort_order = MODULE_BOXES_LOGIN_SORT_ORDER; $this->enabled = (MODULE_BOXES_LOGIN_STATUS == 'True'); $this->my_account_links = MODULE_BOXES_LOGIN_ACCOUNT_LINKS; $this->greeting = MODULE_BOXES_LOGIN_GREETING; $this->group = ((MODULE_BOXES_LOGIN_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right'); } } function execute() { global $PHP_SELF, $customer_id, $customer_first_name, $oscTemplate; if (!tep_session_is_registered('customer_id')) { if ((basename($PHP_SELF) != FILENAME_LOGIN) && (basename($PHP_SELF) != FILENAME_CREATE_ACCOUNT)) { $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_LOGIN_BOX_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents" style="text-align: center;">' . ' ' . tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL'), 'post', '', true) . ' ' . '<span style="float: left">' . MODULE_BOXES_LOGIN_BOX_EMAIL_ADDRESS . '</span><br />' . tep_draw_input_field('email_address', '', 'size="10" style="width: 90%"') . '<br /><span style="float: left">' . MODULE_BOXES_LOGIN_BOX_PASSWORD . '</span><br />' . tep_draw_password_field('password', '', 'size="10" style="width: 90%"') . '<br />' . tep_draw_button(IMAGE_BUTTON_LOGIN, 'key', null, 'primary') . '<br /><a href="' . tep_href_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_PASSWORD_FORGOTTEN . '</a><br /><a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_NEW_ACCOUNT . '</a>' . ' </form>' . ' </div>' . '</div>'; $oscTemplate->addBlock($data, $this->group); } } elseif (tep_session_is_registered('customer_id')) { if (MODULE_BOXES_LOGIN_ACCOUNT_LINKS == 'True') { $data = '<div class="ui-widget infoBoxContainer">' . ' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_TITLE . '</div>' . ' <div class="ui-widget-content infoBoxContents" style="text-align: left;">' . ((MODULE_BOXES_LOGIN_GREETING == 'True') ? ' <strong>' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_TEXT . $customer_first_name . '</strong><br />' : '') . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_EDIT, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_INFORMATION . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_ADDRESS_BOOK, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_ADDRESS_BOOK . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_PASSWORD, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_PASSWORD . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_ORDERS_VIEW . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_NEWSLETTERS, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_EMAIL_NOTIFICATIONS_NEWSLETTERS . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_ACCOUNT_NOTIFICATIONS, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_EMAIL_NOTIFICATIONS_PRODUCTS . '</a><br />' . ' <a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . MODULE_BOXES_LOGIN_BOX_ACCOUNT_LOGOFF . '</a>' . ' </div>' . '</div>'; $oscTemplate->addBlock($data, $this->group); } } } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_BOXES_LOGIN_STATUS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Login Box Module', 'MODULE_BOXES_LOGIN_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display My Account Links', 'MODULE_BOXES_LOGIN_ACCOUNT_LINKS', 'True', 'Do you want to display the my account links?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Greeting', 'MODULE_BOXES_LOGIN_GREETING', 'True', 'Do you want to display the welcome greeting?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_LOGIN_CONTENT_PLACEMENT', 'Left Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_LOGIN_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_BOXES_LOGIN_STATUS', 'MODULE_BOXES_LOGIN_ACCOUNT_LINKS', 'MODULE_BOXES_LOGIN_GREETING', 'MODULE_BOXES_LOGIN_CONTENT_PLACEMENT', 'MODULE_BOXES_LOGIN_SORT_ORDER'); } } ?> Link to comment Share on other sites More sharing options...
trickz100 Posted June 8, 2011 Share Posted June 8, 2011 Im in the same boat as you! Im using the login addon yet using amember database. I can login using the box but after loggin in, it doesnt change to 'My account' and giving various account options within the box like normal, it just displays the 'Login' titles and boxes to enter username and password still. Link to comment Share on other sites More sharing options...
trickz100 Posted June 9, 2011 Share Posted June 9, 2011 Right, to login using the form: Find: tep_draw_input_field('email_address', Replace with: tep_draw_input_field('amember_login', Find: tep_draw_password_field('password', Replace: tep_draw_password_field('amember_pass' This will allow you to login but it wont change the box to 'My account' with the account options. Im stuck on that part :( Link to comment Share on other sites More sharing options...
Guest Posted June 9, 2011 Share Posted June 9, 2011 What is " amember database "? Is that part of another contribution for osC? The login box contribution is based on logging in using the osC methods. Link to comment Share on other sites More sharing options...
trickz100 Posted July 6, 2011 Share Posted July 6, 2011 Amember is an advanced membership solution. Instead of using the oscommerce customer database I use the amember database purely because it has so much more possibilities. I still however use oscommerce to add products etc. It is not an oscommerce addon, it is a seperate thing. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.