0

I need to get all products that are at a discount. Is there any way to achieve this with SOAP API? Is it possible to compose such a filter?

1

Try below code : You need to write custom api to get your desired output:

public function getProductDetailsByprice( )
   {
   $store_id = 1; // Use the default store
   $collection = Mage::getModel('catalog/product')->getCollection()
        ->addStoreFilter($this->_getStoreId($$store_id)) ;
 $result = array(); 
 foreach ($collection as $product) {


            $original_price = $product->getData('price');

            $discounted_price = Mage::getResourceModel('catalogrule/rule')->getRulePrice( 
                        Mage::app()->getLocale()->storeTimeStamp($store_id), 
                        Mage::app()->getStore($store_id)->getWebsiteId(), 
                        Mage::getSingleton('customer/session')->getCustomerGroupId(), 
                        $product->getId());

        if ($discounted_price != $original_price) 
            {
                    $result[] = array(
                                            'product_id' => $product->getId() ,
                                            'type'       => $product->getTypeId(),
                                            'set'        => $product->getAttributeSetId(),
                                            'sku'        => $product->getSku(),
                                            'position'   => $product->getCatIndexPosition(),
                                            'brand'      => $product->getData('brand'),
                                            'price'      => $discounted_price,
                                            'name'      => $product->getData('name'),
                                            'original_price' => $original_price
                                             );
            }
        }
    return  $result; 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.