products = new Woo_Feed_Products_v3( $feedRule ); // When update via cron job then set productIds. if ( ! isset($feedRule['productIds']) ) { $feedRule['productIds'] = $this->products->query_products(); } $this->products->get_products($feedRule['productIds']); $this->rules = $feedRule; } /** * Return Feed * * @return array|bool|string */ public function returnFinalProduct() { if ( ! empty($this->products) ) { if ( 'xml' == $this->rules['feedType'] ) { $feed = array( 'body' => $this->products->feedBody, 'header' => $this->products->feedHeader, 'footer' => $this->products->feedFooter, ); return $feed; } elseif ( 'txt' == $this->rules['feedType'] ) { $feed = array( 'body' => $this->products->feedBody, 'header' => $this->products->feedHeader, 'footer' => '', ); return $feed; } elseif ( 'csv' == $this->rules['feedType'] || 'tsv' == $this->rules['feedType'] || 'xls' == $this->rules['feedType'] || 'xlsx' == $this->rules['feedType'] || 'json' == $this->rules['feedType'] ) { $feed = array( 'body' => $this->products->feedBody, 'header' => $this->products->feedHeader, 'footer' => '', ); return $feed; } } $feed = array( 'body' => '', 'header' => '', 'footer' => '', ); return $feed; } }