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']); $insertSlaveMast = $db->insert($glob['dbprefix']."CubeCart_options_bot", $data); if($insertSlaveMast == true) { $msg = "

".$lang['admin']['products_opt_mast_slave_success']."

"; } else { $msg = "

".$lang['admin']['products_opt_mast_slave_fail']."

"; } 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); if($delete == TRUE){ $msg = "

".$lang['admin']['products_opt_opt_deleted']."

"; } else { $msg = "

".$lang['admin']['products_opt_opt_not_deleted']."

"; } //httpredir(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); if($delete == TRUE){ $msg = "

".$lang['admin']['products_opt_att_deleted']."

"; } else { $msg = "

".$lang['admin']['products_opt_att_not_deleted']."

"; } //httpredir(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); if($delete == TRUE){ $msg = "

".$lang['admin']['products_opt_assigned_deleted']."

"; } else { $msg = "

".$lang['admin']['products_opt_assigned_not_deleted']."

"; } //httpredir(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); if($update == TRUE){ $msg = "

".$lang['admin']['products_option_edit_success']."

"; } else { $msg = "

".$lang['admin']['products_option_edit_fail']."

"; } //httpredir(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); if($update == TRUE){ $msg = "

".$lang['admin']['products_attribute_edit_success']."

"; } else { $msg = "

".$lang['admin']['products_attribute_edit_fail']."

"; } //httpredir(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); if($update == TRUE){ $msg = "

".$lang['admin']['products_assign_edit_success']."

"; } else { $msg = "

".$lang['admin']['products_assign_edit_fail']."

"; } //httpredir(urldecode($_POST['redir'])); } //////////////////////////////////////// // get recordsets for all required data ///////// $optionsPerPage = 15; $attributesPerPage = 15; $existingOptionsPerPage = 20; // 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 = 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; $inumrows($query), $attributesPerPage, $attPage, "attPage"); if($_GET['prodIdFilter']>0){ $query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_options_bot INNER JOIN ".$glob['dbprefix']."CubeCart_inventory ON product = productId WHERE productId = ".$db->mySQLSafe($_GET['prodIdFilter'])." ORDER BY name, value_id ASC"; } elseif(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 = paginate($db->numrows($query), $existingOptionsPerPage, $exiPage, "exiPage"); $excluded = array( "editOption" => 1, "delOption" => 1, "editAttribute" => 1, "delAttribute" => 1, "editAssigned" => 1, "delAssigned" => 1, ); $currentPage = urlencode(currentPage($excluded)); require($glob['adminFolder'].CC_DS."includes".CC_DS."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) { ?>


'; } ?> ');" class="txtLink"> "; } ?>
  value="" class="textbox" /> " />
href="?_g=products/options&editAttribute=&redir=" class="txtLink"> ');" class="txtLink"> '; } ?>
  " />

0){ echo priceFormat($existingOptions[$i]['option_price'],TRUE); } else { echo $lang['admin_common']['na']; } ?> href="?_g=products/options&editAssigned=&redir=" class="txtLink"> " class="txtLink"> '; } ?>
  value="" /> " />