function nocat() { $s = array('term_id' => '1'); if ($this->m_database->isBOF('terms', $s) == TRUE) { insertCategory('Uncategorized', 'uncategorized', '', '0'); } }
function browseCat4insert($catList) { olc_db_query("TRUNCATE TABLE " . TABLE_EBAY_CATEGORIES); $comma = "', "; $i = 0; foreach ($catList as $cat) { $sqlstring = INSERT_INTO . TABLE_EBAY_CATEGORIES . " (name, id, parentid, leaf, virtual, expired) VALUES "; $sqlstring .= "( "; $sqlstring .= APOS . addslashes(utf8_decode($cat->getCategoryName())) . $comma; $sqlstring .= APOS . $cat->getCategoryId() . $comma; $sqlstring .= APOS . $cat->getCategoryParentId() . $comma; $sqlstring .= APOS . $cat->getLeafCategory() . $comma; $sqlstring .= APOS . $cat->getIsVirtual() . $comma; $sqlstring .= APOS . $cat->getIsExpired() . APOS; $sqlstring .= " )"; insertCategory($sqlstring); } }
function funcSubCategory($SubCategory, $parent) { $parent = insertCategory($SubCategory->Name, 0, $parent); foreach ($SubCategory->SubCategory as $itemSubCategory) { if (count($itemSubCategory->children()) > 0) { funcSubCategory($itemSubCategory->children(), $parent); } else { insertCategory($itemSubCategory, 0, $parent); } } }
} else { $name = ''; } //$categories = getCategoriesList(0); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $action = $_POST['action']; $name = $_POST['name']; $category_id = $_POST['category_id']; $error = array(); if (strlen($name) < 3 || strlen($name) > 32) { $error['name'] = $lang['error_category_name']; } if (empty($error)) { if ($action == "insert") { $insert_data = array('name' => $name); $insert_query = insertCategory($insert_data); if ($insert_query) { $_SESSION['success'] = $lang['success_insert']; } else { $error_warning = $lang['error_query']; } } else { if ($action == "update") { $edit_data = array('categoryId' => $category_id, 'name' => $name); $edit_query = editCategory($edit_data); if ($edit_query) { $_SESSION['success'] = $lang['success_edit']; } else { $_SESSION['error_warning'] = $lang['error_query']; } }
function insertCategoryPost($postid, $category = '') { if (!empty($category)) { foreach ($category as $k => $v) { $slug = dbField('terms', 'term_id', $v, 'slug'); $d = array('post_id' => $postid, 'term_type' => 'category', 'term_value' => $v); if ($this->m_database->isBOF('poststaxonomy', $d) == TRUE) { $this->m_database->addRow('poststaxonomy', $d); insertCategory($v, $slug, "", "0"); } } } else { $d = array('post_id' => $postid, 'term_type' => 'category', 'term_value' => '1'); if ($this->m_database->isBOF('poststaxonomy', $d) == TRUE) { $this->m_database->addRow('poststaxonomy', $d); } } }
$multicats = checkMultiCat($pid); $category2 = explode(';', $category); for ($c = 0; $c < count($category2); $c++) { $catdata = explode('||', $category2[$c]); $catdata_id = array(); for ($s = 0; $s < count($catdata); $s++) { if ($s > 0) { $cid = getCategoryID($catdata[$s], $this->sys_language_uid, $catdata_id[$s - 1]); } else { $cid = getCategoryID($catdata[$s], $this->sys_language_uid); } if (!$cid) { if ($s > 0) { $cid = insertCategory($catdata[$s], $this->shop_pid, $this->sys_language_uid, $catdata_id[$s - 1]); } else { $cid = insertCategory($catdata[$s], $this->shop_pid, $this->sys_language_uid, 0); } } $catdata_id[$s] = $cid; } if (count($category2) > 1) { productToCategories($pid, $catdata_id[count($catdata_id) - 1]); $referred_cid[] = $catdata_id[count($catdata_id) - 1]; } else { productToCategories($pid, $catdata_id[count($catdata_id) - 1]); $referred_cid[] = $catdata_id[count($catdata_id) - 1]; } } if (!empty($relation)) { $sql = "insert into tx_multishop_products_to_relative_products(products_to_relative_product_id, products_id, relative_product_id) values "; $values = '';
require "includes/admin_header.php"; ?> <?php require_once "../database/category_functions.php"; ?> <?php /** INSERT CATEGORY **/ if (isset($_POST['submit_add_category'])) { $category_title = $_POST['category_title']; if (empty(trim($category_title))) { $insert_error_message = "Category title can not be empty"; } else { insertCategory($category_title); $insert_success_message = "Category created successfully"; } } /** UPDATE CATEGORY **/ if (isset($_POST['submit_edit_category'])) { $category_id = $_POST['category_id']; $new_category_title = $_POST['category_title']; if (empty(trim($new_category_title))) { $update_error_message = "Category title can not be empty"; } else { updateCategory($category_id, $new_category_title); $update_success_message = "Category updated successfully"; } } /** DELETE CATEGORY **/