public function execute()
 {
     $id = waRequest::get('id', null, waRequest::TYPE_INT);
     $data = $this->getData($id);
     if (!isset($data['product_id']) && $id) {
         $data['product_id'] = $this->pages_model->select('product_id')->where('id=' . (int) $id)->fetchField('product_id');
     }
     $product = $this->getProduct($data['product_id']);
     // check rights
     if (!$this->product_model->checkRights($product)) {
         throw new waException(_w("Access denied"));
     }
     if ($id) {
         if (!$this->pages_model->update($id, $data)) {
             $this->errors[] = _w('Error saving product page');
             return;
         }
     } else {
         $id = $this->pages_model->add($data);
         if (!$id) {
             $this->errors[] = _w('Error saving product page');
             return;
         }
     }
     $page = $this->pages_model->getById($id);
     $page['name'] = htmlspecialchars($data['name']);
     $page['frontend_url'] = rtrim(wa()->getRouteUrl('/frontend/productPage', array('product_url' => $product['url'], 'page_url' => ''), true), '/');
     $page['preview_hash'] = $this->pages_model->getPreviewHash();
     $page['url_escaped'] = htmlspecialchars($data['url']);
     $this->response = $page;
 }