Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

kshop

Pioneers
  • Posts

    29
  • Joined

  • Last visited

Profile Information

Recent Profile Visitors

3,357 profile views

kshop's Achievements

  1. By the way it seems google will abandon its google friend connect very soon, however the code to use google account for logging in should be almost identical the one above if I am right. I had found and example of multi login (google, fb, yahoo, twitter...) somewhere on the internet (code.google.com ???). I cannot find it now when I need :-(
  2. The code above is in a separate file "dofblogin.php". In the login.php there is following code: <tr> <td width="50%" align="right" valign="top"><?php echo '<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="50%" align="right" valign="top"><?php echo tep_image_submit('button_login.gif', IMAGE_BUTTON_LOGIN); ?></td> </tr> <tr> <td> </td> <td width="50%" align="right" valign="top"> <?php echo '<a href="' . tep_href_link(FILENAME_DO_FBLOGIN, '', 'SSL') . '">' . tep_image_button('button_fb_login.png', IMAGE_BUTTON_LOGIN) . '</a>'; ?> </td> </tr> create_account.php: <!-- body_text //--> <td width="100%" valign="top"><?php echo tep_draw_form('account_edit', tep_href_link(FILENAME_CREATE_ACCOUNT_PROCESS, '', 'SSL'), 'post', 'onSubmit="return check_form();"') . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading" align="right"><?php //echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td> <?php echo '<a href="' . tep_href_link(FILENAME_DO_FBLOGIN, '', 'SSL') . '">' . tep_image_button('button_fb_login.png', IMAGE_BUTTON_LOGIN) . '</a>'; ?> </td> </tr> the definition define('FILENAME_DO_FBLOGIN','dofblogin.php'); should be moved to includes/filenames.php $fbconfig['secret'], $fbconfig['appid' ] could be placed in the includes/config.php and replaced by define(). You should uncomment the line //$cart->restore_contents(); My osc 2.2 is very heavily modified, however I have posted the entire dofblogin.php file above, so it should work with no problems.
  3. I have made my own FB login code, I deleted all the FB javascript and do not use FB SDK anymore. I put a link (fb image button) to the file facebook login file in the login.php and in create_account.php. It's not perfect, but it works. The facebook login file is as follows: <?php //Facebook Connect require('includes/application_top.php'); define('FILENAME_DO_FBLOGIN','dofblogin.php');//this file // If user is logged in and session is valid. if(!isset($_GET["code"])) { $_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection $url="https://graph.facebook.com/oauth/authorize?client_id=".$fbconfig['appid' ]."&redirect_uri=".tep_href_link(FILENAME_DO_FBLOGIN)."&state=" . $_SESSION['state']; header("location:".$url); exit(); } if(isset($_GET["code"])) { if($_REQUEST['state'] == $_SESSION['state']) { $token_url ="https://graph.facebook.com/oauth/access_token?client_id=" . $fbconfig['appid' ] . "&redirect_uri=" . tep_href_link(FILENAME_DO_FBLOGIN) . "&client_secret=" . $fbconfig['secret'] . "&code=" . $_GET['code']; $access_token = file_get_contents($token_url); $_SESSION["access_token"]=$access_token; //$_SESSION["steps_facebook"]="authorized"; $graph_url = "https://graph.facebook.com/me?" .$_SESSION["access_token"]; $results = json_decode(file_get_contents($graph_url)); if(isset($results->id)) { //user is logged in into FB $fb_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . $results->email . "'"); $fb_customer_check = tep_db_num_rows($fb_customer_query); if($fb_customer_check <= 0){ //check for id, email may not be available in case the user has changed FB privacy settings $fb_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where fb_user_id = '" . $results->id . "'"); $fb_customer_check = tep_db_num_rows($fb_customer_query); } // if user is logged in, set current user's login FB login (merge) if (($fb_customer_check <= 0) and (!empty($_SESSION['customer_id']))){ $fb_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$_SESSION['customer_id'] . "'"); $fb_customer_check = tep_db_num_rows($fb_customer_query); } if ($fb_customer_check > 0){ if (SESSION_RECREATE == 'True') { tep_session_recreate(); } $fb_customer = tep_db_fetch_array($fb_customer_query); $fb_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$fb_customer['customers_id'] . "' and address_book_id = '" . (int)$fb_customer['customers_default_address_id'] . "'"); $fb_country = tep_db_fetch_array($fb_country_query); $customer_default_address_id = $fb_customer['customers_default_address_id']; global $customer_first_name; $customer_first_name = $fb_customer['customers_firstname']; $customer_country_id = $fb_country['entry_country_id']; $customer_zone_id = $fb_country['entry_zone_id']; $_SESSION['customer_id']=$fb_customer['customers_id']; $_SESSION['customer_default_address_id']=$customer_default_address_id; $_SESSION['customer_first_name']=$customer_first_name; $_SESSION['customer_country_id']=$customer_country_id; $_SESSION['customer_zone_id']=$customer_zone_id; tep_db_query("update " . TABLE_CUSTOMERS . " set fb_user_id = " . $results->id . " where customers_id = '" . (int)$fb_customer['customers_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 where customers_info_id = '" . (int)$fb_customer['customers_id'] . "'"); //restore cart contents //$cart->restore_contents(); if (sizeof($navigation->snapshot) > 0) { $origin_href = tep_href_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_href_link(FILENAME_DEFAULT)); } }else{ //fb user not found in customers table $account=array(); $account['customers_nickname']=$results->first_name; $account['customers_firstname']=$results->first_name; $account['customers_lastname']=$results->last_name; /*if (isset($results->gender)){ if ($results->gender=='female'){ $account['customers_gender']='f'; } else { $account['customers_gender']='m'; } } else { $account['customers_gender']='m'; } */ if (isset($results->email)) { $account['customers_email_address']=$results->email; } else { $account['customers_email_address']=tep_create_random_value(10).'@[member='unknown'].addr'; } $newpass = tep_create_random_value(8); $crypted_password = tep_encrypt_password($newpass); $account['customers_password']=$crypted_password; $account['fb_user_id']=$results->id; $account['customers_default_address_id']=1; tep_db_perform(TABLE_CUSTOMERS,$account); $fb_customer_query = tep_db_query("select customers_id from " . TABLE_CUSTOMERS . " where fb_user_id = '" . $results->id . "'"); $fb_customer = tep_db_fetch_array($fb_customer_query); $_SESSION['customer_id']=$fb_customer['customers_id']; $_SESSION['customer_default_address_id']=1; tep_redirect(tep_href_link(FILENAME_ACCOUNT_EDIT));//account_edit } }//results->id } else { echo("The state does not match. You may be a victim of CSRF."); } }//code require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
  4. Has everyone solved problems with the latest FB SDK. I have a problem since December 2011. It looks like when I click the "login with facebook" button logout() is called (i have an alert() there) and the user does log in. I have already modified fbconnect.php and $fbme variable is OK. I have no idea what is going on. Osc 2.2.
  5. I have just faced a related problem. I looked at the apache error log and it shows: File does not exist: /home/someuser/domains/somedomain.com/public_html/external/jscookmenu/themeie/external/jscookmenu/themeie/theme.css I can see the wrong path of the .css file here (external/jscookmenu/themeie/ is repeated twice). How to fix this?
  6. in the admin part set "Enter special character conversions" if you have such a setting. I have a modified version 2.1d by cpedit. Or you can modify source by an example of cyrillic character conversion of some mod in the contribution list.
  7. How about solving problem with multilanguage sites, Zorglubsky's site also suffers from this: when you have product_info.php open and choose another language from the languages box, product info in another language opens, however links in the language box are incorrect - current language link contains SEO url from the last language, e.g., we have links like "...bodysuit?language=en" and "...bodysuit&language=fr", "...bodysuit" should be show translated into the French language. I tried to debug, but to no avail... Anyone has fixed this?
  8. I have installed it by adding define statement in application_top.php: ... // Ultimate SEO URLs v2.1 // define('SEO_ENABLED','true'); <- add this line. When SEO is installed comment it out if ((defined(SEO_ENABLED)) || (SEO_ENABLED == 'true')) { .... If this does not help, it may be that MySQL does not accept insert SQL statements in its short form, because of incorrect (? - I'm not a MySQL professional) type of the first column. Solution is described in my post above.
  9. I have found the source of a problem: regular expression removes dashes and replaces UTF-8 national characters with wrong characters as far as I can see in the debugger (PHP Eclipse): function strip($string){ if ( is_array($this->attributes['SEO_CHAR_CONVERT_SET']) ) $string = strtr($string, $this->attributes['SEO_CHAR_CONVERT_SET']); $pattern = $this->attributes['SEO_REMOVE_ALL_SPEC_CHARS'] == 'true' ? "([^[:alnum:]])+" : "([[:punct:]])+";//<- this removes dashes and replaces correct UTF-8 characters with incorrect non UTF-8 characters $anchor = ereg_replace($pattern, '', strtolower($string)); $pattern = "([[:space:]]|[[:blank:]])+"; $anchor = ereg_replace($pattern, '-', $anchor); return $this->short_name($anchor); // return the short filtered name } # end function So the next question is how to make ereg_replace not to think that UTF-8 characters are incorrect?
  10. I have just installed Ultimate SEO 2.4 contributed at 19 Jul 2008. I have found some problems with it: 1. It's not a full setup, but I had an older version "2.1d with all fix (cpedit)", so I could use Winmerge and find a solution. 2. it was impossible to install until I had to change SQL to full insert syntax, because mysql could not accept '' as the first parameter in VALUES list and I had to explicitly specify column list, i.e. replace all insert entries like this: "INSERT INTO `".TABLE_CONFIGURATION."` VALUES ('', 'Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs? This is a global setting and will turn them off completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')" ); with this: "INSERT INTO `".TABLE_CONFIGURATION."` (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES ('Enable SEO URLs?', 'SEO_ENABLED', 'true', 'Enable the SEO URLs? This is a global setting and will turn them off completely.', GROUP_INSERT_ID, ".$x.", NOW(), NOW(), NULL, 'tep_cfg_select_option(array(''true'', ''false''),')" ); 3. Someone says it does not work in Windows. It works, at least the version I have installed. You need to edit your Apache httpd.conf to allow overrides like this: <Directory /> ... AllowOverride All </Directory> 4. At this point everything works, except I get national characters in the URL (I have 3 languages installed, one of them is russian) To solve this problem I combined "2.1d with all fix (cpedit)" version with 19 Jul 2008 version in order to have an ability to specify SEO URLs by hand in admin. The problem is that it removes dashes (-) from the URL and URL becomes myexcellentproduct-p-333.html instead of my-excellect-product-p-333.html where "my-excellect-product" is the product's URL specified by hand in admin/categories page. Maybe someone has some suggestions about this? BTW, oscommerce all pages I have encoded in UTF-8, but in URLs I get 2 national characters instead of 1. Is it browser problem or mine one?
  11. The problem is that all cyrillic characters are replaced by questions marks, so I can see only ???? instead of the descriptions.
  12. It's not an OSC problem, but anyway... When I save Excel file as .txt I'm losing russian characters, instead I get question marks. Any ideas what to use to get the correct file?
  13. I have problems importing data from a file using Easy Populate: I have 3 languages on my store and descriptions don't import into the right database table columns. I have looked at the code, so there is a question: why developers chose cryptic column names for importing like v_products_name_x, where 'x' is a number? column name could be like 'v_products_name_<language iso code>', e.g., v_products_name_en for english, v_products_name_ru, for russian. Maybe it's done intentionally, to get some profit from paid support :-) And by the way, Easy populate cannot be used when 'register_globals' is off, I had to modify it to work when 'register_globals=off' regards, Aldevinas
  14. by the way I had to change "E-Mail Linefeeds" in /admin/ page "my store/e-mail options" to CRLF in order to not get errors from smtp server...
  15. I had a problem on OpenBSD server with OSC not sending emails. So I have modified /includes/classes/email.php. It seems it works, thought it may not work for you... I'm not an experienced php programmer, so feel free to modify my code. I've added another Email transport method which in fact always uses smtp server and can be used both in Windows and *nix systems, even though I named it "smtp_unix". Here is a little How to: set/update email configuration settings in the database: execute the following SQL sentences from phpmyadmin or other tool: INSERT INTO `configuration` ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES ( '', 'smtp server address', 'SMTP_SERVER_ADDRESS', 'your.smtp.server', 'set smtp server address to be used when server type is set to smtp_unix', '12', NULL , NULL , '0000-00-00 00:00:00', NULL , NULL ); UPDATE `configuration` SET `sort_order` = NULL , `use_function` = NULL , `set_function` = 'tep_cfg_select_option(array(\'sendmail\', \'smtp\',\'smtp_unix\'),' WHERE `configuration_key` = 'EMAIL_TRANSPORT'; Paste the following code right before function send(...) in the file /includes/classes/email.php: //smtp_unix_start /** * functions to send email via smtp server under *unix, need to set SMTP_SERVER_ADDRESS value * and "Mail Transport" to "smptp_unix" in * E-Mail options section */ function sendRequest($fp, $req, $rc) { fputs($fp, "$req\r\n"); $ret = sscanf(fgets($fp), "%d"); $ret = $ret[0]; if($ret != $rc) { fputs($fp, "quit\r\n"); fclose($fp); die("Invalid response from server, $req returned $ret, expected $rc<br/>"); } } /* $host = smtp server to connect to $to = array of emails to send email to, ex. array("[email protected]", "[email protected]"); $from = single email of sender, goes into From header, and is sent as the mail from: $headers = array of headers, in the form of array("header" => "value") $msg = the message $attachments = array of paths to files to be attached, can be left out */ function sendMailSmtp( $from, $to, $subject, $msg, $headers) { $host=constant('SMTP_SERVER_ADDRESS'); // $host='localhost'; //$to=array('"tester" <tester@localhost>'); $heloFrom = $_SERVER['SERVER_NAME']; $content=''; $content.=$headers; $content.='Subject: '.$subject.$this->lf; // $content .= "Content-Type: text/html; charset=\"iso-8859-1\"\r\n"; // $content .= "Content-Transfer-Encoding: 8bit\r\n\r\n$msg\r\n\r\n"; $content.=$this->lf.$msg.$this->lf.$this->lf; if (is_string($to)) $to=explode(',', trim($to)); $to = array_chunk($to, 5); if (!is_array($to)){ $to=array($to); } foreach($to as $batch) { $fp = fsockopen($host, 25, $errno, $errstr, 60); if(!$fp) die("Connection failed to $host:$port: ($errno) $errstr<br/>"); do { $res = fgets($fp); } while($res[3] == "-"); $this->sendRequest($fp, "HELO $heloFrom", 250); $this->sendRequest($fp, "MAIL FROM: $from", 250); foreach($batch as $rcpt){ $this->sendRequest($fp, "RCPT TO: $rcpt", 250); } $this->sendRequest($fp, "DATA", 354); $this->sendRequest($fp, $content."\r\n.", 250); $this->sendRequest($fp, "QUIT", 221); fclose($fp); } return true; } //smtp_unix_end Add the following code in the send() member function after "if (EMAIL_TRANSPORT == 'smtp')", so it looks like this: ..... if (EMAIL_TRANSPORT == 'smtp') { // ini_set('SMTP', SMTP_SERVER_ADDRESS); return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this->lf . implode($this->lf, $this->headers) . $this->lf . implode($this->lf, $xtra_headers)); } elseif (EMAIL_TRANSPORT == 'smtp_unix') { //smtp_unix method, though it may be used under Windows too return $this->sendMailSmtp($from_addr, $to_addr, $subject, $this->output, implode($this->lf, $this->headers) . $this->lf .'From: ' . $from . $this->lf . implode($this->lf, $xtra_headers)); } ....... I have also modified the beginning of the member function send() so it looks like this: function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '') { $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : '<'.$to_addr.'>');//A.K.: it seems some servers don't like address with no <> $from = (($from_name != '') ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr); It seems that some smtp servers don't accept recipient address in plain email like '[email protected]', they require '<[email protected]>', but I have no idea why, so if you modify it like me, it may stop working...
×
×
  • Create New...