/** * Get product reviews from feefo. * * @return array */ public function getProductsReview() { $check = true; $reviews = []; $feefoDir = BP . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'code' . DIRECTORY_SEPARATOR . 'Dotdigitalgroup' . DIRECTORY_SEPARATOR . 'Email' . DIRECTORY_SEPARATOR . 'view' . DIRECTORY_SEPARATOR . 'frontend' . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'feefo'; $logon = $this->helper->getFeefoLogon(); $limit = $this->helper->getFeefoReviewsPerProduct(); $products = $this->getQuoteProducts(); foreach ($products as $sku => $name) { $url = 'http://www.feefo.com/feefo/xmlfeed.jsp?logon=' . $logon . '&limit=' . $limit . '&vendorref=' . $sku . '&mode=productonly'; $doc = $this->domDocument; $xsl = $this->processor; //@codingStandardsIgnoreStart if ($check) { $doc->load($feefoDir . DIRECTORY_SEPARATOR . 'feedback.xsl'); } else { $doc->load($feefoDir . DIRECTORY_SEPARATOR . 'feedback-no-th.xsl'); } $xsl->importStyleSheet($doc); $doc->loadXML(file_get_contents($url)); //@codingStandardsIgnoreEnd $productReview = $xsl->transformToXML($doc); if (strpos($productReview, '<td') !== false) { $reviews[$name] = $xsl->transformToXML($doc); } $check = false; } return $reviews; }