Latest News: (loading..)

Remulon

Members
  • Content count

    50
  • Joined

  • Last visited

About Remulon

Profile Information

  • Real Name
    Remo
  1. Hi all, this is a correction to my hack from before.. THIS IS VERY IMPORTANT!!!! FILE #1: catalog/checkout_confirmation.php you ONLY have to comment out the four lines as I have below: (In my installation these are lines 185-189) //if (isset($$payment->form_action_url)) { // $form_action_url = $$payment->form_action_url; //} else { $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); //} echo tep_draw_form('checkout_confirmation', $form_action_url, 'post'); if (is_array($payment_modules->modules)) { echo $payment_modules->process_button(); } echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n"; if you leave this as I have in my earlier post, no details will come through for credit card payments etc.
  2. Thanks for replying Satish, Nevermind about expert hackers making me think that the amount was paid, because if their funds are not received, their order is declined. So the new contribution of PayPal saves the order before sending the customer away for payment processing? Because that would be exactly what I am looking for! Please advise. Thanks. Remo
  3. Ok, here is what I have come up with... Firstly, this hack works for me for paypal payments, and the only downside is that the customer's cart is retained, and not cleared like it should be. The upside is that I only had to modify 3 files to get this to work: FILE #1: catalog/checkout_confirmation.php comment out the following lines like I have below: (In my installation these are lines 185-197) //if (isset($$payment->form_action_url)) { // $form_action_url = $$payment->form_action_url; //} else { $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); //} echo tep_draw_form('checkout_confirmation', $form_action_url, 'post'); //if (is_array($payment_modules->modules)) { // echo $payment_modules->process_button(); //} echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n"; FILE #2: catalog/checkout_process.php add the following code: if (isset($$payment->form_action_url)) { $form_action_url = $$payment->form_action_url; echo '<body onLoad="document.payment.submit();">' . "\n"; echo tep_draw_form('payment', $form_action_url, 'post'); if (is_array($payment_modules->modules)) { echo $payment_modules->process_button(); } echo '</form>' . "\n"; echo '</body>' . "\n"; // load the after_process function from the payment modules $payment_modules->after_process(); require(DIR_WS_INCLUDES . 'application_bottom.php'); tep_exit(); } directly before this: // load the after_process function from the payment modules $payment_modules->after_process(); FILE #3: catalog/includes/modules/payment/paypal.php change this line: tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) . to be: tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL')) . That's it! Any feedback on this would be great. I realise that it probably should be put in the contributions section, but we'll see how the feedback goes first. Thanks. Remo
  4. Ok, After investigating both options in my last post, I have come to the conclusion that neither of these contributions is 100% suitable for my needs. Both of them simply create an extra set of order tables where every order is saved as a 'preliminary' order before the payment is processed. This would be ok if you only have a small amount of orders coming in every day, and if you only use third party payment processors. Because only one of my four payment options is a third party option, and I have far too many orders coming in every day, this second set of order tables would be getting filled with orders that don't really need to be there, and one of my staff would have to constantly monitor this second set of 'order holding' tables to delete the orders which have come through ok. So what I am going to do is attempt to solve the problem myself, by calling the checkout_process.php script (or part of it) before sending the customer to the third party payment processor, and then change the page that my customers will return to after processing their payment (more than likely checkout_success.php). Can anyone see any problems with my proposed solution? Or does anyone else have any suggestions to better my proposed solution? Any input is greatly appreciated. Thanks. Remo
  5. Hi again, After reading the thread a little better :blush: , I noticed that Satish mentioned an order holding contrib, so I went looking. I found these two: http://www.oscommerce.com/community/contri...h,order+holding http://www.oscommerce.com/community/contri...h,order+holding I am yet to try either of them, but once I do I will post to let you all know which way I have gone. Thanks. Remo
  6. Hi, I am having this same problem. After investigating, I have come to the following conclusion: When paying with paypal, the customer is sent to paypal before the checkout_process.php script is run. After they make their payment, if they do not return to my shopping cart, the checkout_process.php script is never run. Therefore their cart contents remain the same and we never get a notification of the order. Next time they login to their shopping cart account, they still have their last order in their basket. In the case of the "IPN functionality will make sure orders are not lost", well, this only works if the customer finishes making their payment. It seems to me that the best solution would be if the checkout_process.php script was run first, saving the order to the orders table etc. and then sending the customer to paypal for their payment. That way, if the customer makes their payment and does not return to my shopping cart, I still have their order. On the other hand, if the customer does not make their payment, we still have their order, and can send them follow up emails to attempt to have their order fulfilled. Has anyone put a solution like this in place? Or has anyone got a better solution? Thanks. Remo
  7. Hi again, It seems that I have found a way to update the price fields in the order editor from the edit_order_ajax.php file. So if anyone has the "price breaks per quantity" mod installed, here is a way you can make it work with the new version of the order editor. Here is a quick rundown, and then I'll give you the code: 1. I simply removed the html tags from my code above and left just the javascript. 2. I created a js variable "theActualResponseText" which holds the actual response text.. (funny that?) 3. I modified the file /order_editor/javascript.php to evaluate the js code which gets sent back as the response. FROM FILE: edit_orders_ajax.php //-- 2. Update the orders_products table for qty, tax, name, or model ----------------------------------------------- if ($action == 'update_product_field') { if ($_GET['field'] == 'products_quantity') { $order_query = tep_db_query("SELECT products_id, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); $orders_product_info = tep_db_fetch_array($order_query); // update inventory quantities if ($_GET['new_value'] != $orders_product_info['products_quantity']){ $quantity_difference = ($_GET['new_value'] - $orders_product_info['products_quantity']); if (STOCK_LIMITED == 'true'){ tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } else { tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } } //-- START price breaks per qty mod -- remo // this section sets the product prices correctly in the database if the quantity changes // but we need to update the input fields on the edit order as well. $pf->loadProduct((int)$orders_product_info['products_id'], $languages_id); $price_break = $pf->computePrice($_GET['new_value']); tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET products_price = '" . oe_iconv($price_break) . "', final_price = '" . oe_iconv($price_break) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); ?> var qty = '<?=$_GET['new_value']?>'; var taxRate = document.getElementById("update_products[<?=$_GET['pid']?>][tax]").value; var attValue = getAttributesPrices(<?=$_GET['pid']?>); var priceValue = '<?=$price_break?>'; var finalPriceValue = Number(attValue) + Number(priceValue); var priceInclValue = ( Number(attValue) + Number(priceValue) ) * ((taxRate / 100) + 1); var totalInclValue = ( Number(attValue) + Number(priceValue) ) * ((taxRate / 100) + 1) * qty; var totalExclValue = ( Number(attValue) + Number(priceValue) ) * qty; var taxValue = taxRate * finalPriceValue / 100 * qty; document.getElementById("update_products[<?=$_GET['pid']?>][price]").value = doFormat(priceValue, 4); document.getElementById("update_products[<?=$_GET['pid']?>][final_price]").value = doFormat(finalPriceValue, 4); document.getElementById("update_products[<?=$_GET['pid']?>][price_incl]").value = doFormat(priceInclValue, 4); document.getElementById("update_products[<?=$_GET['pid']?>][total_excl]").value = doFormat(totalExclValue, 4); document.getElementById("update_products[<?=$_GET['pid']?>][total_incl]").value = doFormat(totalInclValue, 4); var theActualResponseText = "<?=$_GET['field']?>"; <?php //-- END price breaks per qty mod -- remo } tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET " . $_GET['field'] . " = '" . oe_iconv($_GET['new_value']) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); //echo $_GET['field']; } FROM FILE: /order_editor/javascript.php function updateProductsField(action, pid, field, value, info) { createRequest(); if ( (action == 'update') || (action == 'reload1') ) { var url = "<?php echo FILENAME_ORDERS_EDIT_AJAX; ?>?action=update_product_field&oID=<?php echo $_GET['oID']; ?>&pid=" + pid + "&field=" + field + "&new_value=" + value; xmlHttp.open("GET", url, true); if (action == 'reload1') { //-- REMOVED for price breaks per quantity mod -- remo // xmlHttp.onreadystatechange= // function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){rewriteDiv(xmlHttp.responseText, 'products');obtainTotals();}}; // //-- START price breaks per quantity mod -- remo xmlHttp.onreadystatechange= function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){eval(xmlHttp.responseText);rewriteDiv(theActualResponseText, 'products');obtainTotals();}}; //-- END price breaks per quantity mod -- remo } else {//action == 'update' xmlHttp.onreadystatechange= function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){rewriteDiv(xmlHttp.responseText, 'products');}}; } }//end if ( (action == 'update') || (action == 'reload1') ) { if (action == 'reload2') { var price = document.getElementById("update_products[" + pid + "][price]").value; var final_price = document.getElementById("update_products[" + pid + "][final_price]").value; var url = "<?php echo FILENAME_ORDERS_EDIT_AJAX; ?>?action=update_product_value_field&oID=<?php echo $_GET['oID']; ?>&pid=" + pid + "&price=" + price + "&final_price=" + final_price; xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange= function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){rewriteDiv(xmlHttp.responseText, 'products');obtainTotals();}}; }//end if action == 'reload2' if ( (action == 'delete') && (field == 'delete') && (value == true) ){ if (confirm('<?php echo AJAX_CONFIRM_PRODUCT_DELETE; ?>')) { var url = "<?php echo FILENAME_ORDERS_EDIT_AJAX; ?>?action=delete_product_field&oID=<?php echo $_GET['oID']; ?>&pid=" + pid + "&field=" + field + "&new_value=" + value; xmlHttp.open("GET", url, true); xmlHttp.onreadystatechange= function(){if(xmlHttp.readyState!=4)return;if(xmlHttp.status==200){rewriteDiv(xmlHttp.responseText, 'products');deleteRow(info, 'productsTable');obtainTotals();}}; } }//end if (action == 'delete') { xmlHttp.send(null); } //end function updateProductsField(action, pid, field, value) { If anyone has a better way, please let me know and I will use it too. Thanks. Remo
  8. Hi all, I have upgraded to v5.0.6 from v2.8.2 and everthing went without a hitch. Well, almost everything.... I have another mod installed, the "price breaks per quantity" mod, and the problem that I am having is that I cannot get this mod to work properly with the ajax part of the new version of the order editor mod. Basically what should happen is this.... When the admin changes a quantity of an ordered product in the editor, all product prices and all totals need to be recalculated. So I have made some changes to the edit_orders_ajax.php file.... particularly in section #2 (see below): //-- 2. Update the orders_products table for qty, tax, name, or model ----------------------------------------------- if ($action == 'update_product_field') { if ($_GET['field'] == 'products_quantity') { $order_query = tep_db_query("SELECT products_id, products_quantity FROM " . TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . $_GET['oID'] . "' AND orders_products_id = '" . $_GET['pid'] . "'"); $orders_product_info = tep_db_fetch_array($order_query); // update inventory quantities if ($_GET['new_value'] != $orders_product_info['products_quantity']){ $quantity_difference = ($_GET['new_value'] - $orders_product_info['products_quantity']); if (STOCK_LIMITED == 'true'){ tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_quantity = products_quantity - " . $quantity_difference . ", products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } else { tep_db_query("UPDATE " . TABLE_PRODUCTS . " SET products_ordered = products_ordered + " . $quantity_difference . " WHERE products_id = '" . $orders_product_info['products_id'] . "'"); } } //-- START price breaks per qty mod -- remo // this section sets the product prices correctly in the database if the quantity changes // but we need to update the input fields on the edit order as well. $pf->loadProduct((int)$orders_product_info['products_id'], $languages_id); $price_break = $pf->computePrice($_GET['new_value']); tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET products_price = '" . oe_iconv($price_break) . "', final_price = '" . oe_iconv($price_break) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); /* ?> <script language="JavaScript" type="text/javascript"> var qty = '<?=$_GET['new_value']?>'; var taxRate = document.getElementById("update_products[<?=$_GET['pid']?>][tax]").value; var attValue = getAttributesPrices(<?=$_GET['pid']?>); var priceValue = '<?=$price_break?>'; var finalPriceValue = Number(attValue) + Number(priceValue); var priceInclValue = ( Number(attValue) + Number(priceValue) ) * ((taxRate / 100) + 1); var totalInclValue = ( Number(attValue) + Number(priceValue) ) * ((taxRate / 100) + 1) * qty; var totalExclValue = ( Number(attValue) + Number(priceValue) ) * qty; var taxValue = taxRate * finalPriceValue / 100 * qty; document.getElementById("update_products[<?=$_GET['pid']?>][price]").value = doFormat(priceValue, 4); document.getElementById("update_products[<?=$_GET['pid']?>][final_price]").value = doFormat(finalPriceValue, 4); document.getElementById("update_products[<?=$_GET['pid']?>][price_incl]").value = doFormat(priceInclValue, 4); document.getElementById("update_products[<?=$_GET['pid']?>][total_excl]").value = doFormat(totalExclValue, 4); document.getElementById("update_products[<?=$_GET['pid']?>][total_incl]").value = doFormat(totalInclValue, 4); </script> <?php */ //-- END price breaks per qty mod -- remo } tep_db_query("UPDATE " . TABLE_ORDERS_PRODUCTS . " SET " . $_GET['field'] . " = '" . oe_iconv($_GET['new_value']) . "' WHERE orders_products_id = '" . $_GET['pid'] . "' AND orders_id = '" . $_GET['oID'] . "'"); echo $_GET['field']; } So you can see that I can change the prices in the order_products table, without any problems, but I also need to change the values in the input fields on the order editor. I attempted to take care of this problem with the javascript that is inserted there, but as you can see, it has been commented out because it does not work. Does anyone else have these two mods installed in their cart? Or can anyone shed any light on this problem? Thanks Remo
  9. Hi I was wondering if anyone has written a patch for easy populate to import specials? If anyone has, please let me know. If not, and there is enough interest, I will get onto it. Thanks Remo :thumbsup: