/** * Function updates the changes made in the site moto details into the table * * * @return string */ function updatesiteSettings() { $remove = array("\\n", "\\r"); $_POST['google_analytics'] = str_replace($remove, "", $_POST['google_analytics']); $_POST['customer_header'] = str_replace($remove, "", $_POST['customer_header']); if ($_FILES['site_logo']['name'] != '') { $site_logo_path = 'images/logo/' . date("YmdHis") . '_' . $_FILES['site_logo']['name']; if (move_uploaded_file($_FILES['site_logo']['tmp_name'], '../' . $site_logo_path)) { $site_logo = $site_logo_path; } } else { $site_logo = $_POST['site_logo']; } $sql = "UPDATE admin_settings_table SET \n\t\t\tcustomer_header ='" . trim($_POST['customer_header']) . "' ,\n\t\t\tsite_logo='" . $site_logo . "',\n\t\t\tgoogle_analytics='" . trim($_POST['google_analytics']) . "',\n\t\t\ttime_zone='" . trim($_POST['time_zone']) . "',\n\t\t\tsite_moto='" . trim($_POST['site_moto']) . "',\t\t\t\n\t\t\tmeta_kerwords='" . stripslashes(trim($_POST['meta_kerwords'])) . "',\n\t\t\tmeta_description='" . stripslashes(trim($_POST['meta_description'])) . "'\n\t\t\twhere set_id='1'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { $_SESSION['msgSitemoto'] = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> Site settings has been updated successfully </div>'; } else { $_SESSION['msgSitemoto'] = '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button>Site settings has not been updated successfully</div>'; } header('Location:?do=site'); exit; }
/** * Function updates the contact us details into the table * * * @return string */ function updateContactUs() { $sql = "UPDATE contactus_table SET contactus='" . $_POST['contactus'] . "' Where id=1"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="success_msgbox">Contact Us Information Updated Successfully</div>'; } else { return '<div class="error_msgbox">Content Not Updated </div>'; } }
/** * Function updates the order status into the database * * * @return string */ function updateOrderStatus() { $name = $_POST['orderstatus']; $id = $_POST['id']; $sql = "update orders_status_table set orders_status_name='" . $name . "' where orders_status_id=" . $id; $obj = new Bin_Query(); $obj->updateQuery($sql); $fin = 'One Record is Updated Successfully'; return $fin; }
/** * Function updates the copyrights details into the table * * * @return string */ function updateCopyrights() { $sql = "UPDATE admin_settings_table SET set_value='" . $_POST['copyrights'] . "' Where set_name='Copy Rights'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="success_msgbox">Copy right Information Updated Successfully</div>'; } else { return '<div class="error_msgbox">Copyright Not Updated </div>'; } }
/** * Function updates the changes made in the time zone details into the database * * * @return string */ function updateTimeZone() { if ($_POST['timezone'] != '') { $sql = "UPDATE admin_settings_table SET set_value='" . $_POST['timezone'] . "' where set_name='Time Zone'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong> well done !</strong> Timezone Updated to <b>' . $_POST['timezone'] . '</b> Successfully</div>'; } } }
/** * Function updates the custom header details into the table * * * @return string */ function updateCustomHeader() { $sql = "update admin_settings_table set set_value='" . trim($_POST['headerContent']) . "' where set_name='Custom Header'"; $obj = new Bin_Query(); if ($obj->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong> well done !</strong> Custom Header changed Successfully</div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Unable to change Custom Header</div>'; } }
/** * Function adds an HTML Content value into the database * * * @return string */ function addContent() { if (trim($_POST['contentname']) != '' && trim($_POST['htmlcontent']) != '') { $content = $_POST['contentname']; $sql = "INSERT INTO html_contents_table (html_content_name,html_content) VALUES ('" . $content . "','" . $_POST['htmlcontent'] . "')"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="success_msgbox">Content Added Successfully</div>'; } } else { return '<div class="error_msgbox">Field Can not be Blank</div>'; } }
/** * Function updates the privacy policy content into the database * * * @return string */ function updatePrivacyPolicy() { $sql = "UPDATE privacypolicy_table SET privacypolicy='" . $_POST['privacypolicy'] . "' Where id=1"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Well done!</strong> Privacy Policy Updated Successfully</div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Privacy Policy Not Updated </div>'; } }
/** * Function updates the about us value into the database * * * @return string */ function updateAboutUs() { $sql = "update aboutus_table set content='" . trim($_POST['aboutus']) . "' where id=1"; $obj = new Bin_Query(); if ($obj->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Well done!</strong> AboutUs Content changed Successfully</div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Unable to change AboutUs Content</div>'; } }
/** * Function updates the terms and conditions content to the database * * * @return string */ function updateTerms() { $sql = "UPDATE termsconditions_table SET termscontent='" . $_POST['termscontent'] . "' Where termsid=1"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Well done!</strong> Content Updated Successfully</div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Content Not Updated </div>'; } }
/** * Function adds a new header link into the database * * * @return string */ function addLink() { $sql = "SELECT * FROM header_link_table WHERE link_name ='" . $_POST['linkname'] . "'"; $query = new Bin_Query(); if ($query->executeQuery($sql)) { echo "Already this link is Added"; } else { $sql = "INSERT INTO header_link_table (link_name,link_url) VALUES ('" . $_POST['linkname'] . "','" . $_POST['linkurl'] . "')"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { echo "Added Successfully"; } } }
/** * Function updates the changes made in the domain name * * * @return string */ function updateDomainName() { if ($_POST['name'] != '') { $sql = "UPDATE admin_settings_table SET set_value='" . $_POST['name'] . "' where set_name='Domain Name'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="success_msgbox" style="width:646px;">Domain Name <b>' . $_POST['name'] . '</b> Saved Successfully</div>'; } else { return '<div class="error_msgbox" style="width:646px;">Domain Name Not Found</div>'; } } else { return '<div class="error_msgbox" style="width:646px;">Domain Name Should Not Be Empty</div>'; } }
/** * Function updates the changes in the Google Adword code into the database * * * @return string */ function updateGoogleAddWordsCode() { if ($_POST['gaddwords'] != '') { $gad = "<div id=\"ad\">" . $_POST['gaddwords'] . "</div>"; $sql = "UPDATE admin_settings_table SET set_value='" . stripslashes(mysql_real_escape_string($gad)) . "' \n\t\t\twhere set_name='Google AdWords code'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="success_msgbox">Updated Successfully</div>'; } else { return '<div class="error_msgbox">Sorry Not Updated </div>'; } } else { return '<div class="error_msgbox">Please Insert a Google adword Script Code</div>'; } }
/** * Function adds a new skin into the database * * * @return string */ function insertSkin() { $sql = "INSERT INTO skins_table (skin_name,skin_status) VALUES ('" . $_POST['skinname'] . "',0)"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { unset($_SESSION['skinname']); return '<div class="alert alert-success"> <button data-dismiss="alert" class="close" type="button">×</button> Updated Successfully</div>'; //$_SESSION['msg']= "Added Successfully"; } else { unset($_SESSION['skinname']); return '<div class="alert alert-error"> <button data-dismiss="alert" class="close" type="button">×</button> Problem while insert</div>'; //$_SESSION['msg']= "Problem while insert"; } }
/** * Function updates the changes made in the featured products * * * @return string */ function updateProducts() { for ($i = 0; $i < count($_POST['productid']); $i++) { if (!in_array($_POST['productid'][$i], $_POST['checkbox'])) { $arr[] = $_POST['productid'][$i]; } } if (isset($_POST['checkbox'])) { foreach ($arr as $val) { $sql = "UPDATE products_table SET is_featured='0' WHERE product_id='" . $val . "'"; $query = new Bin_Query(); $query->updateQuery($sql); } return '<div class="success_msgbox">Featured Products Updated Successfully</div>'; } }
/** * Function updates the selected Google Analytics code into the table * * * @return string */ function updateGoogleAnalytics() { if ($_POST['gcode'] != '') { $sql = "UPDATE admin_settings_table SET set_value='" . $_POST['gcode'] . "' where set_name='Google Analytics Code'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong> well done !</strong> Updated Successfully</div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Not Updated !!! Try Again </div>'; } } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Please Insert a Google Analytics Script Code</div>'; } }
/** * Function updates the changes made in the site email * * * @return string */ function updateSiteEmail() { if ($_POST['email'] != '') { $sql = "UPDATE admin_settings_table SET set_value='" . $_POST['email'] . "' where set_name='Admin Email'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> Site Email Settings <b>' . $_POST['email'] . '</b> Saved Successfully</div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Admin Email Site Settings Not Found</div>'; } } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Admin Email Id Should Not Be Empty</div>'; } }
/** * Function updates the changes made in the site moto details into the table * * * @return string */ function updateLiveChat() { if ($_REQUEST['live_chat_status'] == '0') { $live_chat_status = "0"; } else { $live_chat_status = "1"; } $sql = "UPDATE live_chat_table SET \n\t\t\tlive_chat_script ='" . html_entity_decode($_REQUEST['live_chat_script']) . "' ,\n\t\t\tlive_chat_status ='" . $live_chat_status . "'\t\t\t\n\t\t\twhere id='1'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { $_SESSION['msglivechat'] = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button>Live chat has been updated successfully </div>'; } else { $_SESSION['msglivechat'] = '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button>Live chat has not been updated successfully</div>'; } header('Location:?do=livechat'); exit; }
/** * Function updates the changes made in the Google Ad Sense code into the database * * * @return string */ function updateGoogleAdSenseCode() { if ($_POST['gadsense'] != '') { $gad = "<div id=\"ad\">" . $_POST['gadsense'] . "</div>"; // $sql = "UPDATE admin_settings_table SET set_value='".stripslashes(mysql_real_escape_string($gad))."' where set_name='Google AdSense code'"; $sql = "UPDATE admin_settings_table SET set_value='" . stripslashes($gad) . "' where set_name='Google AdSense code'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Well done!</strong> Updated Successfully</div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Not Updated!!! Try Again </div>'; } } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Please Insert a Google adsense Script Code</div>'; } }
/** * Function updates the cse id into the table * * * @return string */ function saveCse() { $registerid = $_POST['regid']; if (count($Err->messages) > 0) { $output['val'] = $Err->values; $output['msg'] = $Err->messages; } else { if ($registerid != '') { $sql = "update admin_settings_table set set_value='" . $registerid . "' where set_name='www.pricerunner.com Affiliate ID'"; $obj = new Bin_Query(); if ($obj->updateQuery($sql)) { $result = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> Added Successfully</div>'; return $result; } else { $result = '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Not Inserted</div>'; return $result; } } } }
/** * This function is used to add the news letter * * . * * @return string */ function addNewsLetter() { if (isset($_POST['subId']) && $_POST['subId'] != '') { $stat = 0; if (isset($_POST['chkNewsSub'])) { $stat = 1; } $sqlselect = "update newsletter_subscription_table set status=" . $stat . " where subsciption_id=" . $_POST['subId']; $obj = new Bin_Query(); if ($obj->updateQuery($sqlselect)) { return '<div class="alert alert-success"> <button data-dismiss="alert" class="close" type="button">×</button> ' . Core_CLanguage::_(REQUEST_NEWS_UPDATED) . ' </div>'; } else { return '<div class="alert alert-error"> <button data-dismiss="alert" class="close" type="button">×</button> ' . Core_CLanguage::_(REQUEST_NEWS_NOT_UPDATED) . ' </div>'; } } }
/** * Function updates the changes made in the site moto details into the table * * * @return string */ function updateAdminProfile() { if ($_POST['admin_password'] != '' && $_SERVER['HTTP_HOST'] != 'demo.zeuscart.com') { $admin_password = md5(trim($_POST['admin_password'])); $sql = "UPDATE admin_table SET \n\t\t\tadmin_name ='" . trim($_POST['admin_name']) . "' ,\n\t\t\tadmin_password ='******'\t\t\t\n\t\t\twhere admin_id='1'"; } elseif ($_SERVER['HTTP_HOST'] != 'demo.zeuscart.com') { $sql = "UPDATE admin_table SET \n\t\t\tadmin_name ='" . trim($_POST['admin_name']) . "' \t\t\t\t\t\n\t\t\twhere admin_id='1'"; } $query = new Bin_Query(); if ($query->updateQuery($sql)) { $sql1 = "UPDATE admin_settings_table SET admin_email='" . $_POST['admin_email'] . "' \n\t\t\t\t WHERE set_id=1"; $query1 = new Bin_Query(); $query1->updateQuery($sql1); $_SESSION['msgadminproflie'] = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button>Admin profile has been updated successfully </div>'; } else { $_SESSION['msgadminproflie'] = '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button>Admin profile has not been updated successfully</div>'; } header('Location:?do=adminprofile'); exit; }
/** * Function updates the changes in the site logo into the database * * * @return string */ function updateSiteLogo() { $imagetypes = array('image/jpeg', 'image/pjpeg', 'image/bmp', 'image/gif', 'image/png', 'image/x-png'); $filetypename = $_FILES['logo']['type']; $file = explode("/", $_FILES['logo']['type']); if (count($file) > 2 || !in_array($_FILES['logo']['type'], $imagetypes)) { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Invalid image file format</div>'; } include 'classes/Lib/FileOperations.php'; include "classes/Lib/ThumbImage.php"; if ($_FILES['logo']['name'] != '') { $sfile = $_FILES['logo']['tmp_name']; $dbpath = "images/logo/" . date("Y-m-d-His") . $_FILES['logo']['name']; $file = new Lib_FileOperations(); $file->uploadFile($sfile, ROOT_FOLDER . $dbpath); list($img_w, $img_h, $type, $attr) = getimagesize($sfile); if ($img_h > 70) { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button>The Height of the logo should be lessthan or equal to 70px to suit properly.</div>'; } if ($img_w > 253) { new Lib_ThumbImage('thumb', ROOT_FOLDER . $dbpath, ROOT_FOLDER . "images/logo", 253); } $sql = "UPDATE admin_settings_table SET set_value='" . $dbpath . "' where set_name='Site Logo'"; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> Logo updated Successfully</div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Error while updating logo!</div>'; } } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Invalid image file.Please try again !</div>'; } }
/** * Function updates the changes made in the selected social link * * * @return void */ function updateSocialLink() { $title = trim($_POST['social_link_title']); $logo = trim($_POST['social_link_logo']); $url = trim($_POST['social_link_url']); $status = $_POST['status']; $sociallinkid = $_POST['sociallinkid']; if ($_FILES['social_link_logo']['name'] != '') { $varimgfilename = $_FILES['social_link_logo']['name']; $varimage = "images/sociallink/" . date("Y-m-d-His") . $varimgfilename; //inserted into db $varimageDir = ROOT_FOLDER . "images/sociallink"; // to upload the file $varstpath = ROOT_FOLDER . $varimage; move_uploaded_file($_FILES["social_link_logo"]["tmp_name"], $varstpath); $image = explode('/', $varstpath, 2); } else { $varstpath = $_POST['social_link_logo1']; $image[1] = $varstpath; } if ($status == '') { $status = 0; } $sql = "update social_links_table set social_link_title='{$title}',social_link_logo='{$image['1']}',social_link_url='{$url}',status={$status} where social_link_id='" . $_POST['social_link_id'] . "'"; $qry = new Bin_Query(); if ($qry->updateQuery($sql)) { $result = '<div class="alert alert-success"> <button data-dismiss="alert" class="close" type="button">×</button> Social Link Updated successfully.</div>'; } else { $result = '<div class="alert alert-error"> <button data-dismiss="alert" class="close" type="button">×</button> Social Link Not Updated successfully.</div>'; } return $result; }
/** * Function deletes the country wise tax settings for the selected id * * * @return string */ function deleteCountrywiseTax() { $taxid = (int) $_GET['taxid']; $sql = "DELETE FROM countrywisetax_settings_table WHERE id =" . $taxid; $query = new Bin_Query(); if ($query->updateQuery($sql)) { return '<div class="alert alert-success"> <button data-dismiss="alert" class="close" type="button">×</button> Tax Rate Deleted Successfully.</div>'; } else { return '<div class="alert alert-error"> <button data-dismiss="alert" class="close" type="button">×</button> Cannot Delete Tax. </div>'; } }
/** * Function gets the list of email ids available in the database * * * @return string */ function getEmailIds() { $sqlNews = "SELECT * FROM newsletter_table WHERE newsletter_status=1"; $objNews = new Bin_Query(); $objNews->executeQuery($sqlNews); if (!$objNews->executeQuery($sqlNews)) { include 'classes/Lib/Mail.php'; if ($_POST != '') { $sql = "select email from newsletter_subscription_table where status=1"; $obj = new Bin_Query(); if ($obj->executeQuery($sql)) { $cnt = count($obj->records); for ($i = 0; $i < $cnt; $i++) { $removal = array("rn"); $desc = str_replace($removal, "", trim($_POST['newsletter'])); $email = $obj->records[0]['email']; $title = $_POST['newslettertitle']; $mail_content = $desc; $this->sendingMail($email, $title, $mail_content); } $sql = "UPDATE newsletter_table SET newsletter_status=1 where newsletter_id=" . (int) $_GET['newsid']; $query = new Bin_Query(); if ($query->updateQuery($sql)) { $result = '<div class="alert alert-success"> <button data-dismiss="alert" class="close" type="button">×</button> Newsletter has been sent successfully.</div>'; } } else { $result = ' <div class="alert alert-error"> <button data-dismiss="alert" class="close" type="button">×</button>Invalid User.</div> '; } } else { $sql = "select email from newsletter_subscription_table where status=1"; $obj = new Bin_Query(); if ($obj->executeQuery($sql)) { $cnt = count($obj->records); for ($i = 0; $i < $cnt; $i++) { $removal = array("rn"); $desc = str_replace($removal, "", trim($_POST['newsletter'])); $email = $obj->records[0]['email']; $title = $_POST['newslettertitle']; $mail_content = $desc; $this->sendingMail($email, $title, $mail_content); } $sql = "UPDATE newsletter_table SET newsletter_status=1 where newsletter_id=" . (int) $_GET['newsid']; $query = new Bin_Query(); if ($query->updateQuery($sql)) { $result = '<div class="alert alert-success"> <button data-dismiss="alert" class="close" type="button">×</button> Newsletter has been sent successfully.</div>'; } } else { $result = ' <div class="alert alert-error"> <button data-dismiss="alert" class="close" type="button">×</button>Invalid User.</div> '; } } } else { $result = '<div class="alert alert-error"> <button data-dismiss="alert" class="close" type="button">×</button>This News letter has been sent to all users</div>'; } return $result; }
/** * Function updates the cross_products details for the selected category id * * * * @return array */ function updateProducts() { //include("classes/Display/DCategorySelection.php"); $temparray = array(); $temparray = $_POST['checkbox']; $checkboxvalue = implode(",", $temparray); $sql = "insert into cross_products_table (cross_product_id) values('" . $checkboxvalue . "')"; $query = new Bin_Query(); $query->updateQuery($sql); echo "<b>The Follwing Products have been added to cross prouducts:</b><br/>"; foreach ($_POST['checkbox'] as $val) { $sqltitle = "SELECT * FROM products_table WHERE product_id ='" . $val . "'"; $query->executeQuery($sqltitle); echo "<li>" . $query->records[0]['title'] . "</li><br />"; } }
/** * Function updates the shipping tracker information into the database. * * * @return string */ function updateShippingTrackerSetting() { $cnt = count($_POST['ship_id']); for ($i = 0; $i < $cnt; $i++) { $shippingid = $_POST['ship_id'][$i]; $shipment_user_id = $_POST['shipment_user_id'][$i]; $shipment_password = $_POST['shipment_password'][$i]; $shipment_accesskey = $_POST['shipment_accesskey'][$i]; $sql = "UPDATE shipments_master_table SET status=0 where shipment_id=" . $shippingid . ""; $obj1 = new Bin_Query(); $obj1->updateQuery($sql); if ($shippingid != '') { $sql = "UPDATE shipments_master_table SET\n\t\t\t\tshipment_user_id='" . $shipment_user_id . "',\n\t\t\t\tshipment_password='******',\n\t\t\t\tshipment_accesskey ='" . $shipment_accesskey . "'\n\t\t\t\twhere shipment_id=" . $shippingid . ""; $obj1 = new Bin_Query(); if ($obj1->updateQuery($sql)) { $_SESSION['shipmentMsg'] = '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> Shipment Settings settings has been updated successfully </div>'; } } } $shpistat_cnt = count($_POST['shippingstatus']); for ($j = 0; $j < $shpistat_cnt; $j++) { $shippingstatus = $_POST['shippingstatus'][$j]; $sql = "UPDATE shipments_master_table SET status=1 where shipment_id=" . $shippingstatus . ""; $obj1 = new Bin_Query(); $obj1->updateQuery($sql); } header("Location:?do=showshipmenttracker"); }
/** * Function uploads the supplied tsv file into the table * * * @return string */ function uploadTSVFile() { $tsvfilename = $_FILES['category_file']['tmp_name']; $legal_extentions = array("tsv"); $file_ext = strtolower(end(explode(".", $_FILES['category_file']['name']))); if (!in_array($file_ext, $legal_extentions)) { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> The file you are attempting to upload is not supported by this server</div>'; } $file = explode(".", $_FILES['category_file']['name']); if (count($file) > 2 || $file[1] != 'tsv') { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> The file you are attempting to upload is not supported by this server</div>'; } if (file_exists($tsvfilename) > 0) { // $stpath="uploadedtsvfile/".date("YmdHis").$tsvfilename; $stpath = "uploadedtsvfile/" . date("YmdHis") . "category.tsv"; if (move_uploaded_file($tsvfilename, $stpath)) { $targetpath = $stpath; if (file_exists($targetpath)) { $fp = fopen($targetpath, 'r'); $records = array(); $rowfirst = fgets($fp); $rowfirst = str_replace("\n", "", $rowfirst); $tmpfirst = explode("\t", trim($rowfirst)); $chkfieldsarr = array('category_name', 'description', 'type', 'category_parent_id'); $cmp_arr = array_diff($tmpfirst, $chkfieldsarr); if (empty($cmp_arr)) { $pro_fields = implode(',', $chkfieldsarr); $pro_cnt = 0; $fail_cnt = 0; while ($row = fgets($fp)) { $row = str_replace("\n", " ", $row); $pro = $inv = explode("\t", addslashes(trim($row))); $check = new Core_CCategoryBulkUpload(); $check->checkCatExists($pro[0], $pro[3]); if ($check->checkCatExists($pro[0], $pro[3])) { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> ' . $pro[0] . ' Category Name Already Exists </div>'; } if ($pro[3] != 0 && $pro[2] != 'parent') { $dflt = new Core_CCategoryBulkUpload(); $dflt->checkIsParentCategory($pro[3]); if ($dflt->checkIsParentCategory($pro[3])) { $pro = "'" . implode("','", array_splice($pro, 0, 4)) . "'"; $pro = str_replace("child", "1", $pro); $sql = ' INSERT INTO category_table(category_name, category_desc, category_status,category_parent_id) VALUES (' . $pro . ')'; $obj = new Bin_Query(); if ($obj->updateQuery($sql)) { $pro_cnt++; } else { $fail_cnt++; } } else { $fail_cnt++; } } else { $pro = "'" . implode("','", array_splice($pro, 0, 3)) . "'"; $pro = str_replace("parent", "0", $pro); $sql = 'INSERT INTO category_table(category_name,category_desc, category_parent_id,category_status) VALUES (' . $pro . ',1)'; $obj = new Bin_Query(); if ($obj->updateQuery($sql)) { $pro_cnt++; } else { $fail_cnt++; } } //exit(); /*if ($dflt->checkIsParentCategory($pro[3])) { $pro="'". implode("','",array_splice($pro,0,16))."'"; $inv=implode(",",array_splice($inv,16,2)); $sql=' INSERT INTO products_table( category_id, title, description, sku, brand, model, msrp, price, weight, dimension, shipping_cost, status , tag, meta_desc, meta_keywords, is_featured ) VALUES ('.$pro.')'; $obj=new Bin_Query(); if($obj->updateQuery($sql)) { $sql=' INSERT INTO product_inventory_table( product_id, soh, rol ) VALUES ('.$obj->insertid.',' .$inv.')'; if($obj->updateQuery($sql)) $pro_cnt++; else $fail_cnt++; } else $fail_cnt++; } else $fail_cnt++; */ } return '<div class="alert alert-success"> <button type="button" class="close" data-dismiss="alert">×</button> ' . $pro_cnt . ' Categories Created Successfullly . ' . $fail_cnt . ' Categories Not Created </div>'; } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Please Check The Format Of TSV File </div>'; } fclose($fp); } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> Error Uploading File</div>'; } } else { return '<div class="alert alert-error"> <button type="button" class="close" data-dismiss="alert">×</button> TSV File is not created </div>'; } } }
/** * Function updates the changes made in the gift product details * * * @return array */ function updateGiftProduct() { include 'classes/Lib/ThumbImage.php'; $category_id = implode(",", $_POST['selcatgory']); // $category_parent_id=(int)$_POST['selsubcatgory']; // $sub_category_parent_id =(int)$_POST['selsubundersubcatgory']; $title = $_POST['product_title']; $description = addslashes(htmlentities($_POST['desc'])); $sku = $_POST['sku']; $tag = $_POST['tag']; $product_video = htmlentities($_POST['videotag']); if ($_POST['intro_date'] != '') { $intro_date = $_POST['intro_date']; $intro_date = date("Y-m-d", strtotime($intro_date)); } else { $intro_date = date('Y/m/d'); } if ($_POST['is_feautured'] == 'on') { $is_feautured = 1; } else { $is_feautured = 0; } if ($_POST['status'] == 'on') { $status = 1; } else { $status = 0; } $price = (double) $_POST['price']; $msrp_org = (double) $_POST['msrp_org']; $msrp = $_POST['msrp']; $meta_keywords = $_POST['meta_keywords']; $meta_desc = $_POST['meta_desc']; $sql = "update products_table set category_id = '" . $category_id . "',sku = '" . $sku . "',title = '" . $title . "',description = '" . $description . "',msrp = '" . $msrp_org . "',price = '" . $price . "',status = '" . $status . "',tag = '" . $tag . "',meta_desc = '" . $meta_desc . "',meta_keywords = '" . $meta_keywords . "',intro_date = '" . $intro_date . "',is_featured = '" . $is_feautured . "' where product_id =" . (int) $_GET['prodid']; $obj1234 = new Bin_Query(); if ($obj1234->updateQuery($sql)) { // For Image Uploading// if (count($_FILES['ufile']['tmp_name']) > 0) { $obj_insert = new Bin_Query(); $product_id = (int) $_GET['prodid']; for ($i = 0; $i < count($_FILES['ufile']['name']); $i++) { $imgfilename = $_FILES['ufile']['name'][$i]; if ($imgfilename != '') { $imagefilename = date("Y-m-d-His") . $imagefilename; // generate a new name $image = "images/products/" . $imgfilename; // updated into DB $thumb_image = "images/products/thumb/" . $imgfilename; // updated into DB $large_image = "images/products/large_image/" . $imgfilename; // updated large image into DB $stpath = ROOT_FOLDER . $image; $imageDir = ROOT_FOLDER . "images/products"; $thumbDir = ROOT_FOLDER . "images/products/thumb"; $largeDir = ROOT_FOLDER . "images/products/large_image"; if (move_uploaded_file($_FILES["ufile"]["tmp_name"][$i], $stpath)) { new Lib_ThumbImage('thumb', $stpath, $thumbDir, THUMB_WIDTH, THUMB_HEIGHT); new Lib_ThumbImage('thumb', $stpath, $imageDir, IMAGE1_WIDTH, IMAGE1_HEIGHT); new Lib_ThumbImage('thumb', $stpath, $largeDir, IMAGE2_WIDTH, IMAGE2_HEIGHT); } if ($i == 0) { if ($_POST['ufile_id'][$i] != '') { $spl = "UPDATE product_images_table SET image_path='{$image}', thumb_image_path='{$thumb_image}',large_image_path='{$large_image}' WHERE product_images_id='" . $_POST['ufile_id'][$i] . "'"; $obj_insert->updateQuery($spl); } else { $spl = "INSERT INTO product_images_table(product_id,image_path,thumb_image_path,type,large_image_path) VALUES('" . $product_id . "','{$image}','{$thumb_image}','main','{$large_image}')"; $obj_insert->updateQuery($spl); } $update = "UPDATE products_table set image='{$image}',thumb_image='{$thumb_image}',large_image_path='{$large_image}' where product_id='" . $product_id . "'"; $obj_insert->updateQuery($update); } else { if ($_POST['ufile_id'][$i] != '') { $spl = "UPDATE product_images_table SET image_path='{$image}', thumb_image_path='{$thumb_image}',large_image_path='{$large_image}' WHERE product_images_id='" . $_POST['ufile_id'][$i] . "'"; } else { $spl = "INSERT INTO product_images_table(product_id,image_path,thumb_image_path,type,large_image_path) VALUES('" . $product_id . "','{$image}','{$thumb_image}','sub','{$large_image}')"; } } $obj_insert->updateQuery($spl); } } } $output = ' <div class="alert alert-success"> <button data-dismiss="alert" class="close" type="button">×</button>Product <b>' . $title . '</b> has been updated successfully</div>'; } else { $output = ' <div class="alert alert-error"> <button data-dismiss="alert" class="close" type="button">×</button>Product <b>' . $title . '</b> has not been updated</div>'; } return $output; }