How to import serialized value into custom meta field.
-
Hi,
I’m trying to import products with meta fields containing some array structure. My value in CSV file is:
a:1:{i:0;a:5:{s:25:"ph_booking_resources_name";s:0:"";s:25:"ph_booking_resources_cost";s:0:"";s:32:"ph_booking_resources_auto_assign";s:2:"no";s:31:"ph_booking_resources_per_person";s:2:"no";s:29:"ph_booking_resources_per_slot";s:2:"no";}}
but when I take a look into database I can see something like this (prefixed s:239: and quoted):
s:239:"a:1:{i:0;a:5:{s:25:"ph_booking_resources_name";s:0:"";s:25:"ph_booking_resources_cost";s:0:"";s:32:"ph_booking_resources_auto_assign";s:2:"no";s:31:"ph_booking_resources_per_person";s:2:"no";s:29:"ph_booking_resources_per_slot";s:2:"no";}}"
If I manually in database make the value looking like in CSV file every thing is working correctly.
How can I force import process to insert such value as it is provided without any changes?
Correct value in export XML looks like this:
<wp:postmeta> <wp:meta_key><![CDATA[_phive_booking_resources_pricing_rules]]></wp:meta_key> <wp:meta_value><![CDATA[a:1:{i:0;a:5:{s:25:"ph_booking_resources_name";s:0:"";s:25:"ph_booking_resources_cost";s:0:"";s:32:"ph_booking_resources_auto_assign";s:2:"no";s:31:"ph_booking_resources_per_person";s:2:"no";s:29:"ph_booking_resources_per_slot";s:2:"no";}}]]></wp:meta_value> </wp:postmeta>
Thanks,
Krzysztof
- The topic ‘How to import serialized value into custom meta field.’ is closed to new replies.