Post by krosoftware » Fri Oct 10, 2014 9:08 pm

Hello all
I need to read setting.key Value, and it looks like:
a:1:{i:0;s:1:"5";}

how can I read it?
I mean, I see "5" and it is value that I need. Will that value always be on same place or it can be (for example)
a:12345:{i:0;s:1:"5";}
or
a:1:{i:0;s:12345:"5";}

Thanks.

New member

Posts

Joined
Thu May 10, 2012 3:11 am

Post by krosoftware » Fri Oct 10, 2014 10:26 pm

Hello, please help me - is there any documentation regarding key value from setting table?

Thank you.

New member

Posts

Joined
Thu May 10, 2012 3:11 am

Post by krosoftware » Sun Oct 12, 2014 2:17 pm

Anybody, please?

New member

Posts

Joined
Thu May 10, 2012 3:11 am

Post by pm-netti » Sun Oct 12, 2014 3:10 pm

krosoftware wrote:Hello all
I need to read setting.key Value, and it looks like:
a:1:{i:0;s:1:"5";}

how can I read it?
I mean, I see "5" and it is value that I need. Will that value always be on same place or it can be (for example)
a:12345:{i:0;s:1:"5";}
or
a:1:{i:0;s:12345:"5";}

Thanks.
Do you want to read it for a change?

Code: Select all

<?php
$str = 'a:1:{i:0;s:1:"5";}';

$arr = unserialize($str);

print_r($arr);
?>

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland

Post by krosoftware » Sun Oct 12, 2014 10:26 pm

