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)
-   -   Admin Change All Status (https://forum.x-cart.com/showthread.php?t=13096)

sstillwell@aerostich.com 03-30-2005 06:18 AM

Admin Change All Status
 
This is a really simple mod.

My order processors really like the "Check All" link when dealing with orders. I wanted to create a similar link that does the same thing for the order status drop down box. I wanted a link to set them all to Processed, then another to set them all to Complete.

Here goes.

1. In skin1/main/orders_list.tpl

Add:
Code:

orderstatus = new Array({foreach from=$orders item=v key=k}{if $k > 0},{/if}'order_status[{$v.orderid}]'{/foreach});
After:
Code:

<SCRIPT type="text/javascript" language="JavaScript 1.2">
<!--
checkboxes_form = 'processorderform';
checkboxes = new Array({foreach from=$orders item=v key=k}{if $k > 0},{/if}'orderids[{$v.orderid}]'{/foreach});


To look like:
Code:

<SCRIPT type="text/javascript" language="JavaScript 1.2">
<!--
checkboxes_form = 'processorderform';
checkboxes = new Array({foreach from=$orders item=v key=k}{if $k > 0},{/if}'orderids[{$v.orderid}]'{/foreach});
orderstatus = new Array({foreach from=$orders item=v key=k}{if $k > 0},{/if}'order_status[{$v.orderid}]'{/foreach});
 
-->
</SCRIPT>


AND

Add:
Code:

<DIV style="line-height:170%">Change all to Processed / Change all to Complete</DIV>

After:
Code:

<DIV style="line-height:170%">{$lng.lbl_check_all} / {$lng.lbl_uncheck_all}</DIV>

To look like:
Code:

{include file="change_all_checkboxes.tpl"}

<DIV style="line-height:170%">{$lng.lbl_check_all} / {$lng.lbl_uncheck_all}</DIV>
<DIV style="line-height:170%">Change all to Processed / Change all to Complete</DIV>
<TABLE border="0" cellpadding="2" cellspacing="1" width="100%">

<FORM action="process_order.php" method="POST" name="processorderform">


2. In skin1/change_all_checkboxes.tpl

Add:
Code:

function change_all_status(flag, formname, arr) {ldelim}
var x;
        if(!formname)
                formname = checkboxes_form;
        if(!arr)
                arr = orderstatus;
        if(!document.forms[formname] || arr.length == 0)
                return false;
        for(x = 0; x < arr.length; x++)
                if(arr[x] != '' && document.forms[formname].elements[arr[x]])
                          document.forms[formname].elements[arr[x]].selectedIndex = flag;
{rdelim}


After:
Code:

function change_all(flag, formname, arr) {ldelim}
var x;
        if(!formname)
                formname = checkboxes_form;
        if(!arr)
                arr = checkboxes;
        if(!document.forms[formname] || arr.length == 0)
                return false;
        for(x = 0; x < arr.length; x++)
                if(arr[x] != '' && document.forms[formname].elements[arr[x]])
                          document.forms[formname].elements[arr[x]].checked = flag;
{rdelim}


To look like:
Code:

<SCRIPT>
function change_all(flag, formname, arr) {ldelim}
var x;
        if(!formname)
                formname = checkboxes_form;
        if(!arr)
                arr = checkboxes;
        if(!document.forms[formname] || arr.length == 0)
                return false;
        for(x = 0; x < arr.length; x++)
                if(arr[x] != '' && document.forms[formname].elements[arr[x]])
                          document.forms[formname].elements[arr[x]].checked = flag;
{rdelim}


function change_all_status(flag, formname, arr) {ldelim}
var x;
        if(!formname)
                formname = checkboxes_form;
        if(!arr)
                arr = orderstatus;
        if(!document.forms[formname] || arr.length == 0)
                return false;
        for(x = 0; x < arr.length; x++)
                if(arr[x] != '' && document.forms[formname].elements[arr[x]])
                          document.forms[formname].elements[arr[x]].selectedIndex = flag;
{rdelim}
</SCRIPT>


DanUK 10-05-2005 03:52 AM

Thanks for this, just tested it out and it works great!

Thanks again,

Dan

weckie 10-05-2005 04:52 AM

Hmm nice done, BUT: Very dangerous when you use it. Take care.

We got per day about 25 orders, and each order has different status, because the status depends on several things. f.i. payment moment/receiving.

Just a little note......

DanUK 10-05-2005 04:55 AM

It would be handy if it would update all CHECKED rather than all at once, that might help. Not sure how this is done yet.

Dan

sstillwell@aerostich.com 10-05-2005 06:28 AM

Weckie,
We get about 150 orders a day and have not had a problem, but then again we just use the front end for order taking. The orders are then set at complete and entered into our back office order processing software.

Dan,
Yeah, I agree, but it was a simple javascript hack that works great.

DanUK 10-05-2005 06:53 AM

Actually, it's not a problem for us as we're filtering by Queued anyway.

Thanks again

Dan

DanUK 10-11-2005 05:16 AM

Just a quick update, I surrounded the code that displays the links with an if statement to stop it showing when the customer looks at the Order History, so:



Code:

<DIV style="line-height:170%">Change all to Processed / Change all to Complete</DIV>

changes to:

Code:

{if $usertype ne "C"}
<DIV style="line-height:170%">Change all to Processed / Change all to Complete</DIV>
{/if}


Dan

jdedba 03-15-2006 12:55 PM

Thank you for the mod.


All times are GMT -8. The time now is 05:11 PM.

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