Ejemplo n.º 1
0
 /**
  * This function is used to get   the related product  list
  * 
  * 
  * @return HTML data
  */
 function relatedProducts()
 {
     $j = 0;
     $sql = "SELECT * from cross_products_table where product_id=" . (int) $_GET['prodid'];
     $query = new Bin_Query();
     if ($query->executeQuery($sql)) {
         $flag = '1';
         $resultproduct = $query->records;
         $arr = explode(',', $resultproduct[0]['cross_product_ids']);
         $arr = '"' . implode('","', $arr) . '"';
         if (count($arr) > 0) {
             for ($i = 0; $i < count($arr); $i++) {
                 $sql = "SELECT * from products_table where product_id in(" . $arr . ")";
                 $query = new Bin_Query();
                 if ($query->executeQuery($sql)) {
                     $cnt = count($query->records);
                     if ($cnt > 0) {
                         for ($i = 0; $i < $cnt; $i++) {
                             foreach ($query->records as $row) {
                                 $r[$j] = $row;
                                 $prid = $row['product_id'];
                                 $obj1 = new Core_CProductDetail();
                                 $minval = $obj1->disRates($prid);
                                 if ($minval > 0 or $minval != '') {
                                     $r[$j]['msrp'] = '$' . number_format($row['msrp'], 2) . ' - $' . number_format($minval, 2);
                                 } else {
                                     $r[$j]['msrp'] = '$' . number_format($row['msrp'], 2);
                                 }
                                 $j++;
                             }
                         }
                         $output .= Display_DProductDetail::relatedProducts($query->records, $flag, $r);
                     }
                 }
             }
         }
         return $output1 . $output;
     } else {
         //return '<div class="exc_msgbox">Related Products Not Found</div>';
         $output1 = '<div id="middle_details"><div id=""> <table width="" border="0" cellpadding="0" cellspacing="0"><tr>';
         return $output1;
     }
 }
Ejemplo n.º 2
0
    /**
     * Function gets the releated products from the cross products table 
     * 
     * 
     * @return string
     */
    function relatedProducts()
    {
        $sql = "SELECT * from cross_products_table where product_id=" . (int) $_GET['prodid'];
        $query = new Bin_Query();
        if ($query->executeQuery($sql)) {
            $resultproduct = $query->records;
            $arr = explode(',', $resultproduct[0]['cross_product_ids']);
            $output1 = '
			<table width="20%" border="0" cellpadding="0" cellspacing="0"><tr>';
            if (count($arr) > 0) {
                for ($i = 0; $i < count($arr); $i++) {
                    $sql = "SELECT * from products_table where product_id=" . $arr[$i];
                    $query = new Bin_Query();
                    $query->executeQuery($sql);
                    if ($query->totrows > 0) {
                        foreach ($query->records as $row) {
                            $r[$j] = $row;
                            $prid = $row['product_id'];
                            $obj1 = new Core_CProductDetail();
                            $minval = $obj1->disRates($prid);
                            if ($minval > 0 or $minval != '') {
                                $r[$j]['msrp'] = $_SESSION['currency']['currency_tocken'] . $row['msrp'] . ' - ' . $_SESSION['currency']['currency_tocken'] . $minval;
                            } else {
                                $r[$j]['msrp'] = $_SESSION['currency']['currency_tocken'] . $row['msrp'];
                            }
                            //$j++;
                            //print_r($r);
                            $output .= Display_DProductDetail::relatedProducts($r);
                        }
                    }
                }
            }
            return $output1 . $output;
        } else {
            //return '<div class="exc_msgbox">Related Products Not Found</div>';
            $output1 = '<div id="middle_details"><div id=""> <table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>';
            return $output1;
        }
    }