Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2013
    Location
    MTL
    Posts
    66
    Plugin Contributions
    2

    Default WARNING: An Error occurred, please refresh the page and try again

    I find myself at loss again. Possibly, I am not thinking straight for two days. Here is my issue of the week:
    I have three teams each team looks after specific product/product category. So when an order comes in for product (e.g. Running Shoes) or category Shoes, team Footwear will filter the orders page (on admin side) to view orders that pertains to footwear or a running shoes and can filter based on rush order or not.

    I had a simple hard coded filters in version 1.5.1 that was working but it doesn't work well into 1.5.5

    Below is a snippet of the select statement. What you don't see is that I have a drop down box that is defined earlier in the page to define the priority and category example
    Footwear - Rush Orders
    Footwear - Regular Orders

    HTML Code:
    ($_GET['priority'] == 'ot_priority_handling_categoryX1') {
          $priority = zen_db_prepare_input($_GET['priority']);
          $orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, 'See Order Details' as order_total" .
                              $new_fields . "
                              from (" . TABLE_ORDERS_STATUS . " s, " .
    			  TABLE_ORDERS . " o " .
                              $new_table . ")
                              left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id)" . "
    			  left join " . TABLE_ORDERS_PRODUCTS . " op on (o.orders_id = op.orders_id)" . "
                              where ot.class like '%ot_priority_handling%' and o.orders_status = s.orders_status_id and (o.orders_status = '1' or o.orders_status = '2') and (op.products_id = '9' or op.products_id = '16' or op.products_id = '10' or op.products_id = '13') and s.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
                              $search . " order by o.orders_id DESC";
        }
    When I run the above snippet, I get "WARNING: An Error occurred, please refresh the page and try again."

    Any help would be greatly appreciated on figuring out where I went wrong.

    P.S, As you go through the code, you will notice that I am only filtering for orders that are pending or in progress. I did not want to show completed or canceled orders.
    Last edited by riomaha; 16 Aug 2016 at 03:59 PM.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: WARNING: An Error occurred, please refresh the page and try again

    You'll need to look at the error message that was recorded in your /logs/ folder, and then take action based on what it's telling you is wrong.
    Ref: http://www.zen-cart.com/content.php?...-and-try-again
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jul 2012
    Posts
    16,732
    Plugin Contributions
    17

    Default Re: WARNING: An Error occurred, please refresh the page and try again

    Visually, I see two potential areas where something might go wrong though the directions DrByte offered are really the only help that can be provided considering the variables involved.

    There are two "lines" where data is subsequently appended. If the follow-on data doesn't have a space in front, then the query could get "mangled". For example:
    Code:
    er_total" .
                              $new_fields
    If $new_fields = 'new_field1' then the end of the previous line would append the new field onto the end like _totalnew_field1 and this is likely an unknown field. Having an extra space at the end won't hurt anything and would prevent a problem like I described... But, that myDebug file should reveal your issue(s).
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Oct 2013
    Location
    MTL
    Posts
    66
    Plugin Contributions
    2

    Default Re: WARNING: An Error occurred, please refresh the page and try again

    Thank you both for guiding me. I checked the logs and indeed there an error just MC12345678 stated it would be. I didn't have the logs enabled at first and for that I apologize to everyone.

    I was able to sort it out and that is in part thanks to you. I also realized, I was not adding the code to the right section of the page.
    For those who are curious
    I created a new drop down

    HTML Code:
     // prepare order-priority pulldown list
      $priority = array(array('id' => 'ot_priority_handling_categoryX', 'text' => Category X - Priority 1'), 
    	array('id' => 'ot_priority_handling_2CategoryX', 'text' => 'Category X - Priority 4'), 
    	array('id' => 'ot_priority_handling_3CategoryY', 'text' => 'Category Y Priority 1'), 
    	array('id' => 'ot_priority_handling_4CategoryY', 'text' => 'Category Y Priority 4'));
    Then below

    HTML Code:
                <div class="form-group col-xs-4 col-sm-3 col-md-3 col-lg-3">
                  <?php echo zen_draw_form('status', FILENAME_ORDERS, '', 'get', '', true);
                    echo '<label for="selectstatus" class="sr-only">' . HEADING_TITLE_STATUS . '</label> ' . zen_draw_pull_down_menu('status', array_merge(array(array('id' => '', 'text' => TEXT_ALL_ORDERS)), $orders_statuses), (int)$_GET['status'], 'class="form-control" onChange="this.form.submit();" id="selectstatus"');
                    echo '</form>';
                  ?>
                </div>
    I added..

    HTML Code:
     <div class="form-group col-xs-4 col-sm-3 col-md-3 col-lg-3">
                  <?php echo zen_draw_form('priority', FILENAME_ORDERS, '', 'get', '', true);
                    echo '<label for="priority" class="sr-only">' . HEADING_TITLE_priority . '</label> ' . zen_draw_pull_down_menu('priority', array_merge(array(array('id' => '', 'text' => TEXT_ALL_ORDERS)), $priority), $_GET['priority'], 'class="form-control" onChange="this.form.submit();" id="priority"');
                    echo '</form>';
                  ?>
                </div>

    Then above

    HTML Code:
    // Only one or the other search
    // create search_orders_products filter
      $search = '';
      $new_table = '';
      $new_fields = '';
      if (isset($_GET['search_orders_products']) && zen_not_null($_GET['search_orders_products'])) {
    I added


    HTML Code:
    // Only one or the other search
    // create search_orders_products filter
      $search = '';
      $new_table = '';
      $new_fields = '';
    if ($_GET['priority'] != '') {
    if ($_GET['priority'] == 'ot_priority_categoryX') {
          $priority = zen_db_prepare_input($_GET['priority']);
          $orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, 'See Order Details' as order_total" . $new_fields ."
                              from (" . TABLE_ORDERS_STATUS . " s, " .
    			  TABLE_ORDERS . " o " .
                              $new_table . ")
                              left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id)" . "
    			  left join " . TABLE_ORDERS_PRODUCTS . " op on (o.orders_id = op.orders_id)" . "
                              where ot.class like '%ot_priority_handling%' and o.orders_status = s.orders_status_id and (o.orders_status = '1' or o.orders_status = '2') and (op.products_id = '9' or op.products_id = '16' or op.products_id = '10' or op.products_id = '13') and s.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
                              $search . " order by o.orders_id DESC";
        } elseif ($_GET['priority'] == 'ot_priority_categoryY') {
    
          $priority = zen_db_prepare_input($_GET['priority']);
          $orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, 'See Order Details' as order_total" .
                              $new_fields . "
                              from (" . TABLE_ORDERS_STATUS . " s, " .
    			  TABLE_ORDERS . " o " .
                              $new_table . ")
                              left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id)" . "
    			  left join " . TABLE_ORDERS_PRODUCTS . " op on (o.orders_id = op.orders_id)" . "
                              where o.orders_status = s.orders_status_id and (o.orders_status = '1' or o.orders_status = '2') and (op.products_id = '9' or op.products_id = '16' or op.products_id = '10' or op.products_id = '13') and s.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
                              $search . " order by o.orders_id DESC";
    
    // Category Z
        } elseif ($_GET['priority'] == 'ot_priority_categoryZ') {
          $priority = zen_db_prepare_input($_GET['priority']);
          $orders_query_raw = "select o.orders_id, o.customers_id, o.customers_name, o.payment_method, o.shipping_method, o.date_purchased, o.last_modified, o.currency, o.currency_value, s.orders_status_name, 'See Order Details' as order_total" .
                              $new_fields . "
                              from (" . TABLE_ORDERS_STATUS . " s, " .
    			  TABLE_ORDERS . " o " .
                              $new_table . ")
                              left join " . TABLE_ORDERS_TOTAL . " ot on (o.orders_id = ot.orders_id)" . "
    			  left join " . TABLE_ORDERS_PRODUCTS . " op on (o.orders_id = op.orders_id)" . "
                              where ot.class like '%ot_priority_handling%' and o.orders_status = s.orders_status_id and (o.orders_status = '1' or o.orders_status = '2') and (op.products_id = '3' or op.products_id = '5' or op.products_id = '4' or op.products_id = '11') and s.language_id = '" . (int)$_SESSION['languages_id'] . "'" .
                              $search . " order by o.orders_id DESC";
    
        } elseif {......

 

 

Similar Threads

  1. v151 WARNING: An Error occurred, please refresh the page and try again
    By pramitha in forum General Questions
    Replies: 5
    Last Post: 12 Jul 2016, 10:25 AM
  2. v150 WARNING: An Error occurred, please refresh the page and try again.
    By l3ackdraft in forum Upgrading to 1.5.x
    Replies: 13
    Last Post: 13 Jun 2016, 10:13 PM
  3. v150 WARNING: An Error occurred, please refresh the page and try again.
    By dochsa in forum General Questions
    Replies: 2
    Last Post: 6 Sep 2012, 08:10 AM
  4. Replies: 1
    Last Post: 28 Aug 2012, 05:54 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR