function getFeedData($category, $remote_category, $file_name, $saved_feed = null) { $this->logActivity('Initializing...'); global $message; global $pfcore; $providers = new PProviderList(); $this->logActivity('Loading paths...'); if (!$this->checkFolders()) { return; } $file_url = PFeedFolder::uploadFolder() . $this->providerName . '/' . $file_name . '.' . $this->fileformat; $file_path = PFeedFolder::uploadURL() . $this->providerName . '/' . $file_name . '.' . $this->fileformat; //Special (WordPress): where admin is https and site is http, path to wp-uploads works out incorrectly as https // we check the content_url() for https... if not present, patch the file_path if ($pfcore->cmsName == 'WordPress' && strpos($file_path, 'https://') !== false && strpos(content_url(), 'https') === false) { $file_path = str_replace('https://', 'http://', $file_path); } //Create the Feed $this->logActivity('Creating feed data'); $this->filename = $file_url; $this->productCount = 0; $content = 'Place-Holder File, This file will be replaced next refresh, To manually fill this data, go to manage feeds and click [Update Now]'; file_put_contents($this->filename, $content); $this->logActivity('Updating Feed List'); PFeedActivityLog::updateFeedList($category, $remote_category, $file_name, $file_path, $this->providerName, $this->productCount); //Save the feedlist $id = PFeedActivityLog::feedDataToID($file_name, $this->providerName); $pfcore->settingSet('cpf_aggrfeedlist_' . $id, implode(',', $this->feed_list)); if ($this->productCount == 0) { //$this->message .= '<br>No products returned'; //return; } $this->success = true; }
public static function updateFeedList($category, $remote_category, $file_name, $file_path, $providerName, $productCount) { $id = PFeedActivityLog::feedDataToID($file_name, $providerName); if ($id == -1) { PFeedActivityLog::addNewFeedData($category, $remote_category, $file_name, $file_path, $providerName, $productCount); } else { PFeedActivityLog::updateFeedData($id, $category, $remote_category, $file_name, $file_path, $providerName, $productCount); } }