Example #1
0
 public function save($data)
 {
     if (parent::save($data)) {
         if ($this->otable->j2store_option_id) {
             if (is_object($data)) {
                 $data = (array) $data;
             }
             if (isset($data['option_value']) && count($data['option_value'])) {
                 $ovTable = F0FTable::getInstance('optionvalue', 'Table');
                 $status = true;
                 foreach ($data['option_value'] as $optionvalue) {
                     $ovTable->load($optionvalue['j2store_optionvalue_id']);
                     $optionvalue['option_id'] = $this->otable->j2store_option_id;
                     if (!$ovTable->save($optionvalue)) {
                         $status = false;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
Example #2
0
 public function save($data)
 {
     if (parent::save($data)) {
         if ($this->otable->j2store_geozone_id) {
             if (isset($data['zone_to_geo_zone']) && count($data['zone_to_geo_zone'])) {
                 $grtable = F0FTable::getInstance('geozonerule', 'J2StoreTable');
                 $status = true;
                 foreach ($data['zone_to_geo_zone'] as $georule) {
                     $grtable->load($georule['j2store_geozonerule_id']);
                     $georule['geozone_id'] = $this->otable->j2store_geozone_id;
                     try {
                         $grtable->save($georule);
                     } catch (Exception $e) {
                         $status = false;
                     }
                     if (!$status) {
                         break;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
Example #3
0
 public function save($data)
 {
     if (parent::save($data)) {
         if ($this->otable->j2store_taxprofile_id) {
             if (isset($data['tax-to-taxrule-row']) && count($data['tax-to-taxrule-row'])) {
                 $trTable = F0FTable::getInstance('taxrules', 'Table');
                 $status = true;
                 foreach ($data['tax-to-taxrule-row'] as $taxrate) {
                     $trTable->load($taxrate['j2store_taxrule_id']);
                     $taxrate['taxprofile_id'] = $this->otable->j2store_taxprofile_id;
                     try {
                         $trTable->save($taxrate);
                     } catch (Exception $e) {
                         $status = false;
                     }
                     if (!$status) {
                         break;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
Example #4
0
 public function save($data)
 {
     $app = JFactory::getApplication();
     $task = $app->input->getString('task');
     if ($task == 'saveorder') {
         return parent::save($data);
     }
     if (parent::save($data)) {
         if (isset($this->otable->j2store_filtergroup_id)) {
             if (isset($data['filter_value']) && count($data['filter_value'])) {
                 $ovTable = F0FTable::getInstance('filter', 'J2StoreTable');
                 $status = true;
                 foreach ($data['filter_value'] as $filtervalue) {
                     $ovTable->load($filtervalue['j2store_filter_id']);
                     $filtervalue['group_id'] = $this->otable->j2store_filtergroup_id;
                     if (!$ovTable->save($filtervalue)) {
                         $status = false;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
Example #5
0
 public function save($data)
 {
     if (parent::save($data)) {
         if ($this->otable->j2store_filtergroup_id) {
             if (isset($data['filter_value']) && count($data['filter_value'])) {
                 $ovTable = F0FTable::getInstance('filter', 'J2StoreTable');
                 $status = true;
                 foreach ($data['filter_value'] as $filtervalue) {
                     $ovTable->load($filtervalue['j2store_filter_id']);
                     $filtervalue['group_id'] = $this->otable->j2store_filtergroup_id;
                     if (!$ovTable->save($filtervalue)) {
                         $status = false;
                     }
                 }
             } else {
                 return true;
             }
         }
     } else {
         return false;
     }
     return true;
 }
Example #6
0
 /**
  * This method runs before the $data is saved to the $table. Return false to
  * stop saving.
  *
  * @param   array     &$data   The data to save
  * @param   F0FTable  &$table  The table to save the data to
  *
  * @return  boolean  Return false to prevent saving, true to allow it
  */
 public function save($data)
 {
     $status = true;
     //get the customfieldtable
     $table = $this->getTable();
     $selectableBase = J2Store::getSelectableBase();
     $result = $selectableBase->save();
     if ($result) {
         //get process field because result is true
         $data = $selectableBase->fielddata;
         //$table = $this->getTable();
         //$table->bind($data);
         $status = parent::save($data);
         //return true;
         //return $table->field_id;
     } else {
         //error get it
         $errors = $selectableBase->errors;
         $error = implode(',', $errors);
         throw new Exception($error);
         $status = false;
     }
     return true;
 }