So I'm working on a monster script to port all of our existing stuff from Joomla/Virtuemart to Wordpress/WooCommerce.
So far I've got just about everything done with moving over our product categories and products, I just need to figure out the structure of the _downloadable_files
postmeta.
Using this as an example:
a:1:{s:32:"ded830cf64e3c42c4f7ac5aecd7c5c86";a:2:{s:4:"name";s:0:"";s:4:"file";s:114:"http://localhost/wp-content/uploads/woocommerce_uploads/2014/09/test-file.pdf";}}
How is the s:114
just before the file url generated? That is the only part that changes that I don't know how to generate.
Any suggestions would be greatly appreciated!
So I'm working on a monster script to port all of our existing stuff from Joomla/Virtuemart to Wordpress/WooCommerce.
So far I've got just about everything done with moving over our product categories and products, I just need to figure out the structure of the _downloadable_files
postmeta.
Using this as an example:
a:1:{s:32:"ded830cf64e3c42c4f7ac5aecd7c5c86";a:2:{s:4:"name";s:0:"";s:4:"file";s:114:"http://localhost/wp-content/uploads/woocommerce_uploads/2014/09/test-file.pdf";}}
How is the s:114
just before the file url generated? That is the only part that changes that I don't know how to generate.
Any suggestions would be greatly appreciated!
Share Improve this question edited Jul 23, 2015 at 16:42 Pieter Goosen 55.5k23 gold badges117 silver badges211 bronze badges asked Jul 23, 2015 at 16:01 JakeJake 133 bronze badges1 Answer
Reset to default 1In short, this is serialized data and this is how data is stored from a custom field (and many other datastrings) in the db.
s:114
is auto generated and simply means that the value http://localhost/wp-content/uploads/woocommerce_uploads/2014/09/test-file.pdf
is a string and is 114 characters long. This is used when the data is read and used. If the URL value changes, the string length will change as the length of the string changes
You will need to go and have a look at data serializing and unserializing