Beispiel #1
0
 /**
  * Return formatted config data for specified path prefix
  *
  * @param string $path Config path prefix
  * @param bool $full Simple config structure or not
  * @return array
  */
 protected function _getPathConfig($path, $full = true)
 {
     $is_csgroup = Mage::app()->getRequest()->getParam('is_csgroup', false);
     if (!$is_csgroup) {
         return parent::_getPathConfig($path, $full);
     }
     switch ($is_csgroup) {
         case 1:
             $groupData = Mage::app()->getRequest()->getPost();
             $gcode = isset($groupData['group_code']) && strlen($groupData['group_code']) > 0 ? $groupData['group_code'] : (Mage::app()->getRequest()->getParam('gcode', false) ? Mage::app()->getRequest()->getParam('gcode') : '');
             if (strlen($gcode) > 0) {
                 $path = $gcode . '/' . $path;
             }
             break;
         case 2:
             $vendorId = Mage::app()->getRequest()->getParam('vendor_id', 0);
             $vendor = Mage::getModel('csmarketplace/vendor')->load($vendorId);
             if ($vendor && $vendor->getId()) {
                 $path = $vendor->getId() . '/' . $path;
             }
     }
     $configDataCollection = Mage::getModel('core/config_data')->getCollection()->addScopeFilter($this->getScope(), $this->getScopeId(), $path);
     $config = array();
     foreach ($configDataCollection as $data) {
         if ($full) {
             $config[$data->getPath()] = array('path' => $data->getPath(), 'value' => $data->getValue(), 'config_id' => $data->getConfigId());
         } else {
             $config[$data->getPath()] = $data->getValue();
         }
     }
     return $config;
 }