Jump to content

Save Reload Button on Admin Orders Page


Claudia

Recommended Posts

True, there is no Save button on the Orders List page.

As a temp work-around, there is a pair of drop-down selectors below the list that defaults to "Don't Change" and "Do Nothing". But pressing the Go button will submit the form which comprises the entirety of the table.

 

Link to comment
Share on other sites

What field (column) is editable? Has it ever saved before?

Please use the browser's Developer's Tools, Network screen.

When clicking the Go button, the Network screen will show a POST entry. Highlight the POST entry and look at the Request Payload. Is your form element listed?

Link to comment
Share on other sites

I think this is what you want:

POST
   https://www.claudiasbargains.com/admin_xxxxxxx.php?_g=orders&sold_site[0]=cb-store&multi-status=&multi-action=&go=Go&search[order_number]=&search[search_customer_id]=&search[statu

 

This is Request Payload:   -----------------------------7665031632393229901537355182

The cb-store is my editible column

I had that column ajax from my admin/customer but could never get it to save to the order when I updated the customer so I removed coding from customer and removed the ajax_sold_site from the order - just have it as sold_site.  I can change the sold_site "inside" the order and it will change on the main orders tab and in the special data tab I have in the order.  I just can't change and save from the main "orders" tab where it shows all the orders.

 

 

Link to comment
Share on other sites

In the admin /source/orders.index.inc.php file, where is it that you have placed the new code that processes your newly editable field?

I would suggest just above near line 720:

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

Your code would start with:

    } elseif (isset($_POST['sold_site']) && !empty($_POST['sold_site'])) {
      ....

The Request Payload should be more than what you have shown above:

-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="multi-status"


-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="multi-action"


-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="go"

Go
-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="search[order_number]"


-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="search[search_customer_id]"


-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="search[status]"


-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="search[date][from]"


-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="search[date][to]"


-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="month_purge"


-----------------------------234527848935122883861447253878
Content-Disposition: form-data; name="token"

9f4e62fbad1f0e1fc50fec49d936b7e2
-----------------------------234527848935122883861447253878--

 

Link to comment
Share on other sites

I don't have anything for sold_site at line 720.  What whould my full code be?

I had my code for other stuff around line 327"

example:

 $filemanager = new FileManager(FileManager::FM_FILETYPE_DL);
                foreach ($inventory as $product) {
                  if ( empty($product['excel_name']) ) {
   $product_excel_name_record =
$GLOBALS['db']->select('CubeCart_inventory','excel_name',array('product_id'
=> $product['product_id']));
   $product['excel_name'] = $product_excel_name_record[0]['excel_name'];
}    

Link to comment
Share on other sites

It's my suggestion that your code would be above that line (which is near line 720 in CC647 admin skin).

Do you have any code to process that new column?

Has there been any prior discussion on the forum about customizing your admin skin to do this?

Link to comment
Share on other sites

"Do you have any code to process that new column?"

In looking closer I don't think I did for this sold_site column

"Has there been any prior discussion on the forum about customizing your admin skin to do this?"

Yes for my stuff shown above - but nothing for the Orders tab where there is no save button

And the info won't be coming from the "product"  like the other code.  It will all stay in the order summary.  I had this in the source customer before I removed it

  if (isset($_POST['sold_site']) && is_array($_POST['sold_site']) && Admin::getInstance()->permissions('customers', CC_PERM_EDIT)) {
        foreach ($_POST['sold_site'] as $customer_id => $sold_site) {
            $result = $result || $GLOBALS['db']->update('CubeCart_customer', array('sold_site' => $sold_site), array('customer_id' => (int)$customer_id));
        }
                if ($result) {
            $GLOBALS['main']->successMessage("Some or all Sold Sites updated.");
        }
        $send_redirect = true;
    }

 

Link to comment
Share on other sites

in the admin/skin/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>{$THEAD.sold_site}</td>

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

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

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

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

               <td>&nbsp;</td>

            </tr>

         </thead>

 

Line 50:

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

Link to comment
Share on other sites

In /sources/orders.index.inc.php:

Find near line 720:

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

Change to:

} elseif (isset($_POST['sold_site'])) {
	foreach ($_POST['sold_site'] as $order_id => $site_name) {
		$GLOBALS['db']->update('CubeCart_order_summary', array('sold_site' => $site_name), array('cart_order_id' => $order_id));
	}
	$GLOBALS['main']->successMessage("One or more orders were updated with their sold site.");
    } elseif (isset($_GET['search'])) {

Line 50 of the template needs fixing:

From:

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

To:

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

And there is something I don't like about lines 35-37 of the /source/ file code. When clicking a submit button (Go, Save, Search), the 'search' form elements do show up in the POST, although there are no values with them. That will cause an httpredir with everything in POST put in the querystring. That is very non-optimal.

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));

You might need to have CubeCart clear its internal cache because of the fix in the template.

Test extensively.

Link to comment
Share on other sites

Just to follow up to make the comment that there exists an alternate set of code edits -- not that these edits are any less than optimal -- if and only if the admin also checks the box for each row edited, but keeps the drop-down selectors at Don't Change and Do Nothing.

 

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