• Resolved mischmao

    (@mischmao)


    Hello,
    I am having a very hard time exporting then importing my website. My original theme is ListingPro. In the export file, there is a column called “lp_listingpro_options” and it contains serialized data that I want to separate so it can properly import.

    I am trying to have separate columns for: tagline, location, business hours, address, latitude, longitude, email, phone, website, social links, price status, price range, price from, price to and video links

    Here is an example of a serialized data for one listing:
    a:31:{s:12:”tagline_text”;s:0:””;s:8:”gAddress”;s:28:”Orléans, Ottawa, ON, Canada”;s:8:”latitude”;s:10:”45.4558019″;s:9:”longitude”;s:11:”-75.5047333″;s:6:”mappin”;s:0:””;s:5:”phone”;s:15:”(613) 604 -0188″;s:8:”whatsapp”;s:0:””;s:5:”email”;s:23:”[email protected]”;s:7:”website”;s:30:”https://www.charslocstudio.com”;s:7:”twitter”;s:0:””;s:8:”facebook”;s:40:”https://www.facebook.com/charslocstudio/”;s:8:”linkedin”;s:0:””;s:7:”youtube”;s:0:””;s:9:”instagram”;s:40:”https://www.instagram.com/charslocstudio”;s:5:”video”;s:0:””;s:7:”gallery”;s:0:””;s:12:”price_status”;s:11:”inexpensive”;s:10:”list_price”;s:3:”$65″;s:13:”list_price_to”;s:0:””;s:7:”Plan_id”;s:1:”0″;s:16:”lp_purchase_days”;s:0:””;s:11:”reviews_ids”;s:0:””;s:15:”claimed_section”;s:11:”not_claimed”;s:26:”listings_ads_purchase_date”;s:0:””;s:30:”listings_ads_purchase_packages”;s:0:””;s:4:”faqs”;a:2:{s:3:”faq”;a:1:{i:1;s:0:””;}s:6:”faqans”;a:1:{i:1;s:0:””;}}s:14:”business_hours”;a:6:{s:6:”Monday”;a:2:{s:4:”open”;s:7:”10:00am”;s:5:”close”;s:7:”06:00pm”;}s:7:”Tuesday”;a:2:{s:4:”open”;s:7:”10:00am”;s:5:”close”;s:7:”06:00pm”;}s:9:”Wednesday”;a:2:{s:4:”open”;s:7:”10:00am”;s:5:”close”;s:7:”06:00pm”;}s:8:”Thursday”;a:2:{s:4:”open”;s:7:”10:00am”;s:5:”close”;s:7:”06:00pm”;}s:6:”Friday”;a:2:{s:4:”open”;s:7:”09:00am”;s:5:”close”;s:7:”01:00pm”;}s:8:”Saturday”;a:2:{s:4:”open”;s:7:”09:00am”;s:5:”close”;s:7:”01:00pm”;}}s:11:”campaign_id”;s:0:””;s:14:”changed_planid”;s:0:””;s:19:”listing_reported_by”;s:0:””;s:16:”listing_reported”;s:0:””;}

    Any idea of what php code I can put into the Function Editor and other fields to fix this issue?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @mischmao,

    Any idea of what php code I can put into the Function Editor and other fields to fix this issue?

    Here’s instructions on using PHP functions on export fields: https://www.wpallimport.com/documentation/export/pass-data-through-php-functions/.

    You’ll want to set up multiple export fields (use “Add Field”) that are exporting the “lp_listingpro_options” field with different functions to extract each piece of information. As an example, here’s how you can get the email field:

    function my_get_email( $value ) {
    	$field = 'email';
    	if ( !empty( $value ) ) {
    		$unserialized = maybe_unserialize( $value );
    		
    		if ( is_array( $unserialized ) && isset( $unserialized[$field] ) ) {
    			return $unserialized[$field];
    		}
    	}
    }

    You can copy/modify this code as needed for each field.

    Plugin Author WP All Import

    (@wpallimport)

    Hey @mischmao,

    I’m going to mark this as resolved since it’s been a while. You can follow up in this thread if you still have questions.

    Anyone else, please open a new topic.

    Thread Starter mischmao

    (@mischmao)

    Hi, I actually need some help with finding the ideal PHP Function for my custom fields. Would you be able to guide me?

    a:13:{s:10:”lp_feature”;a:5:{i:0;s:2:”92″;i:1;s:2:”93″;i:2;s:2:”94″;i:3;s:2:”97″;i:4;s:3:”191″;}s:10:”deposit-of”;s:0:””;s:6:”events”;a:2:{i:0;s:7:”Wedding”;i:1;s:5:” Prom”;}s:18:”deposit-required-2″;s:1:”0″;s:24:”accepted-payment-methods”;a:1:{i:0;s:4:”Cash”;}s:16:”reservations-via”;a:2:{i:0;s:15:”Booking Website”;i:1;s:5:” Call”;}s:12:”appointments”;s:1:”0″;s:18:”deposit-of-mfilter”;s:11:”deposit-of-“;s:14:”events-mfilter”;a:2:{i:0;s:14:”events-Wedding”;i:1;s:12:”events- Prom”;}s:26:”deposit-required-2-mfilter”;s:20:”deposit-required-2-0″;s:32:”accepted-payment-methods-mfilter”;a:1:{i:0;s:29:”accepted-payment-methods-Cash”;}s:24:”reservations-via-mfilter”;a:2:{i:0;s:32:”reservations-via-Booking Website”;i:1;s:22:”reservations-via- Call”;}s:20:”appointments-mfilter”;s:14:”appointments-0″;}

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Help with Serialized Data’ is closed to new replies.