示例#1
0
 /**
  * add inputs
  */
 public function setInputs()
 {
     parent::setInputs($this->getAdditionalInfo('inputs'));
 }
示例#2
0
文件: Xml.php 项目: buttasg/cowgirlk
 /**
  * set inputs
  */
 public function setInputs()
 {
     $result = array();
     foreach ($this->item->getOptions() as $option) {
         /** @var Mage_Catalog_Model_Product_Option $option */
         $inputType = $this->_mapInputType($option->getType());
         $inputItem = new Shopgate_Model_Catalog_Input();
         $inputItem->setUid($option->getId());
         $inputItem->setType($inputType);
         $inputItem->setLabel($option->getTitle());
         $inputItem->setRequired($option->getIsRequire());
         $inputItem->setValidation($this->_buildInputValidation($inputType, $option));
         $inputItem->setSortOrder($option->getSortOrder());
         /**
          * add additional price for types without options
          */
         switch ($inputType) {
             case Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_TEXT:
             case Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_AREA:
             case Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_FILE:
             case Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_DATE:
             case Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_DATETIME:
             case Shopgate_Model_Catalog_Input::DEFAULT_INPUT_TYPE_TIME:
                 $inputItem->setAdditionalPrice($this->_getInputValuePrice($option));
                 break;
             default:
                 $inputItem->setOptions($this->_buildInputOptions($option));
                 break;
         }
         $result[] = $inputItem;
     }
     if ($this->item->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
         $result = $this->_setBundleOptions($result);
     }
     parent::setInputs($result);
 }