I have this weird situation where SOAP retuns no value but I am not sure how to check whether it has returned any value or not.
For example, I am calling SOAP to get product image detail like this:
$result = $this->proxy->call($this->sopaSession, 'catalog_product_attribute_media.list', $sku);
For one SKU, I have images uploaded and it returns the correct values into $result. All fine, all happy!
But for another SKU, I do not have any images uploaded. So, upon calling aforementioned statement for this SKU, I am not sure what is returned - null? false? empty string?
if ($result){
return $result;
}
or
if (isset(result)){
return $result;
}
or
if ($result === null){
return $result;
}
None of these really work.
I am relatively new to PHP, Magento and SOAP.
Please guide me how can I check whether my SOAP call has returned any value or not. Based if a product has image or not, I want to do some further processing.
Appreciate any kind of hint/help.
Thank you! Dhananjay
catch (Exception $ex) { return false; }
. Is that normal? Also, as per your suggestion, I made sure to return only Boolean from my function..