/** * creates a new entry if you are not a shop admin * * @param String $keywordString * @return Int */ static function add_entry($keywordString, $productCount = 0, $groupCount = 0) { if ($member = Member::currentUser()) { if ($member->IsShopAdmin()) { return -1; } } $obj = new SearchHistory(); $obj->Title = $keywordString; $obj->ProductCount = $productCount; $obj->GroupCount = $groupCount; return $obj->write(); }
public static function add_entry($KeywordString) { if ($parent = self::find_entry($KeywordString)) { //do nothing } else { $parent = new SearchHistory(); $parent->Title = $KeywordString; $parent->write(); } if ($parent) { $obj = new SearchHistoryLog(); $obj->SearchedForID = $parent->ID; $obj->write(); return $parent; } }