Jump to content

herbsandhelpers

Members
  • Content count

    109
  • Joined

  • Last visited


Reputation Activity

  1. Like
    herbsandhelpers got a reaction from raiwa in [Contribution] iOSC - mobile version of OSC on your iPhone   
    First thanks to Rainer for his excellent contrib. Just going to post a workaround I found for SPPC with Hide Categories and Products as this has been the only thing stopping me using this in the past. Please note I am NOT a coder! All at your own risk! Additionally I can't get the search to work. it's too restrictive if anyone can help further with this please. So to ensure only the categories and products show per SPPC on 2.3.4.only:
     
    In catalog_mb.php find first listing_sql and paste this above it as per current SPPC instructions:
     
    // BOF Separate Price Per Customer // global variable (session): $sppc_customers_group_id -> local variable $customer_group_id if(!tep_session_is_registered('sppc_customer_group_id')) {$customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // EOF SPPC Then find this line:
    $listing_sql .= " and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"; and directly below it paste this line:
    // BOF SPPC Hide products and categories from groups $listing_sql .= " and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 "; // EOF SPPC Hide products and categories from groups Do this for the other files mentioned: specials.php and products_new.php
     
    Then in login.php compare your login file with one below and add the SPPC and Hide Categories bit:
    <?php require_once('includes/application_top.php'); // redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started) if ($session_started == false) { tep_redirect(tep_mobile_link(FILENAME_COOKIE_USAGE)); } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN); $error = false; if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'process')) { $email_address = tep_db_prepare_input($HTTP_POST_VARS['email_address']); $password = tep_db_prepare_input($HTTP_POST_VARS['password']); // Check if email exists // BOF Separate Pricing per Customer $check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_group_id, customers_password, customers_email_address, customers_default_address_id, customers_specific_taxes_exempt from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'"); // EOF Separate Pricing Per Customer if (!tep_db_num_rows($check_customer_query)) { $error = true; } else { $check_customer = tep_db_fetch_array($check_customer_query); // Check that password is good if (!tep_validate_password($password, $check_customer['customers_password'])) { $error = true; } else { if (SESSION_RECREATE == 'True') { tep_session_recreate(); } // BOF Separate Pricing Per Customer: choice for logging in under any customer_group_id // note that tax rates depend on your registered address! if ($_POST['skip'] != 'true' && $_POST['email_address'] == SPPC_TOGGLE_LOGIN_PASSWORD ) { $existing_customers_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id "); echo '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">'; print ("\n<html "); echo HTML_PARAMS; print (">\n<head>\n<title>Choose a Customer Group</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset="); echo CHARSET; print ("\"\n<base href=\""); echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; print ("\">\n<link rel=\"stylesheet\" type=\"text/css\" href=\"stylesheet.css\">\n"); echo '<body bgcolor="#ffffff" style="margin:0">'; print ("\n<table border=\"0\" width=\"100%\" height=\"100%\">\n<tr>\n<td style=\"vertical-align: middle\" align=\"middle\">\n"); echo tep_draw_form('login', tep_href_link(FILENAME_LOGIN, 'action=process', 'SSL')); print ("\n<table border=\"0\" bgcolor=\"#f1f9fe\" cellspacing=\"10\" style=\"border: 1px solid #7b9ebd;\">\n<tr>\n<td class=\"main\">\n"); $index = 0; while ($existing_customers = tep_db_fetch_array($existing_customers_query)) { $existing_customers_array[] = array("id" => $existing_customers['customers_group_id'], "text" => " ".$existing_customers['customers_group_name']." "); ++$index; } print ("<h1>Choose a Customer Group</h1>\n</td>\n</tr>\n<tr>\n<td align=\"center\">\n"); echo tep_draw_pull_down_menu('new_customers_group_id', $existing_customers_array, $check_customer['customers_group_id']); print ("\n<tr>\n<td class=\"main\"> <br />\n "); print ("<input type=\"hidden\" name=\"email_address\" value=\"".$_POST['email_address']."\">"); print ("<input type=\"hidden\" name=\"skip\" value=\"true\">"); print ("<input type=\"hidden\" name=\"password\" value=\"".$_POST['password']."\">\n</td>\n</tr>\n<tr>\n<td align=\"right\">\n"); echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); print ("</td>\n</tr>\n</table>\n</form>\n</td>\n</tr>\n</table>\n</body>\n</html>\n"); exit; } // EOF Separate Pricing Per Customer: choice for logging in under any customer_group_id // migrate old hashed password to new phpass password if (tep_password_type($check_customer['customers_password']) != 'phpass') { tep_db_query("update " . TABLE_CUSTOMERS . " set customers_password = '" . tep_encrypt_password($password) . "' where customers_id = '" . (int)$check_customer['customers_id'] . "'"); } $check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'"); $check_country = tep_db_fetch_array($check_country_query); $customer_id = $check_customer['customers_id']; $customer_default_address_id = $check_customer['customers_default_address_id']; $customer_first_name = $check_customer['customers_firstname']; // BOF Separate Pricing Per Customer $customers_specific_taxes_exempt = $check_customer['customers_specific_taxes_exempt']; if ($_POST['skip'] == 'true' && $_POST['email_address'] == SPPC_TOGGLE_LOGIN_PASSWORD && isset($_POST['new_customers_group_id'])) { $sppc_customer_group_id = $_POST['new_customers_group_id'] ; $check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt, group_specific_taxes_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$_POST['new_customers_group_id'] . "'"); } else { $sppc_customer_group_id = $check_customer['customers_group_id']; $check_customer_group_tax = tep_db_query("select customers_group_show_tax, customers_group_tax_exempt, group_specific_taxes_exempt from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id = '" .(int)$check_customer['customers_group_id'] . "'"); } $customer_group_tax = tep_db_fetch_array($check_customer_group_tax); $sppc_customer_group_show_tax = (int)$customer_group_tax['customers_group_show_tax']; $sppc_customer_group_tax_exempt = (int)$customer_group_tax['customers_group_tax_exempt']; $group_specific_taxes_exempt = $customer_group_tax['group_specific_taxes_exempt']; if (tep_not_null($customers_specific_taxes_exempt)) { $sppc_customer_specific_taxes_exempt = $customers_specific_taxes_exempt; } elseif (tep_not_null($group_specific_taxes_exempt)) { $sppc_customer_specific_taxes_exempt = $group_specific_taxes_exempt; } else { $sppc_customer_specific_taxes_exempt = ''; } // EOF Separate Pricing Per Customer $customer_country_id = $check_country['entry_country_id']; $customer_zone_id = $check_country['entry_zone_id']; tep_session_register('customer_id'); tep_session_register('customer_default_address_id'); tep_session_register('customer_first_name'); // BOF Separate Pricing per Customer tep_session_register('sppc_customer_group_id'); tep_session_register('sppc_customer_group_show_tax'); tep_session_register('sppc_customer_group_tax_exempt'); if (tep_not_null($sppc_customer_specific_taxes_exempt)) { tep_session_register('sppc_customer_specific_taxes_exempt'); } // EOF Separate Pricing per Customer tep_session_register('customer_country_id'); tep_session_register('customer_zone_id'); tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1, password_reset_key = null, password_reset_date = null where customers_info_id = '" . (int)$customer_id . "'"); // reset session token $sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand()); // restore cart contents $cart->restore_contents(); if (sizeof($navigation->snapshot) > 0) { $origin_href = tep_mobile_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']); $navigation->clear_snapshot(); tep_redirect($origin_href); } else { tep_redirect(tep_mobile_link(FILENAME_DEFAULT)); } } } } if ($error == true) { $messageStack->add('login', TEXT_LOGIN_ERROR); } $breadcrumb->add(NAVBAR_TITLE, tep_mobile_link(FILENAME_LOGIN, '', 'SSL')); require(DIR_MOBILE_INCLUDES . 'header.php'); $headerTitle->write(); ?> <div id="iphone_content"> <div id="messageStack"> <?php if ($messageStack->size('login') > 0) { echo $messageStack->output('login'); } ?> </div> <div id="returning_cust"> <h1><?php echo HEADING_RETURNING_CUSTOMER; ?></h1> <?php echo tep_draw_form('login', tep_mobile_link(FILENAME_LOGIN, 'action=process', 'SSL')); ?> <label for="email_address"><?php echo ENTRY_EMAIL_ADDRESS; ?></label> <?php echo tep_input_jquery('email_address'); ?> <label for="password"><?php echo ENTRY_PASSWORD; ?></label> <?php echo tep_draw_password_field('password','','id="password" data-theme="a"'); ?> <div class="bouton"> <?php echo tep_button_jquery( IMAGE_BUTTON_FORGOT_PASS , tep_mobile_link(FILENAME_PASSWORD_FORGOTTEN, '', 'SSL') , 'b' , 'button' , 'data-icon="info" data-inline="true" data-ajax="false"' ); echo tep_button_jquery( IMAGE_BUTTON_LOGIN , '', 'b' , 'submit' , 'data-icon="arrow-r" data-iconpos="right" data-inline="true"' ); ?> </div> </form> </div> <div id="new_cust"> <h1><?php echo HEADING_NEW_CUSTOMER; ?></h1> <?php echo TEXT_NEW_CUSTOMER_INTRODUCTION; ?> <div class="bouton"> <?php echo tep_button_jquery( IMAGE_BUTTON_CREATE_ACCOUNT , tep_mobile_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'), 'b' , 'button' , 'data-icon="arrow-r" data-iconpos="right" data-inline="true" ' ); ?> </div> </div> <?php if( JQUERY_MOBILE_VALIDATE == 'True') require(DIR_MOBILE_INCLUDES. 'form_check.js.php'); else require(DIR_WS_INCLUDES . 'form_check.js.php'); require(DIR_MOBILE_INCLUDES . 'footer.php'); ?>  Do the same for your logoff.php with this:
    <?php require_once('includes/application_top.php'); require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGOFF); $breadcrumb->add(NAVBAR_TITLE); tep_session_unregister('customer_id'); tep_session_unregister('customer_default_address_id'); tep_session_unregister('customer_first_name'); // BOF Separate Pricing Per Customer tep_session_unregister('sppc_customer_group_id'); tep_session_unregister('sppc_customer_group_show_tax'); tep_session_unregister('sppc_customer_group_tax_exempt'); if (tep_session_is_registered('sppc_customer_specific_taxes_exempt')) { tep_session_unregister('sppc_customer_specific_taxes_exempt'); } // EOF Separate Pricing Per Customer tep_session_unregister('customer_country_id'); tep_session_unregister('customer_zone_id'); if ( tep_session_is_registered('sendto') ) { tep_session_unregister('sendto'); } if ( tep_session_is_registered('billto') ) { tep_session_unregister('billto'); } if ( tep_session_is_registered('shipping') ) { tep_session_unregister('shipping'); } if ( tep_session_is_registered('payment') ) { tep_session_unregister('payment'); } if ( tep_session_is_registered('comments') ) { tep_session_unregister('comments'); } if ( tep_session_is_registered('mobilesession') ) { tep_session_unregister('mobilesession'); } $cart->reset(); require(DIR_MOBILE_INCLUDES . 'header.php'); $headerTitle->write(); ?> <div id="iphone_content"> <div id="cms"> <?php echo TEXT_MAIN; ?> <div id="bouton"> <?php echo tep_button_jquery(IMAGE_BUTTON_CONTINUE , tep_mobile_link(FILENAME_DEFAULT, '', 'NONSSL'), 'b' , 'button' , ' data-icon="arrow-r" data-iconpos="right" data-ajax="false"' ); ?> </div> </div> <?php require(DIR_MOBILE_INCLUDES . 'footer.php'); ?>  You'll also have to make some changes to the mobile product_info.php file too just compare with your existing main catalog version.
     
    It all works except advanced search/search. Hope this helps someone! 
     
    Lorraine
     
×