Пример #1
0
 /**
  * Function adds a new promotional code from the admin side 
  * 
  * 
  * @return array
  */
 function insertPromotionalCodes()
 {
     include "classes/Lib/CheckInputs.php";
     include 'classes/Core/CRoleChecking.php';
     include 'classes/Core/CPromotionalCodes.php';
     include 'classes/Display/DPromotionalCodes.php';
     //$obj = new Lib_CheckInputs('productreg');
     $output['val'] = $Err->values;
     $output['msg'] = $Err->messages;
     $chkuser = Core_CRoleChecking::checkRoles();
     if ($chkuser) {
         include 'classes/Lib/FileOperations.php';
         include 'classes/Core/CAdminHome.php';
         $output['username'] = Core_CAdminHome::userName();
         $output['currentDate'] = date('l, M d, Y H:i:s');
         $output['currency_type'] = $_SESSION['currency']['currency_tocken'];
         $output['monthlyorders'] = (int) Core_CAdminHome::monthlyOrders();
         $output['previousmonthorders'] = (int) Core_CAdminHome::previousMonthOrders();
         $output['totalorders'] = (int) Core_CAdminHome::totalOrders();
         $output['currentmonthuser'] = (int) Core_CAdminHome::currentMonthUser();
         $output['previousmonthuser'] = (int) Core_CAdminHome::previousMonthUser();
         $output['totalusers'] = (int) Core_CAdminHome::totalUsers();
         $output['currentmonthincome'] = Core_CAdminHome::currentMonthIncome();
         $output['previousmonthincome'] = Core_CAdminHome::previoustMonthIncome();
         $output['totalincome'] = Core_CAdminHome::totalIncome();
         $output['currentmonthproudctquantity'] = (int) Core_CAdminHome::currentMonthProudctQuantity();
         $output['previousmonthproudctquantity'] = (int) Core_CAdminHome::previousMonthProudctQuantity();
         $output['totalproudctquantity'] = (int) Core_CAdminHome::totalProudctQuantity();
         $output['lowstock'] = Core_CAdminHome::lowStock();
         $output['totalproducts'] = Core_CAdminHome::totalProducts();
         $output['enabledproducts'] = Core_CAdminHome::enabledProducts();
         $output['disabledproducts'] = Core_CAdminHome::disabledProducts();
         $output['pendingorders'] = (int) Core_CAdminHome::pendingOrders();
         $output['processingorders'] = (int) Core_CAdminHome::processingOrders();
         $output['deliveredorders'] = (int) Core_CAdminHome::deliveredOrders();
         $output['insertmsg'] = Core_CPromotionalCodes::insertPromotionalCode();
         $output['display'] = Core_CPromotionalCodes::displayPromotionalCodes();
         Bin_Template::createTemplate('createpromocodes.html', $output);
     } else {
         $output['usererr'] = 'You are Not having Privilege to view this page contact your Admin for detail';
         Bin_Template::createTemplate('Errors.html', $output);
     }
 }
Пример #2
0
 /**
  * Function adds the new promotional codes into the database.
  * 
  * 
  * @return string
  */
 function createPromotionalCodes()
 {
     /*$sql="SELECT  b.category_name as parentcatname ,b.category_id as parentid, a.category_name as subcatname, a.category_id FROM category_table a,category_table b  WHERE a.category_parent_id <> 0 AND a.category_parent_id=b.category_id ORDER BY parentcatname";
     		$obj=new Bin_Query();
     		$obj->executeQuery($sql);
     		
     		$arr=$obj->records;*/
     $sql = "SELECT  category_name as parentcatname ,category_id as parentid FROM category_table WHERE category_parent_id = 0 ORDER BY parentcatname";
     $obj = new Bin_Query();
     $obj->executeQuery($sql);
     $rows = $obj->records;
     $i = 0;
     foreach ($rows as $row) {
         $sql = "SELECT  category_id , category_name FROM category_table WHERE category_parent_id = " . $row['parentid'] . " ORDER BY category_name";
         $obj1 = new Bin_Query();
         $obj1->executeQuery($sql);
         $subcats = $obj1->records;
         if (count($subcats) > 0) {
             $list[$i]['id'] = $row['parentid'];
             $list[$i]['catname'] = $row['parentcatname'];
             foreach ($subcats as $subcat) {
                 $list[$i]['subcats'][] = $subcat;
             }
             $i++;
         }
     }
     $default = new Core_CPromotionalCodes();
     return Display_DPromotionalCodes::createPromotionalCodes($list, $default->getRandString(11));
 }