Пример #1
0
 /**
  * Edit the product from edit product form
  * full post request
  *
  */
 function edit()
 {
     $cat_id = (int) $this->request('cat_id');
     $parent_id = (int) $this->request('parent_id');
     $this->product = $this->_assignProductFromRequest($cat_id);
     if ($this->product && $this->checkProduct()) {
         $model = rad_instances::get('model_corecatalog_catalog');
         if ($this->_have_sp or $this->_have_sphit or $this->_have_spnews or $this->_have_spoffer) {
             $model->setState('sp_offers', true);
         }
         $rows = $model->updateItem($this->product);
         if ($this->request('main_3d_image')) {
             rad_instances::get('model_corecatalog_3dimages')->setMain((int) $this->request('main_3d_image'), (int) $this->request('cat_id'));
         }
         if ($this->request('del_3dimg')) {
             $del3d = $this->request('del_3dimg');
             foreach ($del3d as $idImg => $value) {
                 rad_instances::get('model_corecatalog_3dimages')->delete3Dimage($idImg);
             }
         }
         if (rad_config::getParam('cleanurl.on')) {
             rad_cleanurl::setAlias('product', $cat_id, $this->getContentLangID(), $this->post('url_alias'));
         }
         if ($this->request('returntorefferer') == '0') {
             $url = $this->makeURL('alias=SITE_ALIAS');
             if (strlen($parent_id) > 0) {
                 $url .= '#nic/' . $parent_id;
             }
             $this->redirect($url);
         }
         //if returntorefferer
         return true;
     }
     return false;
 }