Jump to content

Main Order Page in Admin


Claudia

Recommended Posts

I hate to keep bothering you all, but things have been creeping up and I don't know if it's related to CC6.4.9 and/or PHP 8. I haven't changed any of the code for this issue since 6.4.7 and I have basically the same thing in customers and products and it works fine.  Here goes:

On the main order page I have some custom columns that I have made editable.  That way I don't have to go into each order and input the info. I input it from the main order page and it populates the individual order.  Right now if I edit the info in the individual order it will populate the main order page.  I just can't edit and save on the main order page. Well it will let me input in the info just won't save it. Thanks in advance.

Here's my code in admin/skin/templates/order.index

Line 18:

 <thead>

            <tr>

               <td>&nbsp;</td>

               <td nowrap="nowrap">{$THEAD.cart_order_id}</td>

               <td>&nbsp;</td>

               <td>{$THEAD.customer}</td>

              <td>Sold Site</td>

               <td>{$THEAD.date}</td>

               <td>Order Date</td>

               <td nowrap="nowrap">{$THEAD.status}</td>

               <td>Delivery Date</td>

               <td>Feedback</td>

                <td>{$THEAD.total}</td>

               <td>&nbsp;</td>

            </tr>

         </thead>

 

Line 51:

<td><span class="editable" name="venue_sold_site[{$order.cart_order_id}]">{$order.venue_sold_site}</span></td>

              <td>{$order.date}</td>

               <td><span class="editable" name="all_order_date[{$order.cart_order_id}]">{$order.all_order_date}</span></td>

               <td class="{$order.status_class}">{$order.status}</td>

                <td><span class="editable" name="all_delivery_date[{$order.cart_order_id}]">{$order.all_delivery_date}</span></td>

               <td><span class="editable" name="feedback[{$order.cart_order_id}]">{$order.feedback}</span></td>

 

 

Here's my code in admin/sources/order.index.inc

Line 963:

$thead_sort = array(

        'venue_sold_site'   => $GLOBALS['db']->column_sort('venue_sold_site','Venue Sold Site', 'sort', $current_page, $_GET['sort']),

        'cart_order_id' => $GLOBALS['db']->column_sort('cart_order_id', $lang['orders']['order_number'], 'sort', $current_page, $_GET['sort']),

        'customer'   => $GLOBALS['db']->column_sort('customer', $lang['orders']['title_customer'], 'sort', $current_page, $_GET['sort']),

        'all_order_date'   => $GLOBALS['db']->column_sort('all_order_date', 'Order Date', 'sort', $current_page, $_GET['sort']),

        'all_delivery_date'   => $GLOBALS['db']->column_sort('all_delivery_date', 'Delivery Date', 'sort', $current_page, $_GET['sort']),

        'feedback'   => $GLOBALS['db']->column_sort('feedback','Feedback', 'sort', $current_page, $_GET['sort']),

        'status'   => $GLOBALS['db']->column_sort('status', $lang['common']['status'], 'sort', $current_page, $_GET['sort']),

        'date'    => $GLOBALS['db']->column_sort('order_date', $lang['common']['date'], 'sort', $current_page, $_GET['sort']),

        'total'   => $GLOBALS['db']->column_sort('total', $lang['basket']['total'], 'sort', $current_page, $_GET['sort'])

    );

Link to comment
Share on other sites

There needs to be a review of the edits made to admin, /sources/order.index.inc.php.

This file is the PHP code that will process and database the values for $_POST['venue_sold_site'], $_POST['all_order_date'], $_POST['all_delivery_date'], and $_POST['feedback'].

 

Link to comment
Share on other sites

