Всем добрый день! Подскажите, что делаю не так?
Нужна помощь с PHP Simple HTML DOM
Изображение берется, а описание нет(
PHP:
скопировать код в буфер обмена
class Licenziya extends \Infr\Supplier { protected $_host = 'https://www.sima-land.ru'; protected $_productMask = 'https://www.sima-land.ru/{PRODUCT_ID}'; protected function _getPrice() { $class = 'Plugins\Suppliers\Supplier\Licenziya'; $supplierItem = new $class; $pricePath = $supplierItem->getPricePath(); } else { throw new \Exception('Прайс-лист для поставщика не загружен'); } } else { throw new \Exception('К плагину Suppliers не подключен нужный поставщик'); } } public function getProduct (Supplier $supplier, Supplier\Product $product, array $params = array()) { if ($product->url) { $html = \Infr\Request::httpRequest($product->url); if ($html) { $dom = \Infr\str_get_html($html); if ($dom) { $pict = $dom->find('a.easyzoom_large-image', 0); if ($pict) { $product->pictures = array((string ) $pict->getAttribute('href')); $pict->clear(); } $techpars = $dom->find('div#tab_3.b-properties-holder', 0); if ($techpars) { $desc = '<ul class="g-ul b-properties">'; foreach ($techpars as $techpar) { $trs = $techpar->find('li'); if ($trs) { foreach ($trs as $li) { $desc .= (string) $li->innertext(); $li->clear(); } } $techpar->clear(); } $desc .= '</table>'; $product->description = $desc; } } } } return $product; }
|