Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2017
    Location
    India
    Posts
    22
    Plugin Contributions
    0

    Default Custom code is not working in 1.5.5e

    Hi all

    I'm using following code to store and manage ems information in database in order details page. So my admin/order.php file contains following custom code,. Its working good in my ZC1.3.9h live site. But this same code is not working in my new upgraded 1.5.5e website. It shows white page when i click "Update" button on order detail page. I guessed some order variable formats are changed in 1.5.5e. Please help

    Name:  Screenshot_1.jpg
Views: 189
Size:  26.3 KB

    PHP Code:
    // Justin 20111229 Code to update kuroobiya db with extra order info
    // Start KUROOBIYA ORDER INFO --------------------------------------------------------

         if (isset($_POST['update_costs']) && ($_POST['update_costs'] == 'on')) {
              
                 $order_check = $db->Execute("select orders_id from "
                                             . TABLE_ORDERS_KUROOBIYA_EXTRA . 
                                             " where orders_id = '" . zen_db_input($oID) . "'");
                 if ($order_check->RecordCount() > 0) {    
                     $order_info_sql = "UPDATE " . TABLE_ORDERS_KUROOBIYA_EXTRA . 
                                     " SET orders_status_id = '" . zen_db_input($status) .  "', " .
                                     "date_added = now(), " .
                                     "ems_cost = '" . zen_db_input($ems_cost) .  "', " .
                                     "manuf_denpyo = '" . zen_db_input($manuf_denpyo) .  "', " .
                                     "manuf_cost = '" . zen_db_input($manuf_cost) .  "', " .
                                     "manuf_shipping = '" . zen_db_input($manuf_shipping) .  "', " .
                                     "manuf_tax = '" . zen_db_input($manuf_tax) .  "' " .
                                     "WHERE orders_id = '" . zen_db_input($oID) . "'";     
                 }else{
                          $order_info_sql = "insert into " . TABLE_ORDERS_KUROOBIYA_EXTRA . "
                                  (orders_id, orders_status_id, date_added, ems_cost, manuf_denpyo, manuf_cost, manuf_shipping, manuf_tax)
                                  values ('" . (int)$oID . "',
                                  '" . zen_db_input($status) . "',
                                  now(),
                                  '" . zen_db_input($ems_cost) . "',
                                  '" . zen_db_input($manuf_denpyo)  . "',
                                  '" . zen_db_input($manuf_cost)  . "',
                                  '" . zen_db_input($manuf_shipping)  . "',
                                  '" . zen_db_input($manuf_tax)  . "')";
                 }
                 $db->Execute($order_info_sql);
            }
            
    //END Kuroobiya Extra Order Info ..........................................    

    // KUROOBIYA ORDER INFO BEGIN, INCLUDE DATABASE FIELDS ------------------------------
    $order_info = $db->Execute("select orders_id, orders_status_id, date_added, ems_cost, manuf_denpyo, manuf_cost, manuf_shipping, manuf_tax
                                        from "
                                     . TABLE_ORDERS_KUROOBIYA_EXTRA . 
                                     " where orders_id = '" . zen_db_input($oID) . 
                                     "' order by date_added");
     if ($order_info->RecordCount() > 0) {                                 
        $ems_cost = (empty($order_info->fields['ems_cost']) ? '' : $order_info->fields['ems_cost'] );
        $manuf_denpyo = (empty($order_info->fields['manuf_denpyo']) ? '' : $order_info->fields['manuf_denpyo'] );
        $manuf_cost = (empty($order_info->fields['manuf_cost']) ? '' : $order_info->fields['manuf_cost'] );
        $manuf_shipping = (empty($order_info->fields['manuf_shipping']) ? '' : $order_info->fields['manuf_shipping'] );
        $manuf_tax = (empty($order_info->fields['manuf_tax']) ? '' : $order_info->fields['manuf_tax'] );
     }
     
    // END KUROOBIYA ORDER INFO-----------------------------------------------------------      

    <!-- START KUROOBIYA- EXTRA TRACKING INFORMATION -->
    <tr><td>
          <table width="100%" border="1" cellspacing="0" cellpadding="3">
             <tr>
                 <td class="main" colspan=5><strong>order_info</strong></td>
               </tr>
               <tr>
                 <td valign="top" >ems_cost: <?php echo zen_draw_input_field('ems_cost',$ems_cost ); ?></td>
                 <td valign="top" >manuf_denpyo: <?php echo zen_draw_input_field('manuf_denpyo',$manuf_denpyo ); ?></td>
                 <td valign="top" >manuf_cost: <?php echo zen_draw_input_field('manuf_cost',$manuf_cost ); ?></td>
                 <td valign="top" >manuf_ship: <?php echo zen_draw_input_field('manuf_shipping',$manuf_shipping ); ?></td>
                 <td valign="top" >manuf_tax: <?php echo zen_draw_input_field('manuf_tax',$manuf_tax ); ?></td>
               </tr>
               </table>
    </td></tr>
               
    <!-- END KUROOBIYA- EXTRA TRACKING INFORMATION -->

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,478
    Plugin Contributions
    88

    Default Re: Custom code is not working in 1.5.5e

    A "white page" implies that there's a myDEBUG-adm-*.log file waiting in your store's /logs directory to let you know what the issue is.

    If you post the contents, remember that the myDEBUG-adm-*.log files contain references to your Zen Cart admin directory's name, so be sure to xxx-out those names!

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

    Default Re: Custom code is not working in 1.5.5e

    When provided/confronted with a white page or partial white page, the following FAQ is very helpful: http://www.zen-cart.com/content.php?124-blank-page
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

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

    Default Re: Custom code is not working in 1.5.5e

    You've got mixed PHP and HTML, but haven't told it to transition between the two.

    Add ?> here:

    Code:
    // END KUROOBIYA ORDER INFO-----------------------------------------------------------      
    ?>
    <!-- START KUROOBIYA- EXTRA TRACKING INFORMATION -->
    .

    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.

  5. #5
    Join Date
    Mar 2017
    Location
    India
    Posts
    22
    Plugin Contributions
    0

    Default Re: Custom code is not working in 1.5.5e

    Hi All

    Thanks for your suggestions.

    I've fixed whitepage issue to changed zen_db_scrub_in to zen_db_prepare_input using this thread in admin/orders.php.

    https://www.zen-cart.com/printthread...&pp=10&page=47

    But still i cant make it work following code to update and retrieve custom data from table in admin/orders.php

    PHP Code:
    <?php          
              
    // KUROOBIYA ORDER INFO BEGIN, INCLUDE DATABASE FIELDS ------------------------------
    $order_info $db->Execute("select orders_id, orders_status_id, date_added, ems_cost, manuf_denpyo, manuf_cost, manuf_shipping, manuf_tax
                                        from "
                                     
    TABLE_ORDERS_KUROOBIYA_EXTRA 
                                     
    " where orders_id = '" zen_db_input($oID) . 
                                     
    "' order by date_added");
     if (
    $order_info->RecordCount() > 0) {                                 
        
    $ems_cost = (empty($order_info->fields['ems_cost']) ? '' $order_info->fields['ems_cost'] );
        
    $manuf_denpyo = (empty($order_info->fields['manuf_denpyo']) ? '' $order_info->fields['manuf_denpyo'] );
        
    $manuf_cost = (empty($order_info->fields['manuf_cost']) ? '' $order_info->fields['manuf_cost'] );
        
    $manuf_shipping = (empty($order_info->fields['manuf_shipping']) ? '' $order_info->fields['manuf_shipping'] );
        
    $manuf_tax = (empty($order_info->fields['manuf_tax']) ? '' $order_info->fields['manuf_tax'] );
     }
     
     
    // END KUROOBIYA ORDER INFO-----------------------------------------------------------      
     
    ?>   

    <!-- START KUROOBIYA- EXTRA TRACKING INFORMATION -->
    <tr><td>
          <table width="100%" border="1" cellspacing="0" cellpadding="3">
             <tr>
                 <td class="main" colspan=5><strong>order_info</strong></td>
               </tr>
               <tr>
                 <td valign="top" >ems_cost: <?php echo zen_draw_input_field('ems_cost',$ems_cost ); ?></td>
                 <td valign="top" >manuf_denpyo: <?php echo zen_draw_input_field('manuf_denpyo',$manuf_denpyo ); ?></td>
                 <td valign="top" >manuf_cost: <?php echo zen_draw_input_field('manuf_cost',$manuf_cost ); ?></td>
                 <td valign="top" >manuf_ship: <?php echo zen_draw_input_field('manuf_shipping',$manuf_shipping ); ?></td>
                 <td valign="top" >manuf_tax: <?php echo zen_draw_input_field('manuf_tax',$manuf_tax ); ?></td>
               </tr>
               </table>
    </td></tr>
               
    <!-- END KUROOBIYA- EXTRA TRACKING INFORMATION -->
    PHP Code:
    <?php
    // KUROOBIYA ORDER INFO  BEGIN, DEFINE VALUES  Justin 20111229-------------------------------------
            
    $ems_cost str_replace(" """zen_db_prepare_input($_POST['ems_cost']));
            
    $manuf_denpyo str_replace(" """zen_db_prepare_input($_POST['manuf_denpyo']));
            
    $manuf_cost str_replace(" """zen_db_prepare_input($_POST['manuf_cost']));
            
    $manuf_shipping str_replace(" """zen_db_prepare_input($_POST['manuf_shipping']));
            
    $manuf_tax str_replace(" """zen_db_prepare_input($_POST['manuf_tax']));        
    // END KUROOBIYA ORDER INFO --------------------------------------------------------
    // Justin 20111229 Code to update kuroobiya db with extra order info
    // Start KUROOBIYA ORDER INFO --------------------------------------------------------

         
    if (isset($_POST['update_costs']) && ($_POST['update_costs'] == 'on')) {
              
                 
    $order_check $db->Execute("select orders_id from "
                                             
    TABLE_ORDERS_KUROOBIYA_EXTRA 
                                             
    " where orders_id = '" zen_db_input($oID) . "'");
                 if (
    $order_check->RecordCount() > 0) {    
                     
    $order_info_sql "UPDATE " TABLE_ORDERS_KUROOBIYA_EXTRA 
                                     
    " SET orders_status_id = '" zen_db_input($status) .  "', " .
                                     
    "date_added = now(), " .
                                     
    "ems_cost = '" zen_db_input($ems_cost) .  "', " .
                                     
    "manuf_denpyo = '" zen_db_input($manuf_denpyo) .  "', " .
                                     
    "manuf_cost = '" zen_db_input($manuf_cost) .  "', " .
                                     
    "manuf_shipping = '" zen_db_input($manuf_shipping) .  "', " .
                                     
    "manuf_tax = '" zen_db_input($manuf_tax) .  "' " .
                                     
    "WHERE orders_id = '" zen_db_input($oID) . "'";     
                 }else{
                          
    $order_info_sql "insert into " TABLE_ORDERS_KUROOBIYA_EXTRA "
                                  (orders_id, orders_status_id, date_added, ems_cost, manuf_denpyo, manuf_cost, manuf_shipping, manuf_tax)
                                  values ('" 
    . (int)$oID "',
                                  '" 
    zen_db_input($status) . "',
                                  now(),
                                  '" 
    zen_db_input($ems_cost) . "',
                                  '" 
    zen_db_input($manuf_denpyo)  . "',
                                  '" 
    zen_db_input($manuf_cost)  . "',
                                  '" 
    zen_db_input($manuf_shipping)  . "',
                                  '" 
    zen_db_input($manuf_tax)  . "')";
                 }
                 
    $db->Execute($order_info_sql);
            }
            
    //END Kuroobiya Extra Order Info ..........................................    */
    ?>
    Please any one. What is wrong with this code and queries? Same code is working good in my old ZC1.3.9h website
    Last edited by Prabu; 24 Mar 2017 at 08:24 AM.

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

    Default Re: Custom code is not working in 1.5.5e

    From looking at ONLY the code snippets you quoted, there doesn't appear to be anything wrong with them.

    But if you're still getting a "blank white page", then there *are* some critical PHP errors happening. They'll be recorded in the server's /logs/ directory. Read them to get more information about what to fix. Ref: http://www.zen-cart.com/content.php?124-blank-page
    .

    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.

  7. #7
    Join Date
    Mar 2017
    Location
    India
    Posts
    22
    Plugin Contributions
    0

    Default Re: Custom code is not working in 1.5.5e

    Quote Originally Posted by DrByte View Post
    From looking at ONLY the code snippets you quoted, there doesn't appear to be anything wrong with them.

    But if you're still getting a "blank white page", then there *are* some critical PHP errors happening. They'll be recorded in the server's /logs/ directory. Read them to get more information about what to fix. Ref: http://www.zen-cart.com/content.php?124-blank-page
    Hi

    I've fixed white page issue. No issues. But i'm wondering even Select query is not working to retrieve the values from database. I guessed its something went wrong in my Sql queries.

 

 

Similar Threads

  1. v151 my custom jQuery code does not work, why??
    By tlyczko in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 27 Dec 2012, 12:09 AM
  2. Custom Page Not Found Is Not Working
    By bluelightnin6 in forum General Questions
    Replies: 2
    Last Post: 8 Jan 2012, 08:42 AM
  3. Custom Code not working
    By nitesh107 in forum All Other Contributions/Addons
    Replies: 5
    Last Post: 3 Jun 2011, 06:45 PM
  4. Custom Template Not working
    By isokodesign in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 8 Mar 2007, 03:45 PM
  5. Custom Keywords not working
    By CnTGifts in forum General Questions
    Replies: 5
    Last Post: 25 Sep 2006, 04:04 AM

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