I have this: (Forgot to post it)

 } else {
                    $GLOBALS['main']->errorMessage($lang['orders']['error_orders_delete']);
                }
            }
        }
        if ($updated) {
            $GLOBALS['main']->successMessage($lang['orders']['notify_orders_status']);
        }
        if (isset($_GET['redirect']) && $_GET['redirect'] == 'dashboard' && $_POST['multi-action'] == '') {
            httpredir('?', 'orders');
        } else {
            httpredir(currentPage(array('print_hash', 'multi-action'), $add_array));
        }
        } elseif (isset($_POST['venue_sold_site'])) {
    foreach ($_POST['venue_sold_site'] as $order_id => $site_name) {
        $GLOBALS['db']->update('CubeCart_order_summary', array('venue_sold_site' => $site_name), array('cart_order_id' => $order_id));
    }
    $GLOBALS['main']->successMessage("One or more orders Sold Sites were updated");
  } elseif (isset($_POST['all_order_date'])) {
    foreach ($_POST['all_order_date'] as $order_id => $site_name) {
        $GLOBALS['db']->update('CubeCart_order_summary', array('all_order_date' => $site_name), array('cart_order_id' => $order_id));
    }
    $GLOBALS['main']->successMessage("One or more orders All Order Dates were updated");
      } elseif (isset($_POST['all_delivery_date'])) {
    foreach ($_POST['all_delivery_date'] as $order_id => $site_name) {
        $GLOBALS['db']->update('CubeCart_order_summary', array('all_delivery_date' => $site_name), array('cart_order_id' => $order_id));
    }
    $GLOBALS['main']->successMessage("One or more orders All Delivery Dates were updated");
} elseif (isset($_POST['feedback'])) {
    foreach ($_POST['feedback'] as $order_id => $site_name) {
        $GLOBALS['db']->update('CubeCart_order_summary', array('feedback' => $site_name), array('cart_order_id' => $order_id));
    }
    $GLOBALS['main']->successMessage("One or more orders Feedbacks were updated");

    } elseif (isset($_GET['search'])) {

            // Search by date range

 

       

 

 

Link to comment
Share on other sites

Here is a condensed and abridged summation of the code (and a tad bit more) that was posted above:

if       (isset($_POST['multi-order']))
} elseif (isset($_POST['venue_sold_site'])) 
} elseif (isset($_POST['all_order_date']))
} elseif (isset($_POST['all_delivery_date']))
} elseif (isset($_POST['feedback']))
} elseif (isset($_GET['search']))        
} else { $where = (isset($_GET['customer_id']))
}

This shows that only one of these choices will ever happen.

So, if you add a new item of data to 'venue_sold_site' and 'feedback', you will not get the 'feedback' processed because 'venue_sold_site' got to it first, and then that's all there is to it!

Any number of rows can have new data added, as long as all of that new data is in the same column, per Save.

Link to comment
Share on other sites

Try this structure.

Find:

} else {
    if (isset($_POST['multi-order']) && !empty($_POST['multi-order'])) {
        // Update selected orders to given status

Between the first and second line, put the revised custom code:

} else {

    if (isset($_POST['venue_sold_site'])) { foreach ($_POST['venue_sold_site'] as $order_id => $site_name) { $GLOBALS['db']->update('CubeCart_order_summary', array('venue_sold_site' => $site_name), array('cart_order_id' => $order_id)); } $GLOBALS['main']->successMessage("One or more orders Sold Sites were updated"); }
    if (isset($_POST['all_order_date'])) { foreach ($_POST['all_order_date'] as $order_id => $site_name) { $GLOBALS['db']->update('CubeCart_order_summary', array('all_order_date' => $site_name), array('cart_order_id' => $order_id)); } $GLOBALS['main']->successMessage("One or more orders All Order Dates were updated"); }
    if (isset($_POST['all_delivery_date'])) { foreach ($_POST['all_delivery_date'] as $order_id => $site_name) { $GLOBALS['db']->update('CubeCart_order_summary', array('all_delivery_date' => $site_name), array('cart_order_id' => $order_id)); } $GLOBALS['main']->successMessage("One or more orders All Delivery Dates were updated"); }
    if (isset($_POST['feedback'])) { foreach ($_POST['feedback'] as $order_id => $site_name) { $GLOBALS['db']->update('CubeCart_order_summary', array('feedback' => $site_name), array('cart_order_id' => $order_id)); } $GLOBALS['main']->successMessage("One or more orders Feedbacks were updated"); }

    if (isset($_POST['multi-order']) && !empty($_POST['multi-order'])) {
        // Update selected orders to given status

This will do each column in turn.

Link to comment
Share on other sites

I found the topic:   https://forums.cubecart.com/topic/57993-save-reload-button-on-admin-orders-page/#comment-252113

 

I forgot to make this change in admin/skin/templates/order.index when I upgraded to 6.4.9. I kept my code as it was

 

Change line 36 from:

 

    httpredir('?_g=orders&'.http_build_query($_POST));

 

To:

    if (array_walk_recursive($_POST['search'],function($v,$k)use(&$aSearch){$aSearch=sprintf("%s%s",$aSearch,$v);},$aSearch) && !empty($aSearch)) httpredir('?_g=orders&'.http_build_query($_POST));

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
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...