Results 1 to 10 of 11

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    United States
    Posts
    491
    Plugin Contributions
    1

    Default Re: How to use MoveNext();

    Ok I made the following change to the code which will now redirects the output with multiple results to another page.

    This code is in my header file:

    PHP Code:
    $order_number=$_POST['order_number'];
      
    $track_rs $db->Execute("SELECT tracking_number FROM fulfill_tracking WHERE order_number = " . (int)$order_number);
      if (
    $track_rs ->RecordCount() == 1) {
        
    $track_num $track_rs ->fields['tracking_number'];
    header('Location: http://customurl.com/' $track_num);
      } elseif (
    $track_rs ->RecordCount() > 0) {
    $_SESSION['order_number'] = $order_number;
          
    zen_redirect(zen_href_link(FILENAME_TRACKING'action=trackingInfo'));
      
      } else {
          
    $messageStack->add('tracking'ENTRY_ORDER_NUMBER_ERROR3);
      } 
    This code is in my templates file:

    PHP Code:
    <?php
      
    if (isset($_GET['action']) && ($_GET['action'] == 'trackingInfo')) {
    ?>
    <div class="mainContent trackingInfo"></div>

    <?php
    $order_number 
    $_SESSION['order_number'];
      
    $track_rs $db->Execute("SELECT tracking_number FROM fulfill_tracking WHERE order_number = " . (int)$order_number);
     if (
    $track_rs ->RecordCount() > 0) {
        
    $track_num = array();
        while(!
    $track_rs->EOF) {
          
    $track_num[] = $track_rs ->fields['tracking_number'];
          
    $track_rs->MoveNext();
    }
    echo 
    '<p class="trackingInfoBoxes">This order shipped in ' sizeof($track_num). ' box' .(sizeof($track_num) != 'es' '') . ':</p>';
    echo 
    "\n";
    foreach (
    $track_num as $key => $val) {
      echo 
    '<p class="trackingInfoPackages">Package ' . ($key+1) . ':  <a href="http://customurl.com/' $val '">Click to Track</a></p>';
      echo 
    "\n";
    }
      }
    ?>
    It works not sure if there is a better way of doing it though. Thanks again for the help!

  2. #2
    Join Date
    May 2008
    Location
    United States
    Posts
    491
    Plugin Contributions
    1

    Default Re: How to use MoveNext();

    How would I edit the below if statement to include a check to see if an order not older than 30 days?

    PHP Code:
    <?php if ($track_num == 1) { ?>
    The order date is displayed on this page as:

    <td width="100px"><?php echo zen_date_short($orders['date_purchased']); ?></td>

 

 

Similar Threads

  1. Replies: 14
    Last Post: 12 Apr 2016, 02:47 PM
  2. v139h How to reset an object after using MoveNext()?
    By Cyberkiller in forum General Questions
    Replies: 6
    Last Post: 30 Mar 2012, 05:27 PM
  3. Basic query question with MoveNext
    By delia in forum Contribution-Writing Guidelines
    Replies: 2
    Last Post: 12 Jan 2010, 05:20 PM
  4. How can I use Multiple mods that use same files?
    By sfklaas in forum General Questions
    Replies: 1
    Last Post: 8 May 2009, 10:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg