I have an array like this:
$stockUpdates = [
'DVD-UBOX-UK' => 37,
'DVD-UCARD-UK' => 39
];
For these skus, I need to know their product ID's, so ran the following script to run a direct sql query on magento core_read connection with parameter binding like this:
// Load db resource
$resource = Mage::getSingleton('core/resource');
$readConn = $resource->getConnection('core_read');
$cpe_table = $resource->getTableName('catalog_product_entity');
// Parse sku product ids
$result = $readConn->query(
"SELECT entity_id, sku FROM $cpe_table WHERE sku IN (:skuList)",
array('skuList' => array_keys($stockUpdates)));
while ($row = $result->fetch()) {
var_dump($row); // debug test
}
When the script executes, it looks like this (not what I was expecting):
All I am trying to do is get a list of entity_id, sku for an array of sku list I have. What am I doing wrong here?
