/** * Create a new item in the database * * @return mixed false if failed to create, the id of the item otherwise */ function create() { $_POST['catparentlist'] = ''; $_POST['catviews'] = 0; //if (!$this->CategoryExists($_POST['catparentid'], $_POST['catname'])) { if (!$this->CategoryExists($_POST['catparentid'], $_POST['catname']) && !$GLOBALS['ISC_CLASS_ADMIN_CATEGORY']->BrandSeriesDuplicationExists($_POST['catname'])) { //Commented & Changed by Simha $CatId = parent::create(); // If the save was successful, build the parent list if ($CatId) { $parentList = $this->BuildParentList($CatId); $updatedCategory = array("catparentlist" => $parentList); $GLOBALS['ISC_CLASS_DB']->UpdateQuery("categories", $updatedCategory, "categoryid='" . $GLOBALS['ISC_CLASS_DB']->Quote($CatId) . "'"); } // If the category doesn't have a parent, rebuild the root categories cache if ($_POST['catparentid'] == 0) { $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateRootCategories(); } // Rebuild the group pricing caches $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateCustomerGroupsCategoryDiscounts(); return $CatId; } else { //$this->error = sprintf(GetLang('apiCatAlreadyExists'), $_POST['catname']); $this->error = sprintf(GetLang('NameAlreadyExists'), $_POST['catname']); //Commented and changed by Simha return false; } }
/** * Create a new item in the database * * @return mixed false if failed to create, the id of the item otherwise */ function create() { $_POST['couponminpurchase'] = (int) $_POST['couponminpurchase']; if ($this->CouponExists($_POST['couponcode']) < 1) { return parent::create(); } else { $this->error = GetLang('apiCouponCodeAlreadyExists'); return false; } }
/** * Create a new item in the database * * @return mixed false if failed to create, the id of the item otherwise */ public function create($updateCache = true) { $_POST['catparentlist'] = ''; $_POST['catviews'] = 0; if (!$this->CategoryExists($_POST['catparentid'], $_POST['catname'])) { $CatId = parent::create(); // If the save was successful if($CatId) { if ($updateCache) { // adjust the nested set data for the new category $nested = new ISC_NESTEDSET_CATEGORIES(); $nested->adjustInsertedNode($CatId, (int)$_POST['catparentid']); // If the category doesn't have a parent, rebuild the root categories cache if($_POST['catparentid'] == 0) { $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateRootCategories(); } // Rebuild the group pricing caches $GLOBALS['ISC_CLASS_DATA_STORE']->UpdateCustomerGroupsCategoryDiscounts(); } // Also save our search record $this->saveSearch($CatId); // Save the words to the category_words table for search spelling suggestions Store_SearchSuggestion::manageSuggestedWordDatabase("category", $CatId, $_POST["catname"]); } return $CatId; } else { $this->error = sprintf(GetLang('apiCatAlreadyExists'), $_POST['catname']); return false; } }
public function create() { return parent::create(); }
/** * Send the ticket to FP! * * @return string Footprints ticket number, or an error. */ public function create() { return API::create(array($this)); }