	<?php

	$result = '';
	
	$phxcrmclient_id = $_COOKIE['phxcrmclient_id'];

	
	$result = '<div class="row">';
	
	$cart_id	= 0;
	
	$postage = 0;
	
	

	function get_product_image($prodserv_uid){
		
		 include 'configi.php';
		
		$queryprod="SELECT * from ".$_COOKIE['phxcrmclient_id']."_prod_search where sel_uid = " . $prodserv_uid;
	//	echo $queryprod;
		$resultprod=mysqli_query($conn, $queryprod);

		while($rowprod=mysqli_fetch_array($resultprod)) { 

			$var_image_url							 = $rowprod['prod_image_url1'];
			$main_uid								= $rowprod['main_uid'];
			

	
			
		}
		
			$querystti="SELECT * from ".$_COOKIE['phxcrmclient_id']."_prod_search where sel_uid = ".$main_uid;

		//	echo $querystti;
			$resultstti=mysqli_query($conn, $querystti);
	
			while($rowstti=mysqli_fetch_array($resultstti)) { 

				$main_image_url1			 			= $rowstti['prod_image_url1'];

			
			}
			
			
			if ($var_image_url == ""){
			
				$prod_image_url	=	$main_image_url1;
				
			}else{

				$prod_image_url	=	$var_image_url;
				
			}
		
		
		return $prod_image_url;
	
	}
	
	
	 include 'configi.php';
		$prod_image_url1 = "";

		$querystt="SELECT title, main_uid, ".$_COOKIE['phxcrmclient_id']."_prodserv_quickpick.*, ".$_COOKIE['phxcrmclient_id']."_prod_search.sku,".$_COOKIE['phxcrmclient_id']."_prod_search.price FROM ".$_COOKIE['phxcrmclient_id']."_prodserv_quickpick INNER JOIN ".$_COOKIE['phxcrmclient_id']."_prod_search ON ".$_COOKIE['phxcrmclient_id']."_prodserv_quickpick.qp_prodserv_uid = ".$_COOKIE['phxcrmclient_id']."_prod_search.sel_uid";

	//	echo $querystt;
		$resultstt=mysqli_query($conn, $querystt);
	


		while($rowstt=mysqli_fetch_array($resultstt)) { 

			$price			 			= $rowstt['price'];
			$sku			 			= $rowstt['sku'];
			$title			 			= $rowstt['title'];
			$qp_prodserv_uid 			= $rowstt['qp_prodserv_uid'];
			$main_uid		 			= $rowstt['main_uid'];


			$disp_price = $price;
			
			//get image url for main uid
			
		$prod_image_url1 = get_product_image($qp_prodserv_uid);
			
			$user_status = 1;
			
			
			$querymode="SELECT * from phx_userid where idphx_userid =  ".$_COOKIE['phxcrmclient_id'];

	//		echo $querystti;
			$resultmode=mysqli_query($conn, $querymode);
	
			while($rowmode=mysqli_fetch_array($resultmode)) { 
			
				$user_status			 			= $rowmode['user_status'];
			}
			
			
			// if demo mode change url
			
		//	if ($user_status == 0){
				
				//	$strfind = $_COOKIE['phxcrmclient_id']."_";
			//		echo $prod_image_url1;
				
				//	echo "<br>";
			//		$prod_image_url1 = str_replace("247", "94",$prod_image_url1);
					$prod_image_url1 = $prod_image_url1;
					
			//		echo $prod_image_url1;
					
				//	exit;
					
					
				
		//	}
			
			
			
			
					
		
$result = $result . '
    <div class="col-md-3"><input  size="12" style="border: none; font-size: 13px;" type="text" value="'.substr(htmlspecialchars($title), 0, 25).'"><br><div class="chip"  data-toggle="tooltip" data-html="true" title="SKU:'.htmlspecialchars($sku).' Title: ' .htmlspecialchars($title). '" ondragstart="dragItqp(event, '.$qp_prodserv_uid.')" onclick="javascript: setupmaincatsel(\''.$title.'\')">
	
<table>
<tr>
<td>
  <img src="https://app.phoenixcrm.co.nz/images/productsthumb/'.$prod_image_url1.'" loading="lazy"  style="max-height: 55px; max-width: 55px; height: auto; width: auto;"  onerror="this.onerror=null; this.src=\'https://app.phoenixcrm.co.nz/crm/images/noimage.png\'" alt="no image" />
  </td>
  <td>
        <span style="font-size: 14px; class="chip-label">$'.$disp_price.' </span>

		</td>
		</tr>
		
		</table>


</div>';


$result = $result . '</div>';
		}	
		
		
		
		$result = $result . '</div>';
		
		$result = $result . ' <button type="button" onclick="javascript: clear_calc()" class="btn btn-default">Clear calculator</button> ';

echo $result;

			
			?>