Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Color coded order status...

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 10-26-2003, 05:03 AM
 
pipercub pipercub is offline
 

Advanced Member
  
Join Date: Oct 2002
Posts: 82
 

Default Color coded order status...

I created a mod to the orders.tpl file to change the color of the cells with the order info in them. The cells will change color according to the status of the order. This makes it very easy to glance at your screen to get the status.

Here is a screen capture of what I'm talking about. I'll post the code shortly. it's a very simple (yet effective) mod.

http://66.113.244.89/order_colors.gif

Piper
Reply With Quote
  #2  
Old 10-26-2003, 10:08 AM
 
shasan shasan is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: Toronto
Posts: 74
 

Default

hey, that's pretty cool. Would you be able to change the colours easily?
__________________
X-Cart 3.4.2 - Processor: Dual Hamsters, running on tricked out 21\" version of Hamster Wheel. (tireless little buggers)

No hamsters were harmed during the making of this sig. Several were seriously offended.
Reply With Quote
  #3  
Old 10-26-2003, 12:40 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Awesome MOD!

Can't wait to incorporate your code into my cart.
Reply With Quote
  #4  
Old 10-26-2003, 01:09 PM
 
pipercub pipercub is offline
 

Advanced Member
  
Join Date: Oct 2002
Posts: 82
 

Default

Quote:
Originally Posted by shasan
hey, that's pretty cool. Would you be able to change the colours easily?

Yup! The colors are controlled by a seperate .tpl file. you can edit them to whatever you like. It would really be cool to somehow incorporate the color settings into the "General Settings" page, but for now you just need to edit the color values in the tpl. Simple enough.

Piper

P.S. I've been realy busy lately, but I'll try to post the code tomorrow.
Reply With Quote
  #5  
Old 10-26-2003, 01:15 PM
 
shasan shasan is offline
 

Advanced Member
  
Join Date: Oct 2003
Location: Toronto
Posts: 74
 

Default

Nicely done.

Can't wait for the code.
__________________
X-Cart 3.4.2 - Processor: Dual Hamsters, running on tricked out 21\" version of Hamster Wheel. (tireless little buggers)

No hamsters were harmed during the making of this sig. Several were seriously offended.
Reply With Quote
  #6  
Old 10-26-2003, 03:07 PM
 
pipercub pipercub is offline
 

Advanced Member
  
Join Date: Oct 2002
Posts: 82
 

Default

Here's the code...

First, create a new template called 'order_colors.tpl' (or whatever you prefer). This file should live in the 'Main' directory. Paste the following into this new file:

Code:
{* $Id: orders_colors.tpl,v 1.0 2003/10/26 13:07:50 pipercub Exp $ *} {if $orders[cat_num].status eq "C"} bgcolor="#00CC00"} {/if} {if $orders[cat_num].status eq "P"} bgcolor="#FFFF99"} {/if} {if $orders[cat_num].status eq "F"} bgcolor="#FF33333"} {/if}

Obviously, you can add all of the status indicators that you need, but I only use these three. This is also where you change the colors.

Next, open 'main/orders.tpl'. Find the part of the code where the 'section' loop begins. Replace everything between {section name=cat_num loop=$orders} and {/section} with the following code:

*This is the easy method. Scroll down for the custom method.

