Search code examples
androidmagento-1.7ksoap2

Extend magento core api get product info with product image url


How to extend magento core "catalogProductInfo" to get product information along with product's image url?


Solution

  • I got my answer : get product info along with image URl by the product Ids Call below php method to get required product details, you need to send product Ids in string array.

     /**  CUSTOM FILTER API METHOD GET PRODUCT DETAILS WITH IMAGE URL BY PRODUCT_ID's **/
       public function getProductDetails($productidarray){
    
       $productidstemp = array();
       $productidstemp =   json_decode($productidarray, true);
       $store = 1; $attributes = null; $identifierType = 'ID';
    
       $result = array();
       $arrlength = count($productidstemp );
    
       for($x = 0; $x <  $arrlength; $x++) { 
    
       $product = Mage::getModel('catalog/product')->load($productidstemp[$x]);
    
                $result[] = array(
                'product_id' => $product->getId() ,
                'type'       => $product->getTypeId(),
                'set'        => $product->getAttributeSetId(),
                'sku'        => $product->getSku(),
                'position'   => $product->getCatIndexPosition(),
                'brand'      => $product->getData('brand'),
                'price'      => $product->getData('price'),
                'name'      => $product->getData('name'),
                'description'      => $product->getData('description'),
                'short_description'      => $product->getData('short_description'),
                'image_url'  => $product-> getImageUrl() );
    
          }
    
        return  $result; 
    
       }