magento-client icon indicating copy to clipboard operation
magento-client copied to clipboard

Get product by SKU (method)

Open alexszilagyi opened this issue 5 years ago • 1 comments

I've seen that there's a getInfo() method which has the following parameters: productId, $storeView = null, $attributes = null, $identifierType = null

$sku = 'some-sku';
$productId = Mage::getModel('catalog/product')->getIdBySku($sku);
if($productId){
   //sku exists
}

How I'd achieve this using this wrapper?

alexszilagyi avatar Jul 27 '20 16:07 alexszilagyi

$data = $productManager->getInfo($sku, null, null, 'SKU')->execute();
        if($data)
            $productId = $data['product_id'];

RickMaas avatar Sep 24 '20 08:09 RickMaas