Code:
{section name=cat_num loop=$orders} {math equation="x + ordertotal" x=$total ordertotal=$orders[cat_num].total assign="total"} {if $orders[cat_num].status eq "P" or $orders[cat_num].status eq "C"} {math equation="x + ordertotal" x=$total_paid ordertotal=$orders[cat_num].total assign="total_paid"} {/if} { if %cat_num.first% } <table border=0 width=100% cellspacing="1" cellpadding="0"> {/if} <tr> <td align="center" {include file="main/orders_colors.tpl"}> #{$orders[cat_num].orderid} </td> <td align="center" {include file="main/orders_colors.tpl"}> <input type=radio name=orderid value="{ $orders[cat_num].orderid }" { if %cat_num.first% }checked{/if}> </td> <td align="center" nowrap class=Text {include file="main/orders_colors.tpl"}> {$orders[cat_num].status} </td> <td nowrap align="center" {include file="main/orders_colors.tpl"}> <font class=Text>{$orders[cat_num].date|date_format:"%b-%d-%Y"}</font> </td> <td nowrap align="center" {include file="main/orders_colors.tpl"} class=Text> {if $usertype eq "A"}<a href="order.php?orderid={$orders[cat_num].orderid}"> { $orders[cat_num].firstname } { $orders[cat_num].lastname }</a> {/if} </td> <td nowrap align="center" {include file="main/orders_colors.tpl"} class=Text> {if $usertype eq "A"} { $orders[cat_num].provider } {else}<a href="order.php?orderid={$orders[cat_num].orderid}"> { $orders[cat_num].firstname } { $orders[cat_num].lastname }</a> {/if} </td> <td nowrap align=right class=Text {include file="main/orders_colors.tpl"}> {include file="currency.tpl" value=$orders[cat_num].total} </td> </tr> { if %cat_num.last% } <tr><td colspan=7 align=right height=20>{$lng.lbl_gross_total}: {include file="currency.tpl" value=$total}</td></tr> <tr><td colspan=7 align=right height=20>{$lng.lbl_total_paid}: {include file="currency.tpl" value=$total_paid}</td></tr> </table> {/if} {/section}

For theose who don't want to replace their file (due to other mods), you can simply paste:

Code:
{include file="main/orders_colors.tpl"}

between all of the <td> tags for the cells that you want to affect.

Example:
<td align="center" {include file="main/orders_colors.tpl"}>

Enjoy,
Piper
Reply With Quote

The following user thanks pipercub for this useful post:
vital (04-18-2012)
  #7  
Old 10-26-2003, 03:20 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Awesome. Absolutely awesome.

Implemented and I'm tweaking colours right now.

ADDED

Ok here is my colour scheme.

Blue for Complete
Grey for Incomplete
Red for Failed
Green for Processed
Yellow for Queued

Code:
{* $Id: orders_colors.tpl,v 1.0 2003/10/26 13:07:50 pipercub Exp $ *} {if $orders[cat_num].status eq "C"} bgcolor="#00CCFF"} {/if} {if $orders[cat_num].status eq "P"} bgcolor="#00FF66"} {/if} {if $orders[cat_num].status eq "Q"} bgcolor="#FFFF99"} {/if} {if $orders[cat_num].status eq "F"} bgcolor="#FF3333"} {/if} {if $orders[cat_num].status eq "I"} bgcolor="#CCCCCC"} {/if}

Hope you like it although it is very easy to change.
Reply With Quote
  #8  
Old 10-26-2003, 03:40 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

This is so great that my mind is racing with the possibilities.

It would be great to be able to implement this in the modify product listings. Show out of stock products or low stock products highlighted with colour.
Reply With Quote
  #9  
Old 10-26-2003, 03:55 PM
 
pipercub pipercub is offline
 

Advanced Member
  
Join Date: Oct 2002
Posts: 82
 

Default

adpboss,

Did you paste the entire chunk of code, or just the 'include'?

The reason I ask is because I modified the number of cells that xcart displays on the orders page. I didn't like to have to check a radio button and then hit 'Details', so I added the customers name and made it a hot link. I also modified the date format. All of this is in the big chunk of code.

Piper
Reply With Quote
  #10  
Old 10-26-2003, 03:59 PM
  adpboss's Avatar 
adpboss adpboss is offline
 

X-Man
  
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 2,389
 

Default

Piper,

I just went back and checked. Yes, I have the names and the dates. Great job!

I am just finishing modifying the product listings, and will post my code as I complete.

Thanks, this is really excellent.
Reply With Quote

The following user thanks adpboss for this useful post:
galenostr (10-13-2009)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:16 PM.

   

 
X-Cart forums © 2001-2020