product (
`product_id` int(11) NOT NULL,
`model` varchar(64) NOT NULL,
`sku` varchar(64) NOT NULL,
`upc` varchar(12) NOT NULL,
`ean` varchar(14) NOT NULL,
`jan` varchar(13) NOT NULL,
`isbn` varchar(17) NOT NULL,
`mpn` varchar(64) NOT NULL,
`location` varchar(128) NOT NULL,
`quantity` int(4) NOT NULL DEFAULT 0,
`stock_status_id` int(11) NOT NULL,
`image` varchar(255) DEFAULT NULL,
`manufacturer_id` int(11) NOT NULL,
`shipping` tinyint(1) NOT NULL DEFAULT 1,
`price` decimal(15,4) NOT NULL DEFAULT 0.0000,
`points` int(8) NOT NULL DEFAULT 0,
`tax_class_id` int(11) NOT NULL,
`date_available` date NOT NULL DEFAULT '0000-00-00',
`weight` decimal(15,3) NOT NULL DEFAULT 0.000,
`weight_class_id` int(11) NOT NULL DEFAULT 0,
`length` decimal(15,8) NOT NULL DEFAULT 0.00000000,
`width` decimal(15,8) NOT NULL DEFAULT 0.00000000,
`height` decimal(15,8) NOT NULL DEFAULT 0.00000000,
`length_class_id` int(11) NOT NULL DEFAULT 0,
`subtract` tinyint(1) NOT NULL DEFAULT 1,
`minimum` int(11) NOT NULL DEFAULT 1,
`sort_order` int(11) NOT NULL DEFAULT 0,
`status` tinyint(1) NOT NULL DEFAULT 0,
`viewed` int(5) NOT NULL DEFAULT 0,
`noindex` tinyint(1) NOT NULL DEFAULT 1,
`date_added` datetime NOT NULL,
`date_modified` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
По-хорошему, еще должна быть таблица на единицы измерения
Будет двойные накладные расходы.
product_id attribute_id text
1 10 200
2 10 230
3 10 200
1 12 80
2 12 80
3 12 80
1 15 15
2 15 13
3 15 15
1 80 Сони
2 80 Сони
3 80 Сони
1 90 66
2 90 60
3 90 71
(БЕЗ ВСЯКОГО GET)
SELECT DISTINCT
p.text,
wdt.text wdt,
hgt.text hgt,
dia.text dia
FROM " . DB_PREFIX . "product_attribute p
JOIN " . DB_PREFIX . "product_attribute wdt ON p.product_id = wdt.product_id
JOIN " . DB_PREFIX . "product_attribute hgt ON p.product_id = hgt.product_id
JOIN " . DB_PREFIX . "product_attribute dia ON p.product_id = dia.product_id
WHERE p.attribute_id = '80' and wdt.text = '70' and hgt.text = '230' and dia.text = '15'
без указания что есть правильнонеправильно потому что при таком варианте выдается количество правильно а дальше только один товар
Array ( [0] => Array ( [total] => 316 [text] => Nokian [wdt] => 70 [hgt] => 175 [dia] => R13 ) )
соответственно нельзя решить каким действительно должен быть запрос
почему в полях с названием text лежат id
`product_id` int(11) NOT NULL,
`attribute_id` int(11) NOT NULL,
`language_id` int(11) NOT NULL,
`text` text NOT NULL
require_once 'simpledom/simple_html_dom.php';
$data = new simple_html_dom();
$data = file_get_html($url);
$a = $data->find('#leftMenu',0);
foreach($a->find('.drop') as $pr){
foreach($pr->find('li a') as $gr){
echo '<a href="'.$url.$gr->href.'">'.$gr->plaintext.'</a></br>';
}
}