Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

cinolas

Members
  • Posts

    288
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by cinolas

  1. I'm using this one: https://apps.oscommerce.com/Get&amp;xy0S8&amp;JuIEu But I changed the bottom half of the update_status() function. On line 55 of /includes/modules/payment/free.php: // Enable the module if the order total is equal or less than the Gift Voucher balance // Added test to see if there's enough Gift Voucher balance to cover the entire order. If so, hide the Gift Voucher checkbox, if not hide the Free payment module and show the checkbox if (tep_session_is_registered('customer_id')) { $gv_query = tep_db_query("select amount from coupon_gv_customer where customer_id = '" . tep_db_input($_SESSION['customer_id']) . "'"); $gv_result = tep_db_fetch_array($gv_query); } if ($order->info['total'] > $gv_result['amount']) { $this->enabled = false; } And then I changed line 27 of /includes/modules/order_total/ot_gv.php from: $this->checkbox = $this->user_prompt . '<input type="checkbox" onClick="submitFunction()" name="' . 'c' . $this->code . '">'; to: // Added test to see if there's enough Gift Voucher balance to cover the entire order. If so, hide the Gift Voucher checkbox, if not hide the Free payment module and show the checkbox if (tep_session_is_registered('customer_id')) { $gv_query = tep_db_query("select amount from coupon_gv_customer where customer_id = '" . tep_db_input($_SESSION['customer_id']) . "'"); $gv_result = tep_db_fetch_array($gv_query); } If ($order->info['total'] > $gv_result['amount']) { $this->user_prompt = MODULE_ORDER_TOTAL_GV_USER_PROMPT; $this->checkbox = $this->user_prompt . ' (' . $currencies->format($gv_result['amount']) . ')&nbsp;<input type="checkbox" onClick="submitFunction()" name="' . 'c' . $this->code . '">'; } else { $this->user_prompt = ''; $this->checkbox = $this->user_prompt . '<input type="hidden" value="0" name="' . 'c' . $this->code . '">'; }
  2. @Jack_mcs! So I've been working on making this work for my purpose, and I think I (we, with the help of ecartz) found a process that would work even better for your contribution as a whole: I've modified my files so that the "Apply Gift Voucher Balance" checkbox only shows up on checkout_payment.php if there's not enough to pay for the entire order. If there IS enough to pay for the entire order, a modified version of the Free payment module shows up instead, but the label reads "Pay with my Gift Voucher balance". To the user, the Gift Voucher balance shows up as a payment method (that allows $0 orders) if they have enough to cover the order. Or as an additional checkbox, so that they can both apply their Gift Voucher balance AND select a payment method for the remainder. Slick! Wouldn't this be a nice addition to the next version?
  3. @Jack_mcs You spend so much time providing free support for countless contributions + Phoenix etc... You should have a PayPal donate button, or a BitCoin address, so that grateful newbs like me can thank you for your time and dedication. If you do setup something, please let me know. In the meantime, ALL THE THANKS TO YOU!
  4. @Jack_mcs I could not agree more, this is definitely beyond the scope of support. I just thought I'd ask in case it was obvious and easy to answer. I already posted in the general thread as well. You've already been very helpful (for years!). Is there somewhere I can send you some $ as tip? NOT to get you to help me with these future modifications, but for your past help.
  5. Don't laugh, I'm trying: Looking at checkout_process.php around line 87 it goes: $payment_modules->update_status(); if ( ($payment_modules->selected_module != $payment) || ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL')); } require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; $order_totals = $order_total_modules->process(); // load the before_process function from the payment modules $payment_modules->before_process(); I'm thinking that's where the logic to refuse total = $0 orders is. What if I was to modify it to something like this (but, you know, with proper syntax and such): if ($order->info['total'] > 0) { $payment_modules->update_status(); } if ( ($payment_modules->selected_module != $payment) || ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) { if ($order->info['total'] > 0) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL')); } } require(DIR_WS_CLASSES . 'order_total.php'); $order_total_modules = new order_total; $order_totals = $order_total_modules->process(); // load the before_process function from the payment modules if ($order->info['total'] > 0) { $payment_modules->before_process(); } First suppressing the redirect, and then adding IFs everywhere to prevent the payment part from being invoked when the order total is $0? I'm not sure if ($order->info['total'] > 0) is valid syntax here... I'm not sure how to get the new order total after the Gift Voucher balance has been applied.
  6. Or could the checkout confirmation process be changed to allow orders that have a total of $0 without invoking the payment method?
  7. Good idea. That payment module is a copy of the COD module that only shows up when $order->info['total'] = 0 Obviously, the total isn't 0 when the user gets to the payment page, since they have not applied their Gift Voucher balance to the order yet. But osC still allows the user to move on to checkout_confirmation.php, it's only when they click Confirm that they are sent back to checkout_payment.php... SO, I'm thinking there could be a quick way to change the selected payment module to the Free module when loading checkout_confirmation.php if the total at that point is = 0 I am, however, not quite sure how to do that 😔or even where I should try to add this tweak. Somewhere in checkout_confirmation.php, or perhaps in /includes/classes/payment.php? Any hints is gold, I am out of my depths here, sadly. But willing to learn!
  8. Thanks @Jack_mcs I have looked at the FAQ, the difference between coupons and vouchers weren't obvious at first. I'm getting acquainted with the concepts One problem I'm still having is that the user MUST enter a payment method for checkout to work, even if they have enough balance in their Gift Voucher account. The FAQ makes it sound like they should only have to enter a payment method if they don't have enough in their Gift Voucher account. If I don't enter a payment method but click the checkbox to use my balance I am sent to the order confirmation page, but then when I click the Confirm button there, it sends me back to the payment page with the message: Please select a payment method for your order. I'm assuming this isn't normal? The amount is correctly attributed to the order on the confirmation page, so I doubt that the problem is about fetching the balance. This is I believe the relevant part of my checkout_confirmation.php page, that part is identical to the Version_2.3.4/ChangedFiles/checkout_confirmation.php: // load the selected payment module require('includes/classes/payment.php'); // Begin Gift Vouchers Secure if ($credit_covers) $payment=''; $payment_modules = new payment($payment); require_once('includes/classes/order_total.php'); // End Gift Vouchers Secure require('includes/classes/order.php'); $order = new order; // Begin Gift Vouchers Secure $order_total_modules = new order_total; $order_total_modules->collect_posts(); $order_total_modules->pre_confirmation_check(); // if ( ($payment_modules->selected_module != $payment) || ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) { if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) { // End Gift Vouchers Secure tep_redirect(tep_href_link('checkout_payment.php', 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL')); } if (is_array($payment_modules->modules)) { $payment_modules->pre_confirmation_check(); } // load the selected shipping module require('includes/classes/shipping.php'); $shipping_modules = new shipping($shipping); // Begin Gift Vouchers Secure //require('includes/classes/order_total.php'); //$order_total_modules = new order_total; //$order_total_modules->process(); // End Gift Vouchers Secure // Stock Check $any_out_of_stock = false; if (STOCK_CHECK == 'true') { for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) { $any_out_of_stock = true; } } // Out of Stock if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) { tep_redirect(tep_href_link(FILENAME_SHOPPING_CART)); } } I've also tried the code from the Version_CE/ChangedFiles/checkout_confirmation.php version but it gives exactly the same result: // load the selected payment module require('includes/classes/payment.php'); // Begin Gift Vouchers Secure if ($credit_covers) $payment=''; $payment_modules = new payment($payment); require_once('includes/classes/order_total.php'); // End Gift Vouchers Secure require('includes/classes/order.php'); $order = new order; // Begin Gift Vouchers Secure $order_total_modules = new order_total; $order_total_modules->collect_posts(); $order_total_modules->pre_confirmation_check(); // End Gift Vouchers Secure // load the selected shipping module require('includes/classes/shipping.php'); $shipping_modules = new shipping($shipping); // Stock Check $any_out_of_stock = false; if (STOCK_CHECK == 'true') { for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { if (tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty'])) { $any_out_of_stock = true; } } // Out of Stock if ( (STOCK_ALLOW_CHECKOUT != 'true') && ($any_out_of_stock == true) ) { tep_redirect(tep_href_link('shopping_cart.php')); } } // Begin Gift Vouchers Secure //require('includes/classes/order_total.php'); //$order_total_modules = new order_total; //$order_total_modules->process(); // End Gift Vouchers Secure Any idea what could be wrong? Thanks!
  9. Thanks @Jack_mcs ! I think I understand the logic, "Gift Vouchers" are purchased as products, and then the purchaser can send the funds, or portions of, as "Coupons" to other people. Coupon Admin is meant to manage the Coupons, but there's no interface to manage the Gift Vouchers? For my application, I would need to be able to edit the Gift Vouchers for when customers call in their order by phone and pay with their own Gift Vouchers (we expect some customers will use vouchers as a form of lay-away). Is there no way to do this with the current interface? Cheers
  10. @Jack_mcs thanks, I'm looking into that now. Since one is going out fine but not the other, I expect they are not being sent the same way. I found the solution to the balance not showing up on the /account.php page. Line 45 of /Version_CE/NewFiles/includes/modules/content/account/cm_account_gift_vouchers.php reads: if (tep_session_is_registered(customer_id)) { For me, it only works if I put the customer_in in single quotes like this: if (tep_session_is_registered('customer_id')) { Are vouchers that have been purchased by customers as product, then released from the Gift Voucher queue, supposed to show up in coupon_admin.php? I'm a bit confused in the difference between coupons and vouchers, if there is one. As always, thanks enormously for the support.
  11. I might be wrong about the emails not going out. I just got the email of my test customer sending a portion of the voucher, so that emails goes out fine. Does the contribution not send an email to the customer when you release the voucher? that one I did not get.
  12. Hmmmm there are apparently other problems with my installation: I created a product to sell $25 vouchers, that worked. I purchased one with my test customer. The voucher showed up in the queue to be released, but it didn't show up in Coupon Admin after being released, and the customer balance still says No Balance even after being released. The voucher is there in the SQL tables, and osC will let me send it, or use the balance to purchase. I tried sending $15 of it, and the portion I sent showed up in Coupon Admin, but not the unsent portion ($10). The sent portion appears to be expired, it only shows up in Coupon Admin for the status "All Coupons" and "Expired Coupons". Here's the info it gives me in Coupon Admin for the sent portion: Does it require a date? is that why this one is being considered expired? Any idea how I can get the unsent portion to show up too? Trying to debug why the balance isn't showing on the Account page: I found these lines in /includes/modules/content/account/cm_account_gift_voucher.php $availBalance = CCGV_BALANCE_NONE ; if (tep_session_is_registered($customer_id)) { $gv_query = tep_db_query("select amount from coupon_gv_customer where customer_id = '" . tep_db_input($_SESSION['customer_id']) . "'"); $gv_result = tep_db_fetch_array($gv_query); if ($gv_result['amount'] > 0 ) { $availBalance = CCGV_BALANCE . ' ' . $currencies->format($gv_result['amount']); } I ran the query directly on my SQL tables, manually substituting my test customer ID and it returned the amount I was expected (the unsent portion of $10). So the second IF should've worked. Could it be tep_db_input($_SESSION['customer_id']) that's failing to return my logged-in customer id? There were no clues in my php error log. Thanks again! I think I'm pretty close to it working I would be lost without your insights.
  13. Come to think of it, @Jack_mcs, I might have added the totals to the checkout_payment.php page myself, just to show the totals to the customer as they choose a payment method. I probably copy-pasted the line from another checkout_x page. Is there a better way to do this that would not cause the order_class to be redeclared? It's not vital, but I would really like to keep showing the totals on that page. On a completely different note (I'm testing other aspects of this contribution): the gift voucher emails are being sent using, as far as I can tell, the send() function: send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, TEXT_REDEEM_COUPON_SUBJECT ); send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', EMAIL_FROM, TEXT_REDEEM_COUPON_SUBJECT ); Is there a simple way to change that so it uses the tep_mail() function in /includes/functions/general.php? My tep_mail() function has been customized to use Postmark to send emails, and my server configured to block other attempts, so the gift voucher emails are not being sent. Thanks!
  14. @Jack_mcs, it's in my /includes/classes/order_total.php
  15. My php error log says: Line 13 is: class order_total { I am not sure why it has already been declared by the time that class file gets summoned. Any idea where else it might be declared? or where else this class file might be invoked ahead of this instance? Cheers!
  16. Thanks @Jack_mcs that helps greatly! And I was sitting here trying to figure out how to get that script in the <head> section, but apparently javascript can be anywhere on the page lol I added the javascript and finished following the instructions the best I could, but it gave me the same result: the checkout_payment.php page ends unexpectedly after the billing address. It's the line that summons to the subtotals and totals that causes problem: <?php echo $oscTemplate->getContent('payment'); ?> If I comment it out the page renders normally. Does that shed any light as to where my problem might be? a problem in order_total.php? My order_total.php file validates, and the modifications for that file are the same in the CE and RC2 instructions. Thanks!
  17. Hi @Jack_mcs! Thanks for bringing this contrib up to date. I'm trying to install it on osC 2.3.4 BS GOLD. I believe I already have modular checkout installed, from installing the "Pay Without Account" contrib? (Otherwise how do I check if I have modular checkout?) I understand that there are no instructions and that I should compare the files. It's a bit difficult because my files are extensively modified already, but I'm certainly willing to try. I wouldn't mind compiling instructions for 2.3.4 BS GOLD if we can figure this out. I decided to give the provided Version_2.3.4 instructions a try. From the package: - Use the new files from the CE install - Use the CE install instructions until the checkout_xx pages, then switch to the RC2 instructions for those. (I haven't tried the new files in the Version_2.3.4 folder since it says to use the new files from the Version_CE folder... should I try the Version_2.3.4/NewFiles/ ?) The CE/RC2 instructions seem to line up pretty well. I did up to checkout_process.php in the CE installation instructions, then switched to the RC2 instructions for checkout_process.php, then came back to the CE instructions for create_account.php and logoff.php, then went back to the RC2 instructions for checkout_confirmation.php and checkout_payment.php Like @aaymont above, I get to the part of the RC2 instructions that ask me to find "var selected;" in checkout_payment.php, which is not present in my version of the files. The CE instructions just don't have that bit. My checkout_payment.php looks most like the CE version (it has the require template_top line instead of the actual <head>) but I'm supposed to use the RC2 instructions for checkout_x pages. I see that the point of that step is to add the submitFunction to the <head>: var submitter = null; function submitFunction() { submitter = 1; } Should I add this (and the popupWindow(url) function) to template_top.php instead? My template_top.php doesn't have a "var selected;" either but I can just add the function somewhere. Or is this just not required for my version like for CE (the instructions for CE don't seem to be adding those functions anywhere). In the RC2 instructions there are modifications to account.php that come after the confirmation_x pages. I'm not sure if I'm supposed to do those since there are no modifications to those pages in the CE instructions, and if I understand correctly, I'm only supposed to do the RC2 instructions for checkout_x pages. Should I try the CE instructions all the way through (not using the RC2 instructions)? Any hints at this point would be great help as I would like to avoid, if possible, manually trying all the permutations Comparing files is difficult because my files don't seem to fit any of the 3 sets of ChangedFiles provided, so I'm not sure what version to compare my files against. THANK YOU!
  18. Greetings! I'm using the PayPal App 5.018 on osC 2.3.4 BS GOLD and it's working BUT I'm seeing a lot of errors in the PayPal App log, and I am getting complaints that it's not working for some of my customers. Of course, when I test it myself, it works fine. One customer said that when she finished the process on PayPal, it brought her back to the very beginning of the checkout process. She tried again and got the same result. So she gave up on it, then came back a half hour later to try again and it worked. On the same device, same browser, etc. In my PayPal App log I see a lot of failed transactions and they seem to have something in common: no response. The Response section, when you click on the View button, is empty. No labels for data, just the header. Is that supposed to be this way? or does this indicate that I'm simply not getting a response from PayPal? The docs for the PayPal App don't mention. In one instance, for one specific customer, I see 2 failed SetExpressCheckout for her, then a successful one, then a successful GetExpressCheckoutDetails followed by 2 failed DoExpressCheckoutPayment, and finally a successful DoExpressCheckoutPayment... All from the same IP in a period of 15 minutes. It looks like it kept on failing on her, but she kept on trying and finally got through. There's nothing specifically relevant in my php error log. I found a "Invalid argument supplied for foreach() in hooks.php on line 56" which I fixed. The hooks.php file I was using was apparently from the PayPal App bundle and was missing an "array" on line 56. Could this have been causing the PayPal App problems? What else can I do to troubleshoot this, given that there's no clues in the Response part of the log to go on? Thanks!
  19. Well. Again. Replacing the WHILE with a FOREACH actually did solve the problem. (I still don't understand why though) I swear I tried it like 3 times, since I remembered that had fixed my problem before I guess I had not done so properly. My apologies for all the posts. Problem solved. Moving on. Thanks!
  20. I also posted this question on Stackoverflow since it's probably not osCommerce specific (but I could very well be wrong): https://stackoverflow.com/questions/63853909/how-do-i-debug-this-bit-of-php-and-sql-that-queries-for-an-array-lists-it-and-p
  21. Thanks again @raiwa! I had the hooks installed properly. Turns out my problem was that my shopping_cart wasn't modularized. So I installed the modular shopping cart and things seem to be working a bit better now. The variables MODULE_CONTENT_SC_PRODUCT_LISTING_QTPRO_CART_BUTTON_UPDATE and MODULE_CONTENT_SC_PRODUCT_LISTING_QTPRO_CART_BUTTON_REMOVE needed to be defined in includes/languages/english/module/content/shopping_cart/cm_sc_product_listing_qtpro.php. (They weren't there already for some reason.) Now, the only problem left is that the modular shopping cart isn't showing the attributes anymore. Just the dashes, no attribute text. I'm using the stock cm_sc_product_listing_qtpro so I doubt that's the problem. I've had this issue before, and posted about it earlier in this thread. Back then I fixed the issue (though not knowing how or why it worked) by using FOREACH instead of WHILE, but that fix doesn't seem to be working anymore. What else could be causing empty attributes in the shopping cart? Any ideas? Cheers!
  22. Sorry, should've looked harder... I found the definition in qtpro_hooks.php so I'm guessing the hook isn't happening. I will investigate, but any tips you may have is greatly appreciated.
  23. I found this error in my logs: [09-Sep-2020 06:10:38 America/Vancouver] PHP Fatal error: Call to undefined function check_stock_qtpro() in /chroot/home/roller/rollergirl.ca/html/skateshop/shopping_cart.php on line 101 That looks like a good reason for my shopping_cart to fail lol. In which file should this function be defined?
  24. Thanks for looking @raiwa! I understand that Gold isn't supported anymore and I appreciate you taking the time to help. I tried again this morning and got the same result, but I dug a little deeper to try and understand what is happening wrong. I tried using the provided modified shopping_cart.php and it gave me the same result. How do I turn on error reporting? I'm sure that would help (I didn't even know that was a thing!) My shopping_cart page stops after: <table class="table table-striped table-condensed"> <tbody> So it looks like the problem occurs while building the $products_name variable... Cheers!
×
×
  • Create New...