Jump to content

sinopia

Members
  • Content count

    180
  • Joined

  • Last visited

1 Follower

Recent Profile Visitors

3,768 profile views
  1. sinopia

    PayPal App for osCommerce Online Merchant

    Hi, @BrockleyJohn sorry just to answer now. I might figure this out but still... moved the code on paypal_standard.php to function before_process() { and seems almost to work, just can't get the variable $order_products_id or $order->products[$i]['orders_products_id'] (that helps me to get the correct product id attributes). $order_products_id is created on confirmation with tep_db_insert_id() but doesn't get to before_process(). As you said "you don't know which will execute first, ipn or checkout_process" I'm trying to use this at mail manager addon as it sends all the mails from order confirmation. Thank you for your help.
  2. sinopia

    PayPal App for osCommerce Online Merchant

    Hi @BrockleyJohn Let's say I run this on checkout_process.php <?php for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { // denuz text attr $attr_q = tep_db_query("select * from customers_basket_text_attributes where session_id = '" . tep_session_id() . "' and products_id = '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "'"); //$attr_q = tep_db_query("select * from customers_basket_text_attributes where customers_id = '" . $customer_id . "' and products_id = '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "'"); while ($attr = tep_db_fetch_array($attr_q)) { tep_db_query("insert into orders_text_attributes (`orders_id`, `products_id`, `products_text_attributes_id`, `products_text_attributes_text`, `orders_products_id`) values ('" . $insert_id . "', '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "', " . $attr['products_text_attributes_id'] . ", '" . addslashes($attr['products_text_attributes_text']) . "', '" . $order_products_id . "')"); } //tep_db_query("delete from customers_basket_text_attributes where products_id = '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "' and customers_id = '" . $customer_id . "'"); tep_db_query("delete from customers_basket_text_attributes where products_id = '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "' and session_id = '" . tep_session_id() . "'"); // eof denuz text attr } ?> Gets from the customers basket and insert into when the order in finished, that way to associate with a order number. As in PayPal options I got this: If Auto Return for Website Payments is enabled in your PayPal Profile account settings, the following URL must be used as the Return URL: https://www.myoscommercewebsite.com/checkout_process.php That's why I can't figure out why it's not working only for PayPal. As you've explained about also the IPN, I just needed a workaround to run this correctly for PayPal. Will move this for the mail manager when it sends the mail to customers. I'm also asking as my website is currently live with many products being ordered and some users is paying with PayPal and each order I've to check in PhpMyAdmin the inputs that was being left on the shopping cart.
  3. sinopia

    PayPal App for osCommerce Online Merchant

    Hi @BrockleyJohn thank you. The code was on paypal_standard module and it was saving for example order_id = 47128 and order_product_id = 74462 but the order with confirmed payment is 47129 and order_products_id is 74463 All the orders using PayPal get twice commentes in the order, both status is PayPal [Transactions] but between them is the customer notificated with the status I choice when the payment is receive. The first comment has Source: IPN and then seconds doesn't have that, the rest is equals in both. This is so confusing. In application_top case 'add_product' it inserts the uprid of the product (attributes), customer_basket_id, customer_id and tep_session. In the checkout's it gets that data and insert into a new table with the order_id and the respective product (orders_products_id) and deletes from the table of customers_basket. Should I have the code in both files? By the way thanks for you help.
  4. sinopia

    PayPal App for osCommerce Online Merchant

    By the way should I set the code in checkout_process.php to run for all methods payments except paypal? It should run only at standard_ipn.php.. as checkout_process seems to run first then standard_ipn it could run the code there as it insert in orders and deletes from basket?
  5. sinopia

    PayPal App for osCommerce Online Merchant

    About the session_destroy I've saw that it's not needed anymore: https://github.com/gburton/CE-Phoenix/blob/master/ext/modules/payment/paypal/standard_ipn.php Will replace this. The only issues now is about the save some custom attributes with the correct order id. Does anyone knows how to fix this?
  6. sinopia

    PayPal App for osCommerce Online Merchant

    Hi @BrockleyJohn I'm still having this issues. I left the code in checkout_process.php to insert into database but still was getting +1 order so I moved it into standard_ipn.php inside for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { to see if it recognizes now. I guess on the checkout_process.php it was working unless the correct order_id. I use this code: tep_db_query("insert into orders_text_attributes (`orders_id`, `products_id`, `products_text_attributes_id`, `products_text_attributes_text`, `orders_products_id`) values ('" . $insert_id . "', '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "', " . $attr['products_text_attributes_id'] . ", '" . addslashes($attr['products_text_attributes_text']) . "', '" . $order_products_id . "')"); Works fine for all others except the PayPal orders. Waiting for a PayPal order to see if it works. Other issues I've found in error_log is this: [03-Mar-2020 15:50:17 Europe/Lisbon] PHP Warning: session_destroy(): Trying to destroy uninitialized session in /home/xxxxxx/public_html/includes/functions/sessions.php on line 149 Happens everytime that I order from PayPal is received. Is this any bug while PayPal confirms the payment in osCommerce? It seems the standard_ipn.php has only tep_session_destroy(); Best regards.
  7. sinopia

    PayPal App for osCommerce Online Merchant

    Hi @BrockleyJohn Thank you for your explanation. I've only the code at checkout_process.php now. As it was running the code at paypal_standard it was recording as the old order id as the payment was not confirmed yet. I've Auto Return enabled for checkout_process.php so after confirming the payment it returns to my website after finishing the payment, at least what I see in the logs: XXX.XX.XXX.XXX - - [06/Feb/2020:22:26:33 +0000] "GET /checkout_process.php?amt=XX.XX&cc=EUR&cm=XXXXX&st=Completed&tx=XXXXXXXXXXX HTTP/2.0" 302 20 "https://www.paypal.com/webapps/hermes?token=XXXXXXXXXX&useraction=commit&rm=X&mfid=XXXXXXXXXXXXXXX" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36" The referer comes directly from paypal so it should work. I'll see in the next order if this is working as it should. Thank you very much. Best regards.
  8. sinopia

    PayPal App for osCommerce Online Merchant

    I've commented the code from paypal_standard.php and leave the code at checkout_process.php. From the logs the PayPal orders goes through checkout_process so probably there should be the correct order id variable.. I'll test to see if it works.
  9. sinopia

    PayPal App for osCommerce Online Merchant

    Hello. I need a little help fixing some code that saves some customized text attributes in each product in the order, if inserted... It works for all orders and payments except PayPal Standard orders.. It saves the attributes at checkout_process.php, but seems that PayPal deletes the order created and generates a new this way: $order_id = substr($cart_PayPal_Standard_ID, strpos($cart_PayPal_Standard_ID, '-')+1); I need to save order_id and also orders_products_id. The current code I got in checkout_process.php (also at paypal_standard.php) is this: tep_db_query("insert into orders_text_attributes (`orders_id`, `products_id`, `products_text_attributes_id`, `products_text_attributes_text`, `orders_products_id`) values ('" . $insert_id . "', '" . $order->products[$i]['id'] . "', " . $attr['products_text_attributes_id'] . ", '" . $attr['products_text_attributes_text'] . "', '" . $order_products_id . "')"); The variables $insert_id and $order_products_id gets -1 from what is correct and final order id. I've added at the paypal_standard.php but it seems that it does the same as checkout_process.php but I've saw at the logs, that after the payment paypal page redirects to checkout_process.php and then receive a POST in standard_ipn.php from PayPal and then checkout_sucess.php. Can this be caused because of the code at paypal_standard.php? Should it be only at checkout_process.php or should I user variable $order_id instead $insert_id? By the way if someone could explain how the paypal standard works, for example what files does what and what are they segment.. So I could understand and least where to fix this. Because I've already saw this at logs: 1º checkout_process.php?amt=...&cc=...&cm=...&st=...&tx=... 2º checkout_sucess.php 3º standard_ipn.php (sometimes is checkout_sucess.php the last - maybe some delay?) Best regards
  10. sinopia

    PayPal App for osCommerce Online Merchant

    By the way order_confirm.php is send mails using PHPMailer. The line 17 is: for ($i=0, $n=sizeof($order_totals); $i<$n; $i++) { I've added this before because I weren't recognizing order variable: // Fix for paypal_standard.php - $order_id and checkout_process.php uses $insert_id if (strpos($order->info['payment_method'], 'PayPal') !== false) { $insert_id = $order_id; } Is someone has this issues or could know what can be causing this I would really appreciate any help. Also what is going on with session_destroy()? Should the application_top.php create or recreate and application_bottom.php destroy? Line 162 is: return session_destroy(); // from function tep_session_destroy() { Best regards.
  11. sinopia

    PayPal App for osCommerce Online Merchant

    Hello. I've seeing this at error_log: [10-Nov-2019 18:41:29 Europe/Lisbon] PHP Warning: sizeof(): Parameter must be an array or an object that implements Countable in /home/x/public_html/includes/modules/mail_manager/order_confirm.php on line 17 [10-Nov-2019 18:41:29 Europe/Lisbon] PHP Warning: session_destroy(): Trying to destroy uninitialized session in /home/x/public_html/includes/functions/sessions.php on line 162 I'm using the last app from paypal. This seems to happen in checkout_success.php while GET request from paypal.com/webapps... Checked at logs and it was at the same exact time. Using PHP 7.3, I'm aware that sizeof could get some warning in PHP7.3 and saw that in some cases count() should be used. Sometimes paypal recreate a new order id, I'm not sure if this happens in all osCommerce stores but in my case some paypal orders became +1 (order 1234 will become 1235 for example). Could it accessing the old order variable and as it doesn't exists cause this warning? Best regards.
  12. sinopia

    ezsocial login sessions problems

    Replace the function to use openssl_encrypt/decrypt instead of mcrypt and seems everything to work. If anyone need to substitute pm me. Will check now if the warning about sessions keep showing.
  13. sinopia

    ezsocial login sessions problems

    Seems that the files login_with_facebook.php and others had twice application_top.php requires.. Only requires if ($success), so disabled that and put it on the top, seems to fix it. Now got this: Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /home/x/public_html/oauth/functions.php:14 Stack trace: #0 /home/x/public_html/login_with_facebook.php(113): mc_encrypt('ezsocial|262058...', 'c8e0c24452f4178...') #1 {main} thrown in /home/x/public_html/oauth/functions.php on line 14 Will try to change the functions from ezsocial to use openssl. As it's not a good idea to compile mcrypt as it's deprecated.
  14. sinopia

    ezsocial login sessions problems

    Added require('includes/application_top.php'); and seems to fixed the sessions issues.. now I got: Fatal error: Cannot redeclare do_magic_quotes_gpc() (previously declared in /home/x/public_html/includes/functions/compatibility.php:18) in /home/x/public_html/includes/functions/compatibility.php on line 29 Mine compatibility.php is the same as this: https://github.com/gburton/CE-Phoenix/blob/master/includes/functions/compatibility.php I'll check if it's active on cPanel.. Another issue related with sessions.. at database I got 622940 records, it seems that is logging some session records.. Should it not removed as customers logout or the session expires?
  15. Hello I've upgraded into 7.3 and seems to be all ok, I got a 2.3.4 template but I've been updating some code from CE-Phoenix some functions and code to be recent (a lot core modifications that would require a lot to upgrade all to CE-Phoenix) But while login with facebook/google/etc with ezsocial login I'm getting this warnings: Warning: session_set_save_handler(): Cannot change save handler when session is active in /home/x/public_html/includes/functions/sessions.php on line 65 Warning: session_name(): Cannot change session name when session is active in /home/x/public_html/includes/functions/sessions.php on line 142 Warning: session_save_path(): Cannot change save path when session is active in /home/x/public_html/includes/functions/sessions.php on line 167 Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in /home/x/public_html/includes/application_top.php on line 172 Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "navigationHistory" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /home/x/public_html/includes/application_top.php on line 348 The normal sessions like login/login seems to work fine and keeps the products etc. It's just while trying to login with facebook for example. Should the files login_with_facebook.php missing application_top for the sessions part? I've getting more warnings and errors like: [29-Oct-2019 10:16:58 Europe/Lisbon] PHP Warning: session_destroy(): Trying to destroy uninitialized session in /home/x/public_html/includes/functions/sessions.php on line 149 [29-Oct-2019 10:27:19 Europe/Lisbon] PHP Warning: session_set_save_handler(): Cannot change save handler when session is active in /home/x/public_html/includes/functions/sessions.php on line 65 [29-Oct-2019 10:27:19 Europe/Lisbon] PHP Warning: session_name(): Cannot change session name when session is active in /home/x/public_html/includes/functions/sessions.php on line 142 [29-Oct-2019 10:27:19 Europe/Lisbon] PHP Warning: session_save_path(): Cannot change save path when session is active in /home/x/public_html/includes/functions/sessions.php on line 167 [29-Oct-2019 10:27:19 Europe/Lisbon] PHP Warning: session_set_cookie_params(): Cannot change session cookie parameters when session is active in /home/x/public_html/includes/application_top.php on line 177 [29-Oct-2019 10:27:19 Europe/Lisbon] PHP Fatal error: Uncaught Error: Call to undefined function mcrypt_get_block_size() in /home/x/public_html/oauth/functions.php:14 Stack trace: #0 /home/x/public_html/login_with_facebook.php(113): mc_encrypt('ezsocial|262......', 'c8e0...........') #1 {main} thrown in /home/x/public_html/oauth/functions.php on line 14 [29-Oct-2019 10:46:33 Europe/Lisbon] PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in /home/x/public_html/includes/functions/sessions.php on line 106 [29-Oct-2019 10:46:38 Europe/Lisbon] PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in /home/x/public_html/includes/functions/sessions.php on line 106 [29-Oct-2019 10:49:59 Europe/Lisbon] PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in /home/x/public_html/includes/functions/sessions.php on line 106 [29-Oct-2019 10:50:03 Europe/Lisbon] PHP Warning: session_start(): Failed to decode session object. Session has been destroyed in /home/x/public_html/includes/functions/sessions.php on line 106 [29-Oct-2019 10:55:24 Europe/Lisbon] PHP Warning: require(includes/languages/.php): failed to open stream: No such file or directory in /home/x/public_html/includes/application_top.php on line 334 Seems that mcrypt is deprecated since PHP 7.1.. and to use openssl instead, but it's also possible to use mcrypt it but not recommended. But should that been causing this issue with sessions? Best regards
×