Пример #1
0
 /**
  *
  * @param string $scope
  * @param int $scopeId
  * @param int $parentId
  */
 protected function savePaymentConfigs($scope = 'websites', $scopeId, $parentId = 0)
 {
     $parentField = 'parent_default_id';
     $parentScope = 'default';
     if ($scope == 'stores') {
         $parentField = 'parent_websites_id';
         $parentScope = 'websites';
     }
     /** @var $collection Payone_Core_Model_Domain_Resource_Config_PaymentMethod_Collection */
     $collection = $this->getFactory()->getModelDomainConfigPaymentMethod()->getCollection();
     $collection->addFieldToFilter('scope', $parentScope);
     $collection->addFieldToFilter('scope_id', $parentId);
     // @todo hs: include deleted configs?
     foreach ($collection->getItems() as $parentConfig) {
         $childPaymentConfig = new Payone_Core_Model_Domain_Config_PaymentMethod();
         $childPaymentConfig->setScope($scope);
         $childPaymentConfig->setScopeId($scopeId);
         $childPaymentConfig->setCode($parentConfig->getCode());
         $childPaymentConfig->setData($parentField, $parentConfig->getId());
         $childPaymentConfig->save();
     }
 }