Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // We don't care if dealer identifier matches, proceed with 'standard' evaluation
- // Export only used! As of this time 05/30/18 Marketplace only supports USED
- if(isset($temp_line[$columns_merged['state_of_vehicle']]) && (strtolower($temp_line[$columns_merged['state_of_vehicle']]) !== $this->dealer_identifier_value)) {
- //log_message('debug', __FUNCTION__."() -- Used vehicle found.");
- // Check for empty prices
- if(isset($grab['price']) && (!empty($grab['price']) && $grab['price'] !== "0 {$line_currency}")) {
- //log_message('debug', __FUNCTION__."() -- Valid price found.");
- // Check for a photo
- if(isset($grab['images']) && !empty($grab['images']) && is_array($grab['images']) && count($grab['images']) > 1) {
- //log_message('debug', __FUNCTION__."() -- Valid image URL found.");
- // Valid Mileage value
- if(isset($grab['mileage_value']) && !empty($grab['mileage_value']) && strlen($grab['mileage_value']) > 2 && ($grab['mileage_value'] > 499)) {
- //log_message('debug', __FUNCTION__."() -- Valid mileage value found.");
- // No empty VDP
- //if(isset($grab['url']) && !empty($grab['url']) && strlen($grab['url']) > 1) {
- //log_message('debug', __FUNCTION__."() -- Valid URL.");
- // Does the VDP URL contain the dealership URL?
- if(strpos($grab['url'], $this->client_parsed_hostname) !== FALSE) {
- //log_message('debug', __FUNCTION__."() Dealer Hostname found...");
- $the_data[] = $grab;
- $vins_and_urls_list[] = [
- 'vin' => $grab['vin'],
- 'url' => $grab['url'],
- 'neworused' => (isset($grab['state_of_vehicle']) && strtolower($grab['state_of_vehicle']) == strtolower($this->state_of_vehicle_field)) ? 1 : 0
- ];
- }
- //}
- }
- }
- }
- }
- }
- }
- // Reset the counter!
- $column_count = 1;
- $plucked_line_data = [];
- $grab = [];
- }
- $column_count++;
- }
- }
- fclose($handle);
- // dump it
- //print_r($plucked_line_data);
- $data_count = count($the_data);
- log_message('debug', __FUNCTION__."() Successfully generated {$data_count} rows of something...");
- log_message('debug', __FUNCTION__."() Loading parser...");
- $xml_data = [
- 'feed_name' => '', // TODO Set to dealer name? scope line_dealer_name ??,
- 'link' => '', // TODO set to dealer URL? same as above.
- 'listings' => $the_data,
- ];
- $this->CI->load->library('parser');
- $xml_markup = $this->CI->parser->parse('templates/marketplace', $xml_data, TRUE);
- // Next build the catalog (precursor to VDP evaluation, this originates VINs and URLs and assumes we need to redirect)
- $this->CI->load->model('Catalog_model', 'catalog_model');
- $job_datetime = date('ymdHi');
- $item_datetime = date('Y-m-d H:i:s');
- $catalog_data = [];
- foreach($vins_and_urls_list as $vin_item) {
- // Check if we've got valid values for VIN and URL to add to the pile
- //if((isset($vin_item['vin']) && !empty($vin_item)) && (isset($vin_item['url']) && !empty($vin_item['url']))) {
- if(!empty($vin_item) && isset($vin_item['vin'])) {
- $catalog_data[] = [
- 'client_id' => $client_id,
- 'job_number' => $job_datetime,
- 'vin' => $vin_item['vin'],
- 'initial_url' => $vin_item['url'],
- 'created_at' => $item_datetime,
- 'updated_at' => $item_datetime,
- 'neworused' => $vin_item['neworused']
- ];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement