Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Accessing delivery state name for customization

Accessing delivery state name for customization

Views: 851

Results 1 to 3 of 3
23 Oct 2011, 12:06 PM
#1
arunachala avatar

arunachala

Zen Follower

Join Date:
Mar 2009
Location:
New York
Posts:
158
Plugin Contributions:
0

Accessing delivery state name for customization

Hi:

I am adding a test for delivery state in zones.php. I am using the following statement $state = $order->delivery['state']; after setting global $db; Is it correct? Is there a place where developers can look for correct syntax and access of zen cart variables?

23 Oct 2011, 1:29 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Accessing delivery state name for customization

It depends on what you want to get and where in the code you are when you want to get it ...

$state = $order->delivery['state'];

says you want to access the order class and get the delivery state, but that is not accessing the database where you need access to the $db ... you need access to the $order so the global would be on that:
global $order;
$state = $order->delivery['state'];

and providing the $order exists where you are testing for this, then it would be available ...

You can always add a var_dump of the array, such as:
global $order;
echo var_dump($order);

to see the content to know if the data is available within the function you are trying to add this test ...

23 Oct 2011, 2:24 PM
#3
arunachala avatar

arunachala

Zen Follower

Join Date:
Mar 2009
Location:
New York
Posts:
158
Plugin Contributions:
0

Re: Accessing delivery state name for customization

Thanks. I was using it in zones.php. I added global $db; after global $cart; Since it worked I can retest after removing global $db; Thanks again