Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transportation_services should map to Listing Type taxonomy term names #67

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/Otis_Importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Otis_Importer {
'cycling_ride_type' => 'type',
'event_type' => 'type',
'additional_lodging_types' => 'type',
'transportation_services' => 'type',
'primary_city' => 'city',
'primary_region' => 'region',
];
Expand Down Expand Up @@ -193,7 +194,7 @@ function import( $args, $assoc_args ) {
$log[] = 'POI import complete.';

return $log;

case 'all-listings':
if ( empty( $assoc_args['sync_page'] ) ) {
$assoc_args['sync_page'] = 1;
Expand Down Expand Up @@ -382,20 +383,20 @@ private function _import_poi( $assoc_args = [] ) {
}
}


/** Make Listings Transient Key */
private function make_listings_transient_key( $listings_type ) {
$listings_key_type = strtolower( $listings_type );
$listings_key_type = str_replace( ' ', '_', $listings_key_type );
return 'wp_otis_listings' . '_' . $listings_key_type;
}

/** Get Listings transient if it exists */
private function get_listings_transient( $listings_type = 'pois' ) {
$transient_key = $this->make_listings_transient_key( $listings_type );
return get_transient( $transient_key );
}

/** Set Listings transient */
private function set_listings_transient( $data = [], $listings_type = 'pois' ) {
$transient_key = $this->make_listings_transient_key( $listings_type );
Expand Down Expand Up @@ -580,7 +581,7 @@ private function _process_listings( $assoc_args = [] ) {
if ( get_option( WP_OTIS_CANCEL_IMPORT, false ) ) {
$this->cancel_import();
return;
}
}
// Disable Caching if it's enabled.
// $this->_toggle_caching( false );

Expand Down Expand Up @@ -657,7 +658,7 @@ private function _delete_removed_listings( $assoc_args = [] ) {

// Check if there's a page in args and set it to the first one if it's not present.
$deletes_page = isset( $assoc_args['deletes_page'] ) ? intval( $assoc_args['deletes_page'] ) : 1;

// Construct API params.
$api_params = [];
if ( ! is_null( $before ) ) {
Expand Down Expand Up @@ -800,7 +801,7 @@ private function _set_all_pois_transient() {
// Schedule the action to sync the listings.
$this->schedule_action( 'wp_otis_sync_all_listings_process', [ 'params' => [ 'process_page' => 1 ] ] );
}


/** Process activeIds Transient */
private function _remove_all_inactive_listings( $assoc_args = [] ) {
Expand Down