Hello pm-netti
thank you for your code. Currently I need only to read values.
When I run it, I see
Array ( [0] => 5 )
Not sure how I can figure out that 5 is the number I need?
Now I changed Complete Order Status to hold 2 values (please see image)
in the database, I see a:2:{i:0;s:2:"24";i:1;s:1:"5";
if I run your code, I see this:
Array ( [0] => 24 [1] => 5 )
Additional, is there any way to read those values using JavaScript?
My life was easier when there was only 1 option to define when order is completed .. Any way to use only 1 value (like in 1.5.6.4?

Attachments

Capture.PNG

Capture.PNG (16.2 KiB) Viewed 2228 times


New member

Posts

Joined
Thu May 10, 2012 3:11 am

Post by pm-netti » Mon Oct 13, 2014 2:28 am

krosoftware wrote:Hello pm-netti
thank you for your code. Currently I need only to read values.
When I run it, I see
Array ( [0] => 5 )
Not sure how I can figure out that 5 is the number I need?
Now I changed Complete Order Status to hold 2 values (please see image)
in the database, I see a:2:{i:0;s:2:"24";i:1;s:1:"5";
if I run your code, I see this:
Array ( [0] => 24 [1] => 5 )
Additional, is there any way to read those values using JavaScript?
My life was easier when there was only 1 option to define when order is completed .. Any way to use only 1 value (like in 1.5.6.4?
Why you need to read it in the database the "limp" array?
Is not that graphic information on the event is not sufficient?

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland

Post by rph » Mon Oct 13, 2014 2:30 am

You use the config class to get settings values.

Code: Select all

$this->config->get('foo'); 
http://wiki.opencarthelp.com/doku.php?i ... config_get

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by krosoftware » Mon Oct 13, 2014 4:19 am

pm-netti wrote:
krosoftware wrote:Hello pm-netti
thank you for your code. Currently I need only to read values.
When I run it, I see
Array ( [0] => 5 )
Not sure how I can figure out that 5 is the number I need?
Now I changed Complete Order Status to hold 2 values (please see image)
in the database, I see a:2:{i:0;s:2:"24";i:1;s:1:"5";
if I run your code, I see this:
Array ( [0] => 24 [1] => 5 )
Additional, is there any way to read those values using JavaScript?
My life was easier when there was only 1 option to define when order is completed .. Any way to use only 1 value (like in 1.5.6.4?
Why you need to read it in the database the "limp" array?
Is not that graphic information on the event is not sufficient?
Please see attached image. I need to know what status the order must reach before I can allow download of purchased products (for example). I'm using other software which use OC database. In the 1.5.6.4 there was only 1 value and it was easy to read what is the "Completed" value. Now, it is possible to choose unlimited values as "Completed". Problem is - I must read them all. With other words, I need to know what the Admin has been selected. Result is stored in serialized format and I have no idea how to read those values.

Attachments

os.png

os.png (19.03 KiB) Viewed 2211 times


New member

Posts

Joined
Thu May 10, 2012 3:11 am

Post by krosoftware » Mon Oct 13, 2014 4:43 am

rph wrote:You use the config class to get settings values.

Code: Select all

$this->config->get('foo');
http://wiki.opencarthelp.com/doku.php?i ... config_get
Thank you but I'm not using PHP. I need to somehow "translate" value which can be found under "config_complete_status" key, so I can put that value into "order" table, under order_status_id field.
Question is also how OC can take selected values which are defined as "complete" order and update "order_status_id" filed (which is integer) ?
I hope that someone can help me because I'm lost. In the 1.5.6.4 it was easy - Admin can choose only one value as "Completed" order and that value (integer) was used to update order.order_status_id
Now Admin can chose multiple values (using checkbox) to define "Complete" order and on "order" table still exists only integer value .. I don't understand how that should works.

New member

Posts

Joined
Thu May 10, 2012 3:11 am

Post by rph » Mon Oct 13, 2014 5:19 am

http://us2.php.net/manual/en/function.s ... .php#66147

a = array
i = integer
s = string
O = object
N = null
b = boolean

A quick search turned up libraries to parse PHP serialized data in Python, Ruby On Rails, and Javascript so I seriously doubt you'd need to write one yourself.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by pm-netti » Mon Oct 13, 2014 6:35 pm

krosoftware wrote: In the 1.5.6.4 there was only 1 value and it was easy to read what is the "Completed" value. Now, it is possible to choose unlimited values as "Completed". Problem is - I must read them all. With other words, I need to know what the Admin has been selected. Result is stored in serialized format and I have no idea how to read those values.
In this order statuses the values ​​of admin source code:

7 = Canceled
9 = Canceled Reversal
13 = Chargeback
5 = Complete
8 = Denied
14 = Expired
10 = Failed
1 = Pending
15 = Processed
2 = Processing
11 = Refunded
12 = Reversed
3 = Shipped
16 = Voided

Ps. These may be divergence. You can check the source code or in the database table order_status.

Image
- - - OpenCart Upgrade Service - - -


User avatar
Active Member

Posts

Joined
Sat Apr 07, 2012 11:22 pm
Location - Kittilä-Finland

Post by krosoftware » Tue Oct 14, 2014 11:17 pm

pm-netti wrote:
krosoftware wrote: In the 1.5.6.4 there was only 1 value and it was easy to read what is the "Completed" value. Now, it is possible to choose unlimited values as "Completed". Problem is - I must read them all. With other words, I need to know what the Admin has been selected. Result is stored in serialized format and I have no idea how to read those values.
In this order statuses the values ​​of admin source code:

7 = Canceled
9 = Canceled Reversal
13 = Chargeback
5 = Complete
8 = Denied
14 = Expired
10 = Failed
1 = Pending
15 = Processed
2 = Processing
11 = Refunded
12 = Reversed
3 = Shipped
16 = Voided

Ps. These may be divergence. You can check the source code or in the database table order_status.
Hello
yes, in the orders_status you have this fields:
order_status_id, language_id, name

Problem is - on database table "setting", and in the filed "value", stored is something like this:
a:2:{i:0;s:2:"24";i:1;s:1:"5";}
before, it was something like 5, which means, 5 = Complete
now I need to somehow find out what I need to write into table order, field order_status_id, because I can write only one value (integer) and Administrator can select many values (using check box)..
I hope I explained well..
There is no sense for me to define more as 1 status as complete, but there is option to do that and I need to find out how to assign 2 or more values into 1 integer value.

New member

Posts

Joined
Thu May 10, 2012 3:11 am
Who is online

Users browsing this forum: No registered users and 8 guests