Hello,
> and needs cleaning up
You should correct the data in the .csv file and then import it back with the “delete existing values” checkbox checked.
Screenshot:
https://hottons.com/demo/wp/ymm/screenshots/delete_existing_values.png
>
> I don’t even see the ‘errored’ make/model
Try to replace the function getVehicleData()
with:
public function getVehicleData($limit = 0)
{
$queryLimit = $limit > 0 ? " LIMIT {$limit} " : '';
$select = "
SELECT DISTINCT IF(LENGTH(postmeta.meta_value)>0, postmeta.meta_value, posts.ID) as product_sku, ymm.make, ymm.model, ymm.year_from, ymm.year_to
FROM {$this->_wpdb->posts} AS posts
LEFT JOIN {$this->_wpdb->postmeta} AS postmeta
ON postmeta.post_id = posts.ID AND postmeta.meta_key = '_sku'
JOIN {$this->_mainTable} ymm
ON ymm.product_id = posts.ID
WHERE posts.post_type = 'product'
ORDER BY posts.ID
{$queryLimit}
";
return (array) $this->_wpdb->get_results($select, ARRAY_N);
}
and the function getProductIdsBySku()
with:
public function getProductIdsBySku($limit = 0)
{
$queryLimit = $limit > 0 ? " LIMIT {$limit} " : '';
$select = "
SELECT IF(LENGTH(postmeta.meta_value)>0, postmeta.meta_value, posts.ID) as product_sku, posts.ID as product_id
FROM {$this->_wpdb->posts} AS posts
LEFT JOIN {$this->_wpdb->postmeta} AS postmeta
ON postmeta.post_id = posts.ID AND postmeta.meta_key = '_sku'
WHERE posts.post_type = 'product'
{$queryLimit}
";
$result = (array) $this->_wpdb->get_results($select, ARRAY_A);
$productIds = array();
foreach ($result as $row){
$productIds[$row['product_sku']] = $row['product_id'];
}
return $productIds;
}
in the file:
wp-content/plugins/ymm-search/Model/Db.php
Stanislav