public function getCategoryNames($product_id) {
$query = $this->db->query("SELECT *, dac.top
FROM " . DB_PREFIX . "category_description cd
LEFT JOIN " . DB_PREFIX . "product_to_category p2c ON (p2c.category_id = cd.category_id)
LEFT JOIN " . DB_PREFIX . "de_av_category as dac ON (p2c.category_id = dac.category_id)
WHERE p2c.product_id = '" . (int)$product_id . "'AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "'");
return $query->rows;
}
$postids=$wpdb->get_results(
"SELECT
t1.ID
FROM
$wpdb->posts t1
inner join $wpdb->term_relationships t2 on t2.object_id = t1.ID
inner join $wpdb->term_taxonomy t3
on t3.term_taxonomy_id = t2.term_taxonomy_id and t3.taxonomy = 'category'
inner join $wpdb->terms t4 on t4.term_id = t3.term_id
WHERE t1.post_type='post'
and t4.`name` = 'Россия'
ORDER BY t1.ID ASC");