public function execute() { $this->product_id = waRequest::get('id'); if (waRequest::post('product_id')) { $related_model = new shopProductRelatedModel(); $type = waRequest::post('type'); $data = array('product_id' => $this->product_id, 'type' => $type, 'related_product_id' => waRequest::post('product_id')); if (waRequest::post('delete')) { $related_model->deleteByField($data); } else { $related_model->replace($data); } } else { if (waRequest::post('cross_selling') !== null) { $this->save('cross_selling'); } if (waRequest::post('upselling') !== null) { $this->save('upselling'); } } }