diff --git a/admin/phpfiles/manageproduct.php b/admin/phpfiles/manageproduct.php index fa31e6c..d7da526 100644 --- a/admin/phpfiles/manageproduct.php +++ b/admin/phpfiles/manageproduct.php @@ -38,22 +38,20 @@ function delete_confirm(id) var current_id = $('#product_id').val(); var product_name = $('#product').val(); - var url = ''; - - if(current_id<=0) - { - url = "module=Product&mode=NewProduct&name="+product_name; - } - else - { - url = "module=Product&mode=NewProduct&id="+current_id+"&name="+product_name; - } - //alert(url); + var postData = { + module: "Product", + mode: "NewProduct", + name: product_name + }; + if (current_id) { + postData.id = current_id; + } $.ajax({ - type: "GET", + type: "POST", url: "ajax.php", - data: url, + dataType: "json", + data: postData, success: function(msg){ //alert( "Data Saved: " + msg ); window.location.reload(); @@ -175,7 +173,7 @@ function activate_confirm(id) - + @@ -244,14 +244,15 @@ function checkBrokenLinks($url) { - echo "CHECKBOX:".filter_input(INPUT_POST, 'mtxo', FILTER_SANITIZE_STRING); -} else { - $mtco='0'; -}*/ -/*if (isset($_POST['mtco'])) { - $mtco="1"; -} else $mtco = "0";*/ -//$mtco = (isset($_REQUEST['mtxo']) && $_REQUEST['mtxo']!="")?1:0; -//$mtco = (empty($_POST['mtco'])) ? 1 : 0; // fix up review date format $review_date = (""==$review_date)?'NULL':"'".date('Y-m-d', strtotime($review_date))."'"; /* - todo: change new product function to call edit product with empty id check for dup product name? product + vendor should be unique yes? - */ +function consoleLog($msg) { + echo ''; +} + if (empty($id)) { // add new product & capture ID with SELECT LAST_INSERT_ID(); $sql = "insert product (vendor_id, product_name, status, review_date, www, notes, mtco) @@ -62,6 +43,13 @@ www = '".$www."', notes = '".$notes."', mtco = ".$mtco." where product_id=".$id; + + //$prod = fopen("/tmp/prod.txt", "w"); + // writing content to a file using fwrite() function + //echo fwrite($prod, $sql); + // closing the file + //fclose($prod); + mysqli_query($con, $sql) or die(mysqli_error($con)); }
-
+ @@ -277,10 +275,10 @@ function activate_confirm(id) $sql1 = "SELECT * FROM vendor WHERE vendor_id='".$row['vendor_id']."'"; $res1 = mysqli_query($conn, $sql1); $row1 = mysqli_fetch_array($res1); - $url = $row1['www']; + $www = $row1['www']; - if (strpos($url, '://') === FALSE && $url ) { - $url = 'http://'.$url; + if (strpos($www, '://') === FALSE && $www ) { + $www = 'http://'.$www; } if(($j%2)==0) @@ -290,7 +288,7 @@ function activate_confirm(id) ?>
>%s",mtco); + var mtco = $("#mtxo").val(); + + console.log("URL::>>%s",www); + console.log("MTCO::>>%s",mtco); //review_date = $.datepicker.formatDate('yy-dd-mm', review_date); @@ -457,30 +458,28 @@ function reloadproduct(){ var url = "phpfiles/saveproductschanges.php"; //var post_data_obj = {id:pid, prod_name:prod_name, vendor_id:vendor_id, review_date:review_date, notes:notes}; //, 'procost[]':procost, 'promarket[]':promarket}; var post_data = { - id:pid, + id:pid, mtco:mtco, notes:notes, www:www, prod_name:product_name, vendor_id:vendor_id, review_date:review_date, - www:www, - notes:notes, - mtco:mtco, 'procost[]':procost, 'promarket[]':promarket }; //, 'procost[]':procost, 'promarket[]':promarket}; - var post_data_qry = $.param(post_data); - // show hourglass while saving - $(document.body).css({'cursor' : 'wait'}); - // get DOM element for button - var buttonDomElement = evt.target; - // Disable the button - $(buttonDomElement).attr('disabled', true); - - $.post("phpfiles/saveproductschanges.php", post_data, + var post_data_qry = $.param(post_data); + // show hourglass while saving + $(document.body).css({'cursor' : 'wait'}); + // get DOM element for button + var buttonDomElement = evt.target; + // Disable the button + $(buttonDomElement).attr('disabled', true); + console.log('posturl:', url); + console.log('postdata:', post_data); + $.post(url, post_data, function(response) { $('#product-dialog').dialog( "close" ); $("#btn_Product").click(); // show hourglass while saving - $(document.body).css({'cursor' : 'default'}); + $(document.body).css({'cursor' : 'default'}); }); }, @@ -574,7 +573,7 @@ function(response) { var buttonDomElement = evt.target; // Disable the button $(buttonDomElement).attr('disabled', true); - console.log('post data:', post_data); + //console.log('post data:', $.post_data); $.post(url,{'procost[]':procost,'promarket[]':promarket}, function(response) { /*$("#save-result").html(response);*/ $('#new-product-dialog').dialog( "close" ); diff --git a/admin/phpfiles/productdetails.php b/admin/phpfiles/productdetails.php index fe031cc..38787c9 100644 --- a/admin/phpfiles/productdetails.php +++ b/admin/phpfiles/productdetails.php @@ -15,9 +15,9 @@ $productname = $row['product_name']; $vendor_id = $row['vendor_id']; $review_date = (''==$row['review_date']||empty($row['review_date']))?'':date('m/d/Y', strtotime($row['review_date'])); - $www = $row['www']; - $notes = $row['notes']; - $mtco = $row['mtco']; + $www = $row['www']; + $notes = $row['notes']; + $mtco = $row['mtco']; } mysqli_free_result($res); } else { @@ -193,7 +193,7 @@ function checkBrokenLinks($url) {