function ProductUpdateCart($argProductID, $argQty) { $objCore = new Core(); $objGeneral = new General(); $arrCartDetails = array(); $arrNewCart = array(); if (isset($_SESSION['sessCartDetails'])) { $arrCartDetails = $_SESSION['sessCartDetails']; } foreach ($arrCartDetails as $arrTempCartData) { $varPrdId = $arrTempCartData['ProductId']; if ($varPrdId == $argProductID) { $arrTempCartData['Qty'] = $argQty; //getting details $arrCol = array('pkProductID', 'ProductName', 'ProductCode', 'ProductDescription', 'ProductSpecifications', 'ProductWeight', 'ProductCost', 'ProductActualCost', 'ProductQuantity', 'ProductQuantityAvailable', 'ProductStatus', 'ProductIsFeatured', 'ProductImage', 'ProductIsSpecailOffer', 'ProductDateAdded', 'ProductDateModified'); $varWhr = 'pkProductID=' . $argProductID; $arrProduct = $objGeneral->getRecord(TABLE_PRODUCTS, $arrCol, $varWhr); } array_push($arrNewCart, $arrTempCartData); } if ($_SESSION['sessMess']) { $_SESSION['sessVarMsg'] = ''; $_SESSION['sessVarMsg'] = 'Cart details have been updated successfully .'; $_SESSION['sessFlag'] = false; $objCore->setSuccessMsg($_SESSION['sessVarMsg']); } unset($_SESSION['sessCartDetails']); $_SESSION['sessCartDetails'] = $arrNewCart; }
function sendNewsletter($argArrPost) { $objValidation = new Validate_fields(); $objCore = new Core(); $objGeneral = new General(); $objValidation->check_4html = false; // Server Side validation for fileds. $objValidation->add_text_field('To', strip_tags($argArrPost['frmSendTo']), 'text', 'y'); $objValidation->add_text_field('Subject', strip_tags($argArrPost['frmNewsletterSubject']), 'text', 'y'); $objValidation->add_text_field('Message', $argArrPost['frmNewsletterMessage'], 'text', 'y'); if ($objValidation->validation()) { $errorMsgFirst = 'Please enter required fields!'; } else { $errorMsg = $objValidation->create_msg(); } //Checking for Error. if ($errorMsg) { // Save Data into Session variable. $objCore->setErrorMsg($errorMsg); header("location: newsletter_send_uil.php?NewsletterID=" . $argArrPost['frmNewsletterID']); exit; } else { $varWhr = "AdminUserName = '******'sessAdminUserName'] . "' "; $arrCols = array('AdminEmail'); $arrAdminInfo = $objGeneral->getRecord(TABLE_ADMIN, $arrCols, $varWhr); $varAdminEmail = $arrAdminInfo[0]['AdminEmail']; // MAIL CONTENT. $varFromUser = SITE_NAME . '<' . $varToAdmin . '>'; $varSubject = SITE_NAME . ': Newsletter: ' . $argArrPost['frmNewsletterSubject']; $varMessage = $argArrPost['frmNewsletterMessage']; $varMessage = str_replace("\\", "", $varMessage); $varMessage = str_replace("<IMG", "<img", $varMessage); $chkStr = strstr($varMessage, "<img"); if ($chkStr) { $varMessage = str_replace('src="/', 'src="' . SITE_ROOT_URL_HOST, $varMessage); $varMessage = str_replace("html_editor//", "html_editor/", $varMessage); } // ARRAY $arrColumns = array('pkSubscriberID', 'SubscriberEmail'); // CHECK FOR MEMBERS WHO WILL RECIEVED NEWSLETTER. if ($argArrPost['frmSendTo'] == 'AllSubscribers') { $varWhere = "1"; $arrSubscriberResult = $objGeneral->getRecord(TABLE_SUBSCRIBERS, $arrColumns, $varWhere); for ($i = 0; $i < count($arrSubscriberResult); $i++) { $varToUser = '******' . $arrSubscriberResult[$i]['SubscriberEmail'] . '>'; //echo $varMessage;die; $objCore->sendMail(ucwords($varToUser), $varFromUser, $varSubject, $varMessage); } $objCore->setSuccessMsg(ADMIN_NEWSLETTER_SEND_MAIL_TO_ALL_SUCCESS_MSG); return true; } else { if ($argArrPost['frmSubscriberID']) { foreach ($argArrPost['frmSubscriberID'] as $varSubscriberID) { $varWhere = "pkSubscriberID = '" . $varSubscriberID . "'"; $arrResult = $objGeneral->getRecord(TABLE_SUBSCRIBERS, $arrColumns, $varWhere); $varToUser = '******' . $arrResult[0]['SubscriberEmail'] . '>'; //echo $varMessage;die; $objCore->sendMail(ucwords($varToUser), $varFromUser, $varSubject, $varMessage); } } $objCore->setSuccessMsg(ADMIN_NEWSLETTER_SEND_MAIL_SUCCESS_MSG); return true; } } }
function sendOrderDetailMailToAdmin($argUniqueOrderNumber, $arrCartDetails, $arrUserDetail) { $objCore = new Core(); $objGeneral = new General(); @extract($arrUserDetail); $varPath = SITE_ROOT_URL . 'common/images/logo.jpg'; $arrAdminCol = array('pkadminID', 'AdminEmail'); //print_r($arrUserDetail);die; $arrAdminInfo = $objGeneral->getRecord(admin, $arrAdminCol); $varToAdmin = $arrAdminInfo[0]['AdminEmail']; $varFrom = SITE_NAME . '<' . $varToAdmin . '>'; //code for emailTemplate $varStr = '<table width="70%" border="0" cellspacing="0" cellpadding="0"> <tr><td>Dear Admin,<br>You have received a new order<br> Below are order details:<br></td> </tr> </tr> <tr><td>OrderID: ' . $argUniqueOrderNumber . '</td> </tr> </table>'; $varStr .= '<table width="70%" border="1" cellspacing="0" cellpadding="0"> <tr> <th width="31%">Product</th> <th width="21%">Unit Price</th> <th width="23%">Qty.</th> <th width="21%">Total</th> </tr>'; foreach ($arrCartDetails as $arrTempCartData) { $productid = $arrTempCartData['ProductId']; $product = $arrTempCartData['ProductName']; $productprice = $arrTempCartData['ProductPrice']; $productcode = $arrTempCartData['ProductCode']; $productqty = $arrTempCartData['Qty']; $productimage = $arrTempCartData['ProductImage']; /*$varDiscount = $_SESSION['sessOrderDiscount']; $productprice = $productprice- $varDiscount;*/ $subtotal = $productqty * $productprice; $total += $subtotal; $_SESSION['sessAmount'] = ''; $_SESSION['sessAmount'] = $total; if ($productimage != "") { //Get file extention $varExt = substr(strrchr($productimage, "."), 1); $varImageFileNameNoExt = substr($productimage, 0, -(strlen($varExt) + 1)); //Create thumb file name $varImageFileName = $varImageFileNameNoExt . '_thumb.' . $varExt; $varPath = SITE_ROOT_URL; //echo $varPath; $path = $varPath . 'common/uploaded_files/products/' . $productimage; $patExist = SOURCE_ROOT . 'common/uploaded_files/products/' . $productimage; $noImage = SITE_ROOT_URL . 'common/images/bnoimage.jpg'; if (file_exists($patExist)) { list($width, $height) = getimagesize($path); $varImageFlag = 1; } else { $varImageFlag = 0; $varImageFileName = ''; } } else { $varImageFileName = ''; } $varStr .= '<tr><td> '; if ($varImageFlag) { $varPath = SITE_ROOT_URL; $path = $varPath . 'common/uploaded_files/products/' . $productimage; $varStr .= ' <img src=' . $path . ' width="132" height="80" >'; } else { $varPath = SITE_ROOT_URL; $path = $varPath . 'common/images/bnoimage.jpg'; $varStr .= ' <img src=' . $path . ' width="132" height="80" >'; } $varStr .= '<br /> <td> ' . $objCore->setPriceFormat($productprice) . '</td> <td> ' . $productqty . '</td> <td> ' . $objCore->setPriceFormat($subtotal) . '</td> </tr>'; } if ($_SESSION['sessOrderDiscount']) { $varStr .= '<tr> <td colspan="3">Sub-Total:</td> <td> ' . $objCore->setPriceFormat($total) . '</td> </tr>'; $varStr .= '<tr> <td colspan="3">Allowed Discount:</td> <td> ' . $objCore->setPriceFormat($_SESSION['sessOrderDiscount']) . '</td> </tr>'; $total = $total - $_SESSION['sessOrderDiscount']; $varStr .= '<tr> <td colspan="3">Final Amount:</td> <td> ' . $objCore->setPriceFormat($total) . '</td> </tr></table>'; } else { $varStr .= '<tr> <td colspan="3">Sub-Total:</td> <td> ' . $objCore->setPriceFormat($total) . '</td> </tr></table>'; } $varStr .= '<table width="70%" border="0" cellspacing="0" cellpadding="0"> <tr><td> </td></tr> <tr><td>User Billing details are mentioned below:<br></td> </tr><table>'; $varStr .= '<table width="70%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="40%">Street Address 1:</td> <td>' . $arrUserDetail[0]['CustomerAddressOne'] . '</td> </tr> <tr> <td width="40%">Street Address 2:</td> <td>' . $arrUserDetail[0]['CustomerAddressTwo'] . '</td> </tr> <tr> <td>City :</td> <td>' . $arrUserDetail[0]['CustomerCity'] . '</td> </tr> <td>State:</td> <td>' . $arrUserDetail[0]['CustomerState'] . '</td> </tr> </tr> <td>Zip/Postal Code:</td> <td>' . $arrUserDetail[0]['CustomerZipcode'] . '</td> </tr> </tr> <td>Country:</td> <td>' . $arrUserDetail[0]['CustomerCountry'] . '</td> </tr> <table>'; $varStr .= '<table width="70%" border="0" cellspacing="0" cellpadding="0"> <tr><td> </td></tr> <tr><td>User Shipping details are mentioned below:<br></td> </tr></table>'; $varStr .= '<table width="70%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="40%">Street Address 1:</td> <td>' . $arrUserDetail[0]['CustomerShippingAddressOne'] . '</td> </tr> <tr> <td width="40%">Street Address 2:</td> <td>' . $arrUserDetail[0]['CustomerShippingAddressTwo'] . '</td> </tr> <tr> <td>City :</td> <td>' . $arrUserDetail[0]['CustomerShippingCity'] . '</td> </tr> <td>State :</td> <td>' . $arrUserDetail[0]['CustomerShippingState'] . '</td> </tr> </tr> <td>Zip/Postal Code:</td> <td>' . $arrUserDetail[0]['CustomerShippingZipcode'] . '</td> </tr> <tr> <td>Country:</td> <td>' . $arrUserDetail[0]['CustomerShippingCountry'] . '</td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td>Regards,</td> <td> </td> </tr> <tr> <td>' . SITE_NAME . ' Team</td> <td> </td> </tr> <table>'; //echo $varOutPutValues;die; $varSubject = $varSubject = 'Order [' . $argUniqueOrderNumber . '] placed - [' . SITE_NAME . ']'; //send email //echo $varStr;die; $objCore->sendMail($varToAdmin, $varFrom, $varSubject, $varStr); return true; }
function doCustomerLogin($argArrPOST) { $objCore = new Core(); $objGeneral = new General(); if ($argArrPOST) { $varUserName = strip_tags(trim($argArrPOST['frmCustomerEmailID'])); $varPassword = strip_tags(trim($argArrPOST['frmCustomerPassword'])); $objValidation = new Validate_fields(); $objValidation->check_4html = true; // Server Side validation for fileds. $objValidation->add_text_field('Username', $varUserName, 'email', 'y'); $objValidation->add_text_field('Password', $varPassword, 'text', 'y'); if ($objValidation->validation()) { $errorMsgFirst = 'Please enter required fields!'; } else { $errorMsg = $objValidation->create_msg(); } //Checking for Error. if ($errorMsg) { // Save Data into Session variable. $_SESSION['sessArrLoginData'] = $argArrPOST; $objCore->setErrorMsg($errorMsg); return false; } else { $arrColumns = array('pkCustomerID', 'CustomerStatus', 'CustomerFirstName', 'CustomerLastName'); $varWhere = "CustomerEmailID = '" . $varUserName . "' AND CustomerPassword = encode('" . $varPassword . "','Demo Shop')"; $arrResult = $this->select(TABLE_CUSTOMERS, $arrColumns, $varWhere); if ($arrResult) { if ($arrResult['0']['CustomerStatus'] == 'Active') { $_SESSION['sessCustomerID'] = $arrResult['0']['pkCustomerID']; $_SESSION['sessCustomerUserName'] = $varUserName; $_SESSION['sessCustomerFirstName'] = $arrResult['0']['CustomerFirstName']; $_SESSION['sessCustomerLastName'] = $arrResult['0']['CustomerLastName']; $_SESSION['sessCustomerPass'] = $varPassword; return true; } else { $arrCol = array('AdminEmail'); //when Implement this then uncommented below two lines. $arrAdminResult = $objGeneral->getRecord(TABLE_ADMIN, $arrCol); $_SESSION['sessAdminEmail'] = $arrAdminResult[0]['AdminEmail']; //$_SESSION['sessAdminEmail'] ='vineet.kumar@mail.Demo Shop.com'; $varEmail = '<a style="text-decoration:none; font-weight:normal; color:#Fcdeac;" href=mailto:' . $_SESSION['sessAdminEmail'] . '>' . $_SESSION['sessAdminEmail'] . '</a>'; $objCore->setErrorMsg('Sorry! Your account has been deactivated by site Administrator. For further queries contact at ' . $varEmail) . "."; $_SESSION['sessCustomerID'] = ''; $_SESSION['sessCustomerUserName'] = ''; $_SESSION['sessCustomerPass'] = ''; $_SESSION['sessCustomerFirstName'] = ''; $_SESSION['sessCustomerLastName'] = ''; unset($_SESSION['sessCustomerID']); unset($_SESSION['sessCustomerUserName']); unset($_SESSION['sessCustomerPass']); return false; } } else { $objCore->setErrorMsg(USER_LOGIN_ERROR); $_SESSION['sessArrLoginData'] = $argArrPOST; $_SESSION['sessCustomerID'] = ''; $_SESSION['sessCustomerUserName'] = ''; $_SESSION['sessCustomerPass'] = ''; $_SESSION['sessAdminLastLogin'] = ''; $_SESSION['sessCustomerFirstName'] = ''; $_SESSION['sessCustomerLastName'] = ''; unset($_SESSION['sessCustomerID']); unset($_SESSION['sessCustomerUserName']); unset($_SESSION['sessCustomerPass']); return false; } } } else { $objCore->setErrorMsg(USER_LOGIN_ERROR); $_SESSION['sessArrLoginData'] = $argArrPOST; $_SESSION['sessUserID'] = ''; $_SESSION['sessCustomerUserName'] = ''; $_SESSION['sessCustomerPass'] = ''; $_SESSION['sessCustomerFirstName'] = ''; $_SESSION['sessCustomerLastName'] = ''; unset($_SESSION['sessCustomerFirstName']); unset($_SESSION['sessCustomerLastName']); unset($_SESSION['sessUserID']); unset($_SESSION['sessCustomerUserName']); unset($_SESSION['sessCustomerPass']); return false; } }
function removeProductsInformation($argProductsID) { $objCore = new Core(); $objGeneral = new General(); $varPath = SOURCE_ROOT . 'common/uploaded_files/products/'; foreach ($argProductsID as $varDeleteProductsID) { //delete and unlink images if exist $arrColumn = array('ProductImage'); $varWhere = 'pkProductID =\'' . $varDeleteProductsID . '\''; $varTableName = TABLE_PRODUCTS; $arrResultProductImages = $objGeneral->getRecord($varTableName, $arrColumn, $varWhere); if ($arrResultProductImages[0]['ProductImageName'] != '') { //unlink image $objGeneral->deleteImage($arrResultProductImages[0]['ProductImageName'], $varPath); } $varWhrCon = "pkProductID ='" . $varDeleteProductsID . "'"; $varTableName = TABLE_PRODUCTS; $this->delete($varTableName, $varWhrCon); } //end for loop $objCore->setSuccessMsg(ADMIN_DEL_PRODUCTS_SUCC_MSG); $objCore->standardRedirect('product_list_uil.php'); }