Пример #1
0
 /**
  * Append selection to options
  * stripBefore - indicates to reload
  * appendAll - indicates do we need to filter by saleable and required custom options
  *
  * @param Mage_Bundle_Model_Resource_Selection_Collection $selectionsCollection
  * @param bool $stripBefore
  * @param bool $appendAll
  * @return array
  */
 public function appendSelections($selectionsCollection, $stripBefore = false, $appendAll = true)
 {
     if ($stripBefore) {
         $this->_stripSelections();
     }
     if (!$this->_selectionsAppended) {
         foreach ($selectionsCollection->getItems() as $key => $_selection) {
             if ($_option = $this->getItemById($_selection->getOptionId())) {
                 if ($appendAll || $_selection->isSalable() && !$_selection->getRequiredOptions()) {
                     $_selection->setOption($_option);
                     $_option->addSelection($_selection);
                 } else {
                     $selectionsCollection->removeItemByKey($key);
                 }
             }
         }
         $this->_selectionsAppended = true;
     }
     return $this->getItems();
 }