Выгрузка в Яндекс.Маркет, вывод для товара минимальной цены от модификации.

Модератор
#
Выгрузка в Яндекс.Маркет, вывод для товара минимальной цены от модификации.
В случае, если вы не выгружаете модификации в Маркет и не заполняете основные цены товаров, используйте следующее решение:
<?php

$oShop = Core_Entity::factory('Shop', Core_Array::get(Core_Page::instance()->libParams, 'shopId'));

class My_Shop_Controller_YandexMarket extends Shop_Controller_YandexMarket
{
   /**
    * Check Item Price
    * @param Shop_Item_Model $oShop_Item
    * @return boolean
    */
   protected function _checkPrice(Shop_Item_Model $oShop_Item)
   {
      return TRUE;
      //return $oShop_Item->price > 0;
   }
   
   /**
    * Get Surcharge
    * @param Shop_Item_Model $oShop_Item
    * @return float
    */
   protected function _getSurcharge($oShop_Item)
   {
      $surcharge = parent::_getSurcharge($oShop_Item);
      
      if ($oShop_Item->price == 0)
      {
         $aAllItemPrices = array();
         $aModifications = $oShop_Item->Modifications->findAll(FALSE);
         foreach ($aModifications as $oModification)
         {
            $aPrices = $oModification->getPrices();
            $aAllItemPrices[] = $aPrices['price_discount'];
         }
         
         $surcharge += min($aAllItemPrices);
      }
      
      return $surcharge;
   }
}

$Shop_Controller_YandexMarket = new My_Shop_Controller_YandexMarket($oShop);
$Shop_Controller_YandexMarket
   ->model('ADV')
   ->itemsProperties(FALSE)
   ->modifications(FALSE)
   ->show();
exit();
Авторизация