Hi all,
Hopefully someone can point out what I'm doing wrong?
I'm trying to delete every product from an array. But this doesn't seem to work.
When I use an SQL Delete statement it works correctly:
$proddeleted = Db::getInstance()->Execute('
DELETE FROM `'.pSQL(_DB_PREFIX_).'product`
WHERE reference = "'.($prodref).'"
');
But this only deletes the product record, not the prod_lang etc...
So I'm trying to user $product->delete()
$prodref = 'CUST'.$quoteid;
$products = Db::getInstance()->ExecuteS('
SELECT * FROM `'.pSQL(_DB_PREFIX_).'product`
WHERE reference = "'.($prodref).'"
');
foreach ($products as $id_product) {
$product = new Product((int)$id_product);
$product->delete();
}
Thanks all!!