public function ajaxRemoveAttribute() { $errors = array(); if (!isset($_POST['id']) || empty($_POST['id'])) { $errors[] = __('Attribute does not exist.', 'jigoshop'); } if (!empty($errors)) { echo json_encode(array('success' => false, 'error' => join('<br/>', $errors))); exit; } $this->productService->removeAttribute((int) $_POST['id']); echo json_encode(array('success' => true)); exit; }
/** * Removes attribute from database. * * @param int $id Attribute ID. */ public function removeAttribute($id) { unset($this->attributes[$id]); return $this->service->removeAttribute($id); }