0 && $_POST['slaveProduct']>0) { // duplicate the attributes of the masterProduct into the slave product $masterArray = $db->select("SELECT * FROM ".$glob['dbprefix']."CubeCart_options_bot WHERE product=".$db->mySQLSafe($_POST['masterProduct'])); for ($i=0; $imySQLSafe($_POST['slaveProduct']); $data['option_id'] = $db->mySQLSafe($masterArray[$i]['option_id']); $data['value_id'] = $db->mySQLSafe($masterArray[$i]['value_id']); $data['option_price'] = $db->mySQLSafe($masterArray[$i]['option_price']); $data['option_symbol'] = $db->mySQLSafe($masterArray[$i]['option_symbol']); $db->insert($glob['dbprefix']."CubeCart_options_bot", $data); unset($data); } } //////////////////////////////////////// // if delete get variable is set ///////// $delete = ""; $where = ""; if(isset($_GET['delOption']) && $_GET['delOption']>0){ $where = "option_id = ".$db->mySQLSafe($_GET["delOption"]); $delete = $db->delete($glob['dbprefix']."CubeCart_options_bot", $where); $where = "father_id = ".$db->mySQLSafe($_GET["delOption"]); $delete = $db->delete($glob['dbprefix']."CubeCart_options_mid", $where); $where = "option_id = ".$db->mySQLSafe($_GET["delOption"]); $delete = $db->delete($glob['dbprefix']."CubeCart_options_top", $where); header("Location: ".urldecode($_GET['redir'])); } elseif(isset($_GET['delAttribute']) && isset($_GET['optId']) && $_GET['delAttribute']>0 && $_GET['optId']>0) { $where = "value_id =".$db->mySQLSafe($_GET["delAttribute"])." AND option_id = ".$db->mySQLSafe($_GET["optId"]); $delete = $db->delete($glob['dbprefix']."CubeCart_options_bot", $where); $where = "value_id =".$db->mySQLSafe($_GET["delAttribute"]); $delete = $db->delete($glob['dbprefix']."CubeCart_options_mid", $where); header("Location: ".urldecode($_GET['redir'])); } elseif(isset($_GET['delAssigned']) && $_GET['delAssigned']>0) { $where = "assign_id =".$db->mySQLSafe($_GET["delAssigned"]); $delete = $db->delete($glob['dbprefix']."CubeCart_options_bot", $where); header("Location: ".urldecode($_GET['redir'])); } //////////////////////////////////////// // if add post variable is set ///////// if(isset($_POST['add']) && $_POST['add']=="option"){ $record['option_name'] = $db->mySQLSafe($_POST["option"]); $insert = $db->insert($glob['dbprefix']."CubeCart_options_top", $record); if($insert == TRUE){ $msg = "

".$lang['admin']['products']['opt_add_success']."

"; } else { $msg = "

".$lang['admin']['products']['opt_add_fail']."

"; } } elseif(isset($_POST['add']) && $_POST['add']=="attribute") { $record['value_name'] = $db->mySQLSafe($_POST["attribute"]); $record['father_id'] = $db->mySQLSafe($_POST["option"]); $insert = $db->insert($glob['dbprefix']."CubeCart_options_mid", $record); if($insert == TRUE){ $msg = "

".$lang['admin']['products']['att_add_success']."

"; } else { $msg = "

".$lang['admin']['products']['att_add_fail']."

"; } } elseif(isset($_POST['add']) && $_POST['add']=="assign"){ $record['product'] = $db->mySQLSafe($_POST["productId"]); $record['option_id'] = $db->mySQLSafe($_POST["option"]); $record['value_id'] = $db->mySQLSafe($_POST["attribute"]); $record['option_price'] = $db->mySQLSafe($_POST["price"]); $record['option_symbol'] = $db->mySQLSafe($_POST["sign"]); $insert = $db->insert($glob['dbprefix']."CubeCart_options_bot", $record); if($insert == TRUE){ $msg = "

".$lang['admin']['products']['assign_success']."

"; } else { $msg = "

".$lang['admin']['products']['assign_fail']."

"; } } //////////////////////////////////////// // if edit post variable is set ///////// if(isset($_POST['edit']) && $_POST['edit']=="option") { $record['option_name'] = $db->mySQLSafe($_POST["option"]); $where = "option_id = ".$db->mySQLSafe($_POST["option_id"]); $update = $db->update($glob['dbprefix']."CubeCart_options_top", $record, $where); header("Location: ".urldecode($_POST['redir'])); } elseif(isset($_POST['edit']) && $_POST['edit']=="attribute") { $record['value_name'] = $db->mySQLSafe($_POST["attribute"]); $record['father_id'] = $db->mySQLSafe($_POST["option"]); $where = "value_id = ".$db->mySQLSafe($_POST["value_id"]); $update = $db->update($glob['dbprefix']."CubeCart_options_mid", $record, $where); header("Location: ".urldecode($_POST['redir'])); } elseif(isset($_POST['edit']) && $_POST['edit']=="assigned"){ $record['product'] = $db->mySQLSafe($_POST["productId"]); $record['option_id'] = $db->mySQLSafe($_POST["option"]); $record['value_id'] = $db->mySQLSafe($_POST["attribute"]); $record['option_price'] = $db->mySQLSafe($_POST["price"]); $record['option_symbol'] = $db->mySQLSafe($_POST["sign"]); $where = "assign_id = ".$db->mySQLSafe($_POST["assign_id"]); $update = $db->update($glob['dbprefix']."CubeCart_options_bot", $record, $where); header("Location: ".urldecode($_POST['redir'])); } //////////////////////////////////////// // get recordsets for all required data ///////// $optionsPerPage = ""; $attributesPerPage = ""; $existingOptionsPerPage = ""; $optionsPerPage = 10; $attributesPerPage = 10; $existingOptionsPerPage = 10; // products $query = "SELECT productId, ".$glob['dbprefix']."CubeCart_inventory.cat_id, name, cat_name FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_category ON ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id ORDER BY cat_name ASC"; $products = $db->select($query); // options if(isset($_GET['editOption']) && $_GET['editOption']>0) { $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_options_top WHERE option_id = ".$db->mySQLSafe($_GET['editOption'])." ORDER BY option_name ASC"; } else { $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_options_top ORDER BY option_name ASC"; } if(isset($_GET['optPage'])){ $optPage = $_GET['optPage']; } else { $optPage = 0; } $options = $db->select($query, $optionsPerPage, $optPage); $optionsPaginate = ""; $optionsPaginate = $db->paginate($db->numrows($query), $optionsPerPage, $optPage, "optPage"); // attributes if(isset($_GET['editAttribute']) && $_GET['editAttribute']>0){ $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_options_mid INNER JOIN ".$glob['dbprefix']."CubeCart_options_top ON father_id = option_id WHERE value_id = ".$db->mySQLSafe($_GET['editAttribute'])." ORDER BY option_name, value_name ASC"; } else { $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_options_mid INNER JOIN ".$glob['dbprefix']."CubeCart_options_top ON father_id = option_id ORDER BY option_name, value_name ASC"; } if(isset($_GET['attPage'])){ $attPage = $_GET['attPage']; } else { $attPage = 0; } $attributes = $db->select($query, $attributesPerPage, $attPage); $fullAttributes = $db->select($query); for ($i=0; $ipaginate($db->numrows($query), $attributesPerPage, $attPage, "attPage"); // existing options if(isset($_GET['editAssigned']) && $_GET['editAssigned']>0){ $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_options_bot INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON product = productId WHERE assign_id = ".$db->mySQLSafe($_GET['editAssigned'])." ORDER BY name, value_id ASC"; } else { $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_options_bot INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON product = productId ORDER BY name, option_id, value_id ASC"; } if(isset($_GET['exiPage'])){ $exiPage = $_GET['exiPage']; } else { $exiPage = 0; } $existingOptions = $db->select($query, $existingOptionsPerPage, $exiPage); $existingOptionsPaginate = ""; $existingOptionsPaginate = $db->paginate($db->numrows($query), $existingOptionsPerPage, $exiPage, "exiPage"); $currentPage = ""; $currentPage = urlencode(currentPage()); include("../includes/header.inc.php"); ?>

select("SELECT DISTINCT product, name FROM ".$glob['dbprefix']."CubeCart_options_bot INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON product = productId ORDER BY name ASC"); //get array of product ID's to miss out of slaves for ($i=0; $iselect("SELECT DISTINCT productId, name FROM ".$glob['dbprefix']."CubeCart_options_bot RIGHT JOIN ".$glob['dbprefix']."CubeCart_inventory ON product = productId ORDER BY name ASC"); if($masterProducts == TRUE && $slaveProducts == TRUE) { ?>
href="?editOption=&redir=" class="txtLink"> | href="javascript:decision('','?delOption=&redir=');" class="txtLink">
  value="" class="textbox" /> " class="submit" />
href="?editAttribute=&redir=" class="txtLink"> | href="javascript:decision('','?delAttribute=&optId=&redir=');" class="txtLink">
  " class="submit" />
 
0){ echo priceFormat($existingOptions[$i]['option_price']); } else { echo $lang['admin']['na']; } ?> href="?editAssigned=&redir=" class="txtLink"> | href="javascript:decision('','?delAssigned=&redir=');" class="txtLink">
  value="" />