X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Change all Processed Orders to Complete (https://forum.x-cart.com/showthread.php?t=67817)

chrischall 09-24-2013 03:08 AM

Change all Processed Orders to Complete
 
Hi all,

We were finding it quite laborious individually changing the dropdown status of a page full of orders from processed to complete so got xcart to write some javascript to change them all with one click of a button. It was written for a 4.1 store but just successfully installed on a 4.5.5 version so guessing it would work on most shops.

1) Create a file called change_all_statuses.tpl in skin/common_files/ and put this in it:

Code:

{*
Parameters:
        statuses                        - array of tag names
        statuses_form                - form name with these statuses
*}
<SCRIPT>
function change_stat_all() {ldelim}
var x, y;
var formname, arr, options;
        formname = statuses_form;
        arr = statuses;
        if(!document.forms[formname] || arr.length == 0)
                return false;
        for(x = 0; x < arr.length; x++)
                if(document.forms[formname].elements[arr[x]] && document.forms[formname].elements[arr[x]].options[document.forms[formname].elements[arr[x]].selectedIndex].value == 'P') {ldelim}
                        options = document.forms[formname].elements[arr[x]].options;
                        for(y = 0; y < options.length; y++)
                                if(options[y].value == 'C')
                                        document.forms[formname].elements[arr[x]].options[y].selected = true;
                {rdelim}
{rdelim}
</SCRIPT>



2) Open skin/common_files/main/orders_list.tpl

Code:

AFTER

var txt_delete_selected_orders_warning = "{$lng.txt_delete_selected_orders_warning|wm_remove|escape:javascript|strip_tags}";

INSERT

var statuses = new Array({foreach from=$orders item=v key=k}{if $k > 0},{/if}'order_status[{$v.orderid}]'{/foreach});
var old_statuses = new Array({foreach from=$orders item=v key=k}{if $k > 0},{/if}'order_status_old[{$v.orderid}]'{/foreach});
var statuses_form = 'processorderform';



AFTER

{include file="main/check_all_row.tpl" form="processorderform" prefix="orderids"}


INSERT

{include file="change_all_statuses.tpl"}
<div><a href="javascript:change_stat_all();">Change All Processed to Complete</a></div>


3) do a template cleanup


Hope somebody finds this useful!

CBONE 01-13-2014 10:20 PM

Re: Change all Processed Orders to Complete
 
Interesting, how exactly does it work? do you have to change all orders? or just the ones you select?

chrischall 01-14-2014 04:22 AM

Re: Change all Processed Orders to Complete
 
Basically it changes all orders listed on the orders search page from processed to complete - just uses javascript to change the value in the form dropdown.

If you only want to change some orders then do a specific orders search beforehand

xtech 01-15-2014 04:30 AM

Re: Change all Processed Orders to Complete
 
Hello,
can I able to see a demo? Will it work on 4.6.1 Platinum?

If I want to add tracking no from process to complete in bulk then will it work?

Thanks.

DanUK 10-22-2014 12:54 AM

Re: Change all Processed Orders to Complete
 
Works on 4.6.1, many thanks!


All times are GMT -8. The time now is 10:21 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.