[OC-2.3.0.2][Ext=RelatedOptions] Import Tool Not Working as Expected
Posted: Fri Oct 27, 2023 3:46 am
Hi,
I need some help with an import tool for my website that imports CSV files and updates product information accordingly through the extension Related Options.
The code of subject is the following
The problem, however, is that the products that are NOT on the CSV file do not disable. Also quantities SET in Related Options do not transfer over (total calculated) to the options' settings in OpenCart.
Need help. And fast.
Take care,
Shawn
I need some help with an import tool for my website that imports CSV files and updates product information accordingly through the extension Related Options.
The code of subject is the following
Code: Select all
public function getProductByModel($model, $manufacturers){
$query = $this->db->query("SELECT product_id FROM " . DB_PREFIX . "product WHERE model = '" . $this->db->escape($model) . "' AND manufacturer_id IN (" . implode(',', $manufacturers) . ") ORDER BY `date_available` DESC");
$result = $query->row;
if($result && count($result)>0){
$this->db->query("UPDATE " . DB_PREFIX . "product SET status = 0 WHERE model = '" . $this->db->escape($model) . "' AND manufacturer_id IN (" . implode(',', $manufacturers) . ") AND quantity < 1");
$this->db->query("UPDATE " . DB_PREFIX . "product SET status = 1 WHERE product_id = '" . $this->db->escape($result['product_id']) . "' AND quantity > 0");
$this->db->query("UPDATE " . DB_PREFIX . "relatedoptions SET quantity = 0 WHERE product_id = '" . $this->db->escape($result['product_id']) . "' AND store_stock = 0");
}
return $result;
}
Need help. And fast.
Take care,
Shawn