Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Scrambled Order Numbers


Guest

Recommended Posts

Is there an option to make randomised numbers shorter (default is 9). Something like thing with prefix lengh.

There is no magic number you can just set to a value and it will generate numbers of a set length; sorry.

 

I did look at this when I wrote it but its not easy to do I'm afraid.

 

As it is, the routines will generate a number up to a maximum of 31 bits (a little over 2 billion - 10 digits). If you want smaller numbers then you will have to adjust the scrambling algorithm to make sure you stick within the number of bits you require (16 bits will give you numbers up to 65535 (5 digits). This is certainly possible and not too difficult but it's not very easy to do this in an easily configurable way I'm afraid. You will just have to go through the scrambling routines and adjust them appropriately.

 

One reason I didn't provide more than one set of functions (each set generating different numbers of bits in the scrambled number) is that (say) 16 bits seems a bit small (65535 orders isn't THAT many), and 24 bits (say) will generate 8 digits. 8 digits isn't that many less than 10 (as generated by a 31 bit scramble) so I decided just to stick with 31 bits.

 

If you change the scrambling routines, make sure you test the result with a full range of possible values THOROUGHLY !!!!! If you get something wrong then you will find that you can scramble some numbers but they will not unscramble correctly. This will happen when your (un)scrambling routine 'looses' data somehow. Remember, the (un)scrambling routines must not loose ANY data - ie - they must not scramble the number in such a way that it is not fully reversable - if you shift bits off the end of the word and loose them for example, then this will break the algorithm.

 

Of course, if you come up with some new algorithms, feel free to post them up for everyone to share.

 

Rich.

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 63
  • Created
  • Last Reply

Top Posters In This Topic

I have finished installing scrambled order numbers and thought I would say that this is an excellent contribution.

Installation was a breeze, instructions clear and concise. Good work, thank you

:thumbsup:

Robr

Link to comment
Share on other sites

I've installed this contribution and it works fine. Thanks to the author!

 

I just have a problem with the invoice the customer can view (popup) in his history info.

 

When I open the popup (printorder.php) only those informations appear :

- store adress

- store name

- store tva intracom

 

- order number (SCRAMBLED!)

 

Could you help me with the printorder.php ? Sorry, I'm a newbie in php:

 

 

