Changing Order Status Fields

For Articles relating to more than one ISC version
Post Reply
Darntoothysam
Confirmed
Confirmed
Posts: 33
Joined: Wed Jun 17, 2009 8:47 pm

Changing Order Status Fields

Post by Darntoothysam »

For our website we need to change the Order Status fields from what they are, to some more custom settings. Things like "Awaiting Shipment" for us would be more like "Awaiting Parts" and we need to add a "Repair in Process" status as well.

Is there a way to change these order statuses on our end? This would be a big help for us.

Thanks!
Eric @ DarnToothySam.com
Painstik
Posts: 122
Joined: Sun Jul 19, 2009 1:19 pm
Location: Croatia

Re: Changing Order Status Fields

Post by Painstik »

You can change/add/remove order status messages in the database in table isc_order_status.

Open phpMyAdmin (or any other database program, but i'm writing for phpMyAdmin because I am using this one) -> _YourDatabaseName -> isc_order_status -> in tabs above, select browse -> edit each Order Status message by clicking on edit icon
Need custom coding for Interspire Shopping Cart? Contact me
Griever
Posts: 5
Joined: Fri Jul 24, 2009 7:27 pm

Re: Changing Order Status Fields

Post by Griever »

Painstik wrote:You can change/add/remove order status messages in the database in table isc_order_status.

Open phpMyAdmin (or any other database program, but i'm writing for phpMyAdmin because I am using this one) -> _YourDatabaseName -> isc_order_status -> in tabs above, select browse -> edit each Order Status message by clicking on edit icon
While this is possible, you should also define these new status constants in your [root]/lib/init.php file so you can execute code based on particular status'.
Darntoothysam
Confirmed
Confirmed
Posts: 33
Joined: Wed Jun 17, 2009 8:47 pm

Re: Changing Order Status Fields

Post by Darntoothysam »

Griever wrote:
Painstik wrote:You can change/add/remove order status messages in the database in table isc_order_status.

Open phpMyAdmin (or any other database program, but i'm writing for phpMyAdmin because I am using this one) -> _YourDatabaseName -> isc_order_status -> in tabs above, select browse -> edit each Order Status message by clicking on edit icon
While this is possible, you should also define these new status constants in your [root]/lib/init.php file so you can execute code based on particular status'.
Now you lost me, can you elaborate on that a little more? A php programmer, I am not, so more information for me is better!
Griever
Posts: 5
Joined: Fri Jul 24, 2009 7:27 pm

Re: Changing Order Status Fields

Post by Griever »

Hah, no worries!

If you don't throw those extra values (and add them into a few files which I will explain in a bit) you could run into problems when you want to load specific orders, search by status, etc. So if you open up that init.php file and scroll down a little, you can see these couple lines...

Code: Select all

define('ORDER_STATUS_INCOMPLETE', 0);
	define('ORDER_STATUS_PENDING', 1);
	define('ORDER_STATUS_SHIPPED', 2);
	define('ORDER_STATUS_PARTIALLY_SHIPPED', 3);
	define('ORDER_STATUS_REFUNDED', 4);
	define('ORDER_STATUS_CANCELLED', 5);
	define('ORDER_STATUS_DECLINED', 6);
	define('ORDER_STATUS_AWAITING_PAYMENT', 7);
	define('ORDER_STATUS_AWAITING_PICKUP', 8);
	define('ORDER_STATUS_AWAITING_SHIPMENT', 9);
	define('ORDER_STATUS_COMPLETED', 10);
	define('ORDER_STATUS_AWAITING_FULFILLMENT', 11);
These are the default constants that Interspire uses for its ordering statuses. If you take a look and compare this data to the default database values, you can see that they actually align. For example, "ORDER_STATUS_AWAITING_FULFILLMENT" has an index value of 11. If you pop into the database, you'll notice that the 11th value is "Awaiting Fulfillment". This just goes to show that thereis a relationship between both the statuses found in the code and those found in the database.

Anyway, if you want to add in your own values to the code, such as "ORDER_STATUS_PACKAGE_LOST" or something like that, you could just add:

Code: Select all

define('ORDER_STATUS_PACKAGE_LOST', 12);
and you'd be all set.

Now, let's say we wanted to actually USE these new values. A good example is to check out the admin backend dashboard and view some of it's magic. If you notice, the dashboard shows some of your recent orders and the status of that particular order. If we open up the "/admin/includes/classes/class.index.php" file and check out the "LoadRecentOrders()" function, we can see the following switch statement:

Code: Select all

// Determine which statuses we'll be showing orders for. Will be used in the query.
		switch($status)
		{
			case 'pending':
				$statusIn = array(
					ORDER_STATUS_PENDING,
					ORDER_STATUS_PARTIALLY_SHIPPED,
					ORDER_STATUS_AWAITING_PAYMENT,
					ORDER_STATUS_AWAITING_SHIPMENT,
					ORDER_STATUS_AWAITING_FULFILLMENT,
					ORDER_STATUS_AWAITING_PICKUP,
				);
				break;
			case 'completed':
				$statusIn = array(
					ORDER_STATUS_SHIPPED,
					ORDER_STATUS_COMPLETED
				);
				break;
			case 'refunded':
				$statusIn = array(
					ORDER_STATUS_REFUNDED,
					ORDER_STATUS_CANCELLED
				);
				break;
			default:
				$status = 'recent';
		}
Just as the comment says, this block determines which statuses you will be accessing to show orders for. So if any of your new statuses falls into the categories of "pending", "competed" or "refunded" then you can simply add in the constant value right there and you'll be right as rain. If all goes to plan, this should pull your orders for those order statuses. Please keep in mind, i have no actually tested this, but based on what I have looked around with, this should work perfectly fine. I'll try and do some testing when I get a chance later on.

There are seriously a lot of different things you can do with statuses, and this is only the tip of the iceberg. Just for kicks, if you look the "/lib/orders.php" file, you can do some simple searches for keyword constants like "ORDER_STATUS_COMPLETED" and you'll see a lot of the ways that Interspire uses constants to determine things like whether or not an order is complete, digital orders, etc.

Hope this helps ya!
pitorian
Posts: 31
Joined: Mon Aug 17, 2009 9:55 am

Re: Changing Order Status Fields

Post by pitorian »

Guys quick question,

I have added a new Status to the Database and the init.php file, but I am still having issues with the status ID 12, it looks like when I change from awaiting fulfilment to the new status, it seems to drop of the order & value as if its been cancelled or refunded, were and what file controls this part of the association.

Its just throwing out the store snapshots, day / week / year etc.

thanks

Chris
pitorian
Posts: 31
Joined: Mon Aug 17, 2009 9:55 am

Re: Changing Order Status Fields

Post by pitorian »

Found tha answer this is the file that needs modifed

File: shoppingcart\lib\orders.php
function GetPaidOrderStatusArray() - line 1572
This function returns an array of statuses that you want to appear as PAID. Use the defined constant names to create / modify the list.
Post Reply