<?php
/*
 $Id: printorder.php,v 1.2 12/03/2003 randynewman
 
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 if (!tep_session_is_registered('customer_id')) {
   $navigation->set_snapshot();
   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));
 }

 $customer_number_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['order_id'])) . "'");
 $customer_number = tep_db_fetch_array($customer_number_query);

 $payment_info_query = tep_db_query("select payment_info from " . TABLE_ORDERS . " where orders_id = '". tep_db_input(tep_db_prepare_input($HTTP_GET_VARS['order_id'])) . "'");
 $payment_info = tep_db_fetch_array($payment_info_query);
 $payment_info = $payment_info['payment_info'];

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ORDERS_PRINTABLE);

 require(DIR_WS_CLASSES . 'order.php');
 $order = new order($HTTP_GET_VARS['order_id']);

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE . ' - ' . TITLE_PRINT_ORDER . ' ' . $HTTP_GET_VARS['order_id']; ?></title>
<base href="<?php echo (getenv('HTTPS') == 'on' ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="print.css">
<script language="JavaScript">
<!--
function Lvl_P2P(url,closeIt,delay){ //ver1.0 4LevelWebs
   opener.location.href = url;
if (closeIt == true)setTimeout('self.close()',delay);
}
//-->
</script>
</head>
<body marginwidth="10" marginheight="10" topmargin="10" bottommargin="10" leftmargin="10" rightmargin="10">
<!-- body_text //-->

<?php
 if ($HTTP_GET_VARS['order_id'] != $order_id) {
?>

<table width="600" border="0" align="center" cellpadding="2" cellspacing="0">
 <tr> 
   <td align="center" class="main"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="5">
     <tr> 
       <td align="center" valign="middle" class="main"><?php echo TEXT_ORDER_ERROR; ?></td>
     </tr>
     <tr>
    	 <td align="center" valign="middle" class="main"><a href="javascript:;" onclick="Lvl_P2P('logout.php',true,0);return false"><?php echo tep_image(DIR_WS_IMAGES . 'close_window.gif', 'Close Window'); ?></a></td>
     </tr>
   </table></td>
 </tr>
</table>

<?php
 } else {
?>    

<table width="600" border="0" align="center" cellpadding="2" cellspacing="0">
 <tr>
   <td align="center" class="main"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="5">
     <tr> 
       <td valign="top" align="left" class="main"><script language="JavaScript">
 if (window.print) {
   document.write('<a href="javascript:;" onClick="javascript:window.print()" onMouseOut=document.imprim.src="<?php echo (DIR_WS_IMAGES . 'printimage.gif'); ?>" onMouseOver=document.imprim.src="<?php echo (DIR_WS_IMAGES . 'printimage_over.gif'); ?>"><img src="<?php echo (DIR_WS_IMAGES . 'printimage.gif'); ?>" width="43" height="28" align="absbottom" border="0" name="imprim">' + '<?php echo IMAGE_BUTTON_PRINT; ?></a></center>');
 }
 else document.write ('<h2><?php echo IMAGE_BUTTON_PRINT; ?></h2>')
       </script></td>
       <td align="right" valign="bottom" class="main"><p align="right" class="main"><a href="javascript:window.close();"><img src='images/close_window.jpg' border=0></a></p></td>
     </tr>
   </table></td>
	 </tr>
 <tr>
   <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '15'); ?></td>
	 </tr>
 <tr>
   <td><table border="0" align="center" width="100%" cellspacing="0" cellpadding="0">
     <tr> 
       <td><table border="0" align="center" width="98%" cellspacing="0" cellpadding="0">
         <tr>
         <td class="pageHeading" valign="bottom"><?php echo nl2br(STORE_NAME_ADDRESS); ?></td>
         <td class="pageHeading" align="right" valign="top"><?php echo tep_image(DIR_WS_IMAGES . STORE_LOGO, STORE_NAME); ?></td>
      	 </tr>
      	 <tr>
         <td class="pageHeading" valign="bottom"><?php echo ENTRY_SHOP_INTRACOM; ?><?php echo TVA_SHOP_INTRACOM; ?></td>
         <td class="pageHeading" align="right" valign="top"></td>
      	 </tr>
      	 <tr> 
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>
         </tr>
         <tr> 
           <td colspan="2" align="center" class="titleHeading"><b><?php echo TITLE_PRINT_ORDER . ' ' . $HTTP_GET_VARS['order_id']; ?></b></td>
         </tr>
         <tr> 
           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
         </tr>
       </table></td>
     </tr>
   </table></td>
	 </tr>
 <tr>
   <td align="left" class="main"><table width="100%" border="0" cellspacing="0" cellpadding="2">
     <tr> 
       <td class="main"><?php echo '<b>' . ENTRY_PAYMENT_METHOD . '</b> ' . $order->info['payment_method']; ?></td>
     </tr>
     <tr> 
       <td class="main"><?php echo $payment_info; ?></td>
     </tr>
   </table></td>
	 </tr>
 <tr>
   <td align="center"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="2">
     <tr> 
       <td align="center" valign="top"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor=#000000>
         <tr> 
           <td align="center" valign="top"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow"> 
               <td class="dataTableHeadingContent"><b><?php echo ENTRY_SOLD_TO; ?></b></td>
             </tr>
             <tr class="dataTableRow"> 
<!-- Ajout pour TVA_INTRACOM_v3.3	//-->
<td class="main"><?php echo tep_address_format($order->billing['format_id'], $order->billing, 1, '', '<br>'); ?></td>
<!-- Fin ajout pour TVA_INTRACOM_v3.3	//-->              </tr>
           </table></td>
         </tr>
       </table></td>
       <td align="center" valign="top"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="1" bgcolor=#000000>
         <tr> 
           <td align="center" valign="top"><table align="center" width="100%" border="0" cellspacing="0" cellpadding="2">
             <tr class="dataTableHeadingRow"> 
               <td class="dataTableHeadingContent"><b><?php echo ENTRY_SHIP_TO; ?></b></td>
             </tr>
             <tr class="dataTableRow"> 
               <td class="dataTableContent"><?php echo tep_address_format($order->delivery['format_id'], $order->delivery, 1, ' ', '<br>'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <!-- Ajout pour TVA_INTRACOM_v3.3	//-->
 <tr>
    	 <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
     </tr>
 <tr>
    	 <td><table border="0" cellspacing="0" cellpadding="2">
       <tr>
         
       <tr>
        	 <td class="main"></td>
        	 <td class="main"></td>
      	 </tr>
  </table></td>
     </tr>
<!-- Fin ajout pour TVA_INTRACOM_v3.3	//-->
     
   </table></td>
	 </tr>
 <tr>
   <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
	 </tr>
 <tr>
   <td><table border="0" width="100%" cellspacing="0" cellpadding="1" bgcolor=#000000>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
         <tr class="dataTableHeadingRow"> 
           <td class="dataTableHeadingContent" colspan="2"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
           <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS_MODEL; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TAX; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_PRICE_EXCLUDING_TAX; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_EXCLUDING_TAX; ?></td>
           <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_TOTAL_INCLUDING_TAX; ?></td>
         </tr>
       <?php
   for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
     echo '      <tr class="dataTableRow">' . "\n" .
          '        <td class="dataTableContent" valign="top" align="right">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .
          '        <td class="dataTableContent" valign="top">' . $order->products[$i]['name'] . '<br>';

   if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {
     for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {
       echo '<nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i><br></small></nobr>';
     }
   }

     echo '        </td>' . "\n" .
          '        <td class="dataTableContent" valign="top">' . $order->products[$i]['model'] . '</td>' . "\n";
     echo '        <td class="dataTableContent" align="right" valign="top">' . tep_display_tax_value($order->products[$i]['tax']) . '%</td>' . "\n" .
          '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
          '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format($order->products[$i]['final_price'] * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n" .
          '        <td class="dataTableContent" align="right" valign="top"><b>' . $currencies->format(tep_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']) . '</b></td>' . "\n";
     echo '      </tr>' . "\n";
   }
?>
       </table></td>
     </tr>
   </table></td>
	 </tr>
 <tr>
   <td align="right" colspan="7"><table border="0" cellspacing="0" cellpadding="2">
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <?php
 for ($i = 0, $n = sizeof($order->totals); $i < $n; $i++) {
   echo '          <tr>' . "\n" .
        '            <td align="right" class="smallText">' . $order->totals[$i]['title'] . '</td>' . "\n" .
        '            <td align="right" class="smallText">' . $order->totals[$i]['text'] . '</td>' . "\n" .
        '          </tr>' . "\n";
 }
?>
       </table></td>
     </tr>
   </table></td>
 </tr>
</table>
<?php
 }
?>    
<!-- body_text_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

OSC2.2

Link to comment
Share on other sites

When I open the popup (printorder.php) only those informations appear :

- store adress

- store name

- store tva intracom

printorder.php ?

 

Never heard of it !

 

I assume this is someone else's contribution. Sorry, but I don't have the time to go through other people's contributions. Also, as I have no idea what the contribution SHOULD do, and have no means of testing any fix (because I don't have this contribution installed), I can't very easily say why it is broken.

 

I suggest you get your coding hat on and debug it yourself.

 

regards,

 

Rich.

Link to comment
Share on other sites

printorder.php ?

 

Never heard of it !

 

I assume this is someone else's contribution. Sorry, but I don't have the time to go through other people's contributions. Also, as I have no idea what the contribution SHOULD do, and have no means of testing any fix (because I don't have this contribution installed), I can't very easily say why it is broken.

 

I suggest you get your coding hat on and debug it yourself.

 

regards,

 

Rich.

 

Sorry!

 

I forgot printorder.php wasn't in the core version!

 

Thanks for your reply.

OSC2.2

Link to comment
Share on other sites

  • 1 month later...

Before I changed to this contribution, I had the order number in the email subject line. It still shows but not with the random order number. When I installed this contribution, all seems to work well, but the subject line still states the original osc order number. Where do I add coding for this contribution to show the random order number in the subject line?

 

Kitti

Link to comment
Share on other sites

I also noticed that the extra email that holds the partial credit card numbers doesn't state the random order number either. It shows the osc original order number. How can I fix this one as well?

 

Thanks!

 

Kitti

Link to comment
Share on other sites

anyone? :(

I am unable to test this myself, so can you try the following and let me know if it works. If it does then I'll update the contribution. If not, then let me know and I'll dig deeper.

 

The following fix should solve your credit card email problem. As for the other problem you have (embedding the order number into the email title), I can't see this anywhere, so I'm assuming this is another contribution (or your own change) that you have applied to the code. Let me know if I'm wrong in this, but my emails do not include the order number in the title.

 

Assuming I am correct (ie - you ARE using a contribution for this), then the best advice I can offer is to locate where the changes have been made and make a similar change to that shown below for the credit card email - ie - identify the order number variable in the code (as you can see below, this may be called '$insert_id' (or similar) or it may be called $order_id or $order_num or something like that - it depends what the code is doing). Use the randomise_order_num() function to convert it to a scrambled order number. Take care not to upset any code that relies on the 'real' order number though. If you get a 'function not found' error (or similar) then you will have to add the line...

 

require('includes/functions/scrambled_order_num.php');

 

...somewhere appropriate. If the email is being generated by a module (or anywhere from any file within the .../include/ directory) then you probably need to add this line in the file(s) that INCLUDE the module and NOT the module itself. eg - the credit card module is included by the .../catalog/checkout_process.php) file so this is where this line needs adding (it's already there in this case, if you have already added the contribution, so it doesn't need adding again).

 

If you still have problems then do get back.

 

### Remember to backup first !! ###

 

regards,

 

Rich.

 

---------------------------------------------------------------------------

FILE : .../catalog/includes/modules/payment/cc.php

 

Approx. line 170 (function 'after_process()')

 

Replace the two lines....

 

$message = 'Order #' . $insert_id . "\n\n" . 'Middle: ' . $this->cc_middle . "\n\n";

tep_mail('', MODULE_PAYMENT_CC_EMAIL, 'Extra Order Info: #' . $insert_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

...with the following THREE lines (I have removed the '#' because I think it tidies up the text, but it's up to you what you do) :

 

$scrambled_order_num = randomise_order_num($insert_id);
$message = 'Order num.' . $scrambled_order_num . "\n\n" . 'Middle: ' . $this->cc_middle . "\n\n";

tep_mail('', MODULE_PAYMENT_CC_EMAIL, 'Extra Order Info:' . $scrambled_order_num, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

 

---------------------------------------------------------------------------

Link to comment
Share on other sites

That did the trick in the extra order info email (cc email), the email I get with the middle credit card numbers.

 

As for the other emails, I replaced $insert_id with $scrambled_order_num = randomise_order_num($insert_id).

 

All seems to work well now.

 

Thanks a bunch Rich.

 

Happy New Year!

 

Kitti

Link to comment
Share on other sites

That did the trick...

Good.

 

I have now updated the contribution (v 1.5) to include the above fix. I have also added some notes similar to those in my previous post which may help if you are trying to get other contributions working with this one.

 

Rich.

Link to comment
Share on other sites

  • 4 weeks later...

Hi Richard.

 

Any help you could give would be greatly apreciated .....

 

I would seem to have the same problem as one of your previos post's

 

on checkout success the order number that is being shown is WXQ-509032644 and yes it is as you said before = order number 0 i have gone over the code several times And i cant find a typo or where i have gone wrong (maybe i can't see it for looking lol :'( )

 

Every where else is fine (of what i can see) it is verson 1.5 im installing.

 

If you could advise me where to look and what could be causing it

 

this is the code for checkout_success.php

 

// >>> BEGIN SCRAMBLED_ORDER_NUMBER
 require('includes/functions/scrambled_order_num.php');
// <<< END SCRAMBLED_ORDER_NUMBER

 

  $global = tep_db_fetch_array($global_query);

// >>> BEGIN SCRAMBLED_ORDER_NUMBER
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");
$orders = tep_db_fetch_array($orders_query);
if ($global['global_product_notifications'] != '1') {
// <<< END SCRAMBLED_ORDER_NUMBER

   $products_array = array();

 

            <td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo HEADING_TITLE; ?></div><br><?php echo TEXT_SUCCESS; ?><br><br>

           <?php
// >>> BEGIN ADD_ORDER_NUM_TO_CUSTOMER_CONFIRMATION
// Display order number
// >>> BEGIN SCRAMBLED_ORDER_NUMBER
echo 'Your order number is...<h3>' . randomise_order_num($orders['orders_id']) . '</h3>Please make a note of this and quote it in any correspondence with us.<br><br><br>';
// <<< END SCRAMBLED_ORDER_NUMBER
// <<< END ADD_ORDER_NUM_TO_CUSTOMER_CONFIRMATION

 if ($global['global_product_notifications'] != '1') {
   echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';

 

If any help can be given it will be greatly appreciated :thumbsup: :thumbsup:

 

 

Many Thanks

 

 

Marc T

 

 

 

www.aromacraft.co.uk

Edited by aromacraft
Link to comment
Share on other sites

Eh ? Err..... nope ! not obvious.

 

Try this - in the second section of code you posted, try printing out the result from the database query. I've modified the following code appropriately...

 

  $global = tep_db_fetch_array($global_query);

// >>> BEGIN SCRAMBLED_ORDER_NUMBER
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");
$orders = tep_db_fetch_array($orders_query);

echo 'ARRAY='.$orders.'<br />'; // Should print "ARRAY ....bla bla..."
echo '-----<br />';
foreach($orders as $key => $v)
{
  // Should print all the values returned
  print " ".$key." -> '".$v."'<br />";
}
echo '-----<br />';

if ($global['global_product_notifications'] != '1') {
// <<< END SCRAMBLED_ORDER_NUMBER

   $products_array = array();

 

By the way, as an aside, the <br> that you have added in the text should be <br /> to be syntactically correct. I notice I've made the same mistake in the contribution; I'll fix it and upload it soon (but I want to fix your problem first)

 

RIch.

Edited by CMOTD
Link to comment
Share on other sites

Hi Rich

 

 

Thanks for the quick responce it is much apreciated.

 

Unfortunaly the replacment code has made no changes ??????

 

It is still producing the same Order number = 0 :huh::huh::huh:

 

I'm Still a Complete NOOB but trying to learn ...

 

If this sounds like complete Gibberish Just ignor it. but could the final Print Code

 

            <td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo HEADING_TITLE; ?></div><br><?php echo TEXT_SUCCESS; ?><br><br>

          <?php
// >>> BEGIN ADD_ORDER_NUM_TO_CUSTOMER_CONFIRMATION
// Display order number
// >>> BEGIN SCRAMBLED_ORDER_NUMBER
echo 'Your order number is...<h3>' . randomise_order_num($orders['orders_id']) . '</h3>Please make a note of this and quote it in any correspondence with us.<br><br><br>';
// <<< END SCRAMBLED_ORDER_NUMBER
// <<< END ADD_ORDER_NUM_TO_CUSTOMER_CONFIRMATION

if ($global['global_product_notifications'] != '1') {
  echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';

 

Be calling the right information ??????

 

Sorry if it makes no sence but i dont like handing my problems to other people to sort out in there spare time... just trying to offer some help..

 

 

 

Many Thanks For you help and Brilliant Contrib

 

 

Marc

 

 

Thanks for the <br> tip will start changing them now

Edited by aromacraft
Link to comment
Share on other sites

Unfortunaly the replacment code has made no changes ??????

No, the code change I suggested won't fix the problem.

 

It SHOULD print some debug information that might point to what the problem is though.

 

Can't you see some text somewhere (probably near the top of the page) that says something lke...

 

ARRAY ....

...followed by...

-------

...followed by (hopefully)...

varname -> value

varname -> value

...

 

No ? If not then it looks like the code isn't running at all. I'll check this evening to see if my suggested debug code actually works.

 

Rich.

Link to comment
Share on other sites

Can't you see some text  somewhere (probably near the top of the page) that says something lke...

 

ARRAY ....

...followed by...

-------

...followed by (hopefully)...

varname -> value

varname -> value

...

 

 

 

Sorry Nothing I double checked the end result and Nothing is being printed. I Even Checked the end Souce Code with find ARRAY no luck

 

Thanks

 

 

Marc

Link to comment
Share on other sites

Sorry Nothing I double checked the end result and Nothing is being printed. I Even Checked the end Souce Code with find ARRAY no luck

 

Thanks

Marc

Well, I can't understabd why that bit of debug code doesn't run (unless the script isn't running (you've not commented out a whole chunk of code in checkout_success.php have you ?)

 

I cut and paste the change I posted into my test version of OSC, and I get the following printed at the top left of the displayed page :

 

ARRAY=Array

-----

orders_id -> '12'

-----

 

...which is what I would expect. If you are not even getting this then your script can't be running (at least this bit isn't) which will explain why you don't have the order number displayed correctly because this bit of code retrieves the order number from the database.

 

Rich.

Link to comment
Share on other sites

Hi Rich

 

Thanks For the Help Just spent the better part of the morning looking for the problem ..... i've looked at the code on checkout sucsess and nothing stands out ....... Im Completly Baffled at this as it is the first time i have edited the Checkout_success.php not to sure why all i can think is it mat be some other part of the checkout prosses that might be wrong????????????

 

 

 

 

<?php
/*
 $Id: checkout_success.php,v 1.49 2003/06/09 23:03:53 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

// >>> BEGIN SCRAMBLED_ORDER_NUMBER
 require('includes/functions/scrambled_order_num.php');
// <<< END SCRAMBLED_ORDER_NUMBER



// if the customer is not logged on, redirect them to the shopping cart page
 if (!tep_session_is_registered('customer_id')) {
   tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }

 if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {
   $notify_string = 'action=notify&';
   $notify = $HTTP_POST_VARS['notify'];
   if (!is_array($notify)) $notify = array($notify);
   for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
     $notify_string .= 'notify[]=' . $notify[$i] . '&';
   }
   if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);

   tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
 }

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);

 $breadcrumb->add(NAVBAR_TITLE_1);
 $breadcrumb->add(NAVBAR_TITLE_2);

 $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'");
 $global = tep_db_fetch_array($global_query);

// >>> BEGIN SCRAMBLED_ORDER_NUMBER
$orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1");
$orders = tep_db_fetch_array($orders_query);

echo 'ARRAY='.$orders.'<br />'; // Should print "ARRAY ....bla bla..."
echo '-----<br />';
foreach($orders as $key => $v)
{
 // Should print all the values returned
 print " ".$key." -> '".$v."'<br />";
}
echo '-----<br />';

if ($global['global_product_notifications'] != '1') {
// <<< END SCRAMBLED_ORDER_NUMBER

   $products_array = array();
   $products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$orders['orders_id'] . "' order by products_name");
   while ($products = tep_db_fetch_array($products_query)) {
     $products_array[] = array('id' => $products['products_id'],
                               'text' => $products['products_name']);
   }
 }
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="<? echo THEMA_STYLE;?>">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?php echo tep_draw_form('order', tep_href_link(FILENAME_CHECKOUT_SUCCESS, 'action=update', 'SSL')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
     <tr>
       <td><table border="0" width="100%" cellspacing="4" cellpadding="2">
         <tr>
           <td valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_man_on_board.gif', HEADING_TITLE); ?></td>
           <td valign="top" class="main"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?><div align="center" class="pageHeading"><?php echo HEADING_TITLE; ?></div><br><?php echo TEXT_SUCCESS; ?><br><br>

           <?php
// >>> BEGIN ADD_ORDER_NUM_TO_CUSTOMER_CONFIRMATION
// Display order number
// >>> BEGIN SCRAMBLED_ORDER_NUMBER
echo 'Your order number is...<h3>' . randomise_order_num($orders['orders_id']) . '</h3>Please make a note of this and quote it in any correspondence with us.<br /><br /><br />';
// <<< END SCRAMBLED_ORDER_NUMBER
// <<< END ADD_ORDER_NUM_TO_CUSTOMER_CONFIRMATION

 if ($global['global_product_notifications'] != '1') {
   echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';

   $products_displayed = array();
   for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {
     if (!in_array($products_array[$i]['id'], $products_displayed)) {
       echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';
       $products_displayed[] = $products_array[$i]['id'];
     }
   }

   echo '</p>';
 } else {
   echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;
 }
?>
           <h3><?php echo TEXT_THANKS_FOR_SHOPPING; ?></h3></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td align="right" class="main"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
             </tr>
           </table></td>
           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
           <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
           <td width="25%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
             <tr>
               <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
               <td width="50%"><?php echo tep_image(DIR_WS_IMAGES . 'checkout_bullet.gif'); ?></td>
             </tr>
           </table></td>
         </tr>
         <tr>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_DELIVERY; ?></td>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
           <td align="center" width="25%" class="checkoutBarFrom"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
           <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
         </tr>
       </table></td>
     </tr>
<?php if (DOWNLOAD_ENABLED == 'true') include(DIR_WS_MODULES . 'downloads.php'); ?>
   </table></form></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

?????

 

 

Once again thanks for your help

 

 

Marc

Link to comment
Share on other sites

Nope. Absolutely stumped there ! I can't see any reason why you don't at least get the debug lines printed out.

 

I assume you don't just get a blank page - ie - you DO get a page displayed but it doesn't display the correct order number ? If you get a blank page then it's something more fundamental. That's not a blank lline at the very top of the file is it (before the <php), or is it just when you cut and pasted it into the post ?

 

It's not something REALLY silly like you've saved the modified file with the wrong name (or in the wrong place) and the web server is actually picking up the original version ? I ask, because these things happen (I've done it many times myself - not actually running / compiling the file that I thought I was !).

 

Try putting a deliberate error in the code. If you still don't see anything like "Fatal error : You've put a deliberate error in the code" then it would seem that the script is not running.

 

Rich.

Link to comment
Share on other sites

Hi There

 

Thanks for the pm Rich. Im posting the reply here so there is a record if some one else has the same problem.....

 

Right then here we go....

 

I assume you don't just get a blank page - ie - you DO get a page displayed but it doesn't display the correct order number ? If you get a blank page then it's something more fundamental. That's not a blank lline at the very top of the file is it (before the <php), or is it just when you cut and pasted it into the post ?

 

Yep i get a page displayed with the procesed order number which is scrambled equal to zero. and as well it is how i copy and pasted it.

 

It's not something REALLY silly like you've saved the modified file with the wrong name (or in the wrong place) and the web server is actually picking up the original version ? I ask, because these things happen (I've done it many times myself - not actually running / compiling the file that I thought I was !).

 

I've done this my self many times and i'm sure i will do it again.. lol :D But its always one of the first things i check along with making sure i put the code in correctly :thumbsup:

 

Try putting a deliberate error in the code. If you still don't see anything like "Fatal error : You've put a deliberate error in the code" then it would seem that the script is not running.

 

This was the easy part :P at least i thought never got a error just a blank page and the code when i took it out.

 

// >>> BEGIN ADD_ORDER_NUM_TO_CUSTOMER_CONFIRMATION
// Display order number
// >>> BEGIN SCRAMBLED_ORDER_NUMBER
echo 'Your order number is...<h3>' . randomise_order_num($orders['orders_id']) . '</h3>Please make a note of this and quote it in any correspondence with us.<br><br><br>';
// <<< END SCRAMBLED_ORDER_NUMBER
// <<< END ADD_ORDER_NUM_TO_CUSTOMER_CONFIRMATION

 

all i got was a blank page ???????????

 

and a final note i would like to confirm that oscommerce should come with a health warning

 

***** Please note prelonged exposure to OScommerce Problems Causes Temparary Insanity ******* :D :thumbsup:

 

 

Marc

Link to comment
Share on other sites

This was the easy part tongue.gif at least i thought never got a error just a blank page and the code when i took it out....

...all i got was a blank page ???????????

Sorry, don't quite understand this - are you saying that the deliberate error came up or you just got a blank page with the deliberate error ?

 

You will probably get a blank page if you stick and error in code that is evaluated before the http headers have been output. That's normal, and does show that that script is running. You could try sticking the deliberate error somewhere else in the page that gets run after the http headers have been output.

 

and a final note i would like to confirm that oscommerce should come with a health warning

 

***** Please note prelonged exposure to OScommerce Problems Causes Temparary Insanity *******  :D  :thumbsup:

Marc

Only temporary ?

 

I'm sorry, but I really have no idea why this isn't working for you. If it were me, I'd probably start sticking in more debug lines prior to the last few that I suggested and try and work out which bits ARE executing and which are not. I don't have the code in front of me to check, but I assume there an "if (bla bla bla)" somewhere before the debug that I last suggested that is not being triggered ? If so then start by printing out the variables that it is relying on and try and find why it's failing.

 

Rich.

Link to comment
Share on other sites

Hi Rich

 

 

Thanks i will start putting some debug lines in and trying to figure out what is going on.. but other than the checkout success it's Fine. and i'm going to be incoporating it into the LIVE site on the 5 Feb and missout the checkout success FOR NOW (i won't let code get the better of me lol) as i have got about 5 more contribs to incoporate for the site by then as well and have them tested.

 

 

When i find the fix (Fingers Crossed) i will let you know. and all the help you have given has be greatly appreciated....

 

 

 

Marc T

 

 

and Thanks for a Excelent Contrib. :thumbsup: :thumbsup: :thumbsup:

 

QUOTE

and a final note i would like to confirm that oscommerce should come with a health warning

 

***** Please note prelonged exposure to OScommerce Problems Causes Temparary Insanity *******  :D  :thumbsup:

Marc

 

Only temporary ?

 

Ok is see your point. I did forget to mention Hair Loss though :thumbsup:

Link to comment
Share on other sites

  • 2 weeks later...

Well, I'm off. I will no longer visit/monitor this forum. if you have problems then you can PM me or email me and I might get back to you. No promises though.

 

I will keep my PM / email address open but I don't know how long the forum will maintain my login (and hence my email address link) once it stops being used, so if you are reading this some time from now and find that my details have been erased then at least you know why.

 

bye.

 

Rich.

Link to comment
Share on other sites

  • 1 month later...
That did the trick in the extra order info email (cc email), the email I get with the middle credit card numbers.

 

As for the other emails, I replaced $insert_id with

$scrambled_order_num = randomise_order_num($insert_id).

 

Kitti

 

 

I have installed scrambled order number and it works great. I then installed the linkpoint mod to accept credit cards. My store still e-mails the raw order number to the customer when using linkpoint credit card. I think I understand the problem. I have to change the code

$scrambled_order_num = randomise_order_num($insert_id).

But I have NO IDEA which file contains the code for sending e-mail.

If it is this one: includes / modules / payment/linkpointms1.php

Then i don't know which line to change. Can someone please help me out.

 

Tim

Link to comment
Share on other sites

In the linkpoint file it states that order # = OID

Then in linkpointms1.php it has the following code

$myorder["oid"] = $HTTP_POST_VARS['Set_Auto_By_Linkpoint'];

 

Does anyone know how to change this and make it show the scrambled number?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...