Merhaba,

Bir çok müşterim diğer alt bayileri ile stok paylaşım vs. yapmak istediğini söyledi ufaktan bir yazılım yaptım şu anlık sadece stoğu ve özel fiyatı paylaşıyor.

Kurulum:

WHM kurulu FTP'nizde bir dosya açın içine yapıştırın yeterli.

Kullanım: $products 10 - 45 - 21 ile örnek verdiğimiz yerlere ürün id lerini karşılarına ise özel fiyatlarını girmeniz yeterli.

müşterilerinize verdiğiniz linkin sonuna ?type=json yazarsanız dönüşüm json ile olur.

<?php
header('Content-Type: text/html; charset=utf-8');

// AŞAĞI KISIMI DÜZENLEMEYİN
// DO NOT EDIT BELOW

// 10-45-21 ile başlayan alana ürün id'lerini girin, sağ tarafada bayi fiyatını girin
$products = array(
	10 => '350 TL',
	45 => '500 TL',
	21 => '110 TL',
	35 => '122 TL',
	85 => '235 TL',
	32 => '125 TL',
);
// ! AŞAĞI KISIMI DÜZENLEMEYİN
// ! DO NOT EDIT BELOW

require('configuration.php');
$mysqli = new mysqli($db_host, $db_username, $db_password, $db_name);
$mysqli->set_charset('utf8');
if ($mysqli->connect_error) {
	die('Connect Error (' . $mysqli->connect_errno . ') '. $mysqli->connect_error);
}

$type='';

if(count($products)>0){
	$ids = '';
	foreach($products AS $key => $val){
		$key = intval($key);
		$ids .= "id = '".$key."' OR ";
	}
	$ids = rtrim($ids,' OR ');
	$query = $mysqli->query("SELECT id,qty,name,description FROM tblproducts WHERE $ids");
	if(isset($_REQUEST["type"])){
		if($_REQUEST["type"] == 'json'){
			$type='json';
		}
	}
	$rowJson = array();
	if($type == ''){
		echo '<table>
		<thead>
			<tr>
				<th>ID</th>
				<th>QTY</th>
				<th>NAME</th>
				<th>DESC</th>
				<th>SPECIAL PRICE</th>
			</tr>
		</thead>
		<tbody>
		';
	}
	while($row=$query->fetch_assoc()){
		$row["price"] = $products[$row["id"]];
		if($type == 'json'){
			$rowJson[] = $row;
		}else if($type == ''){
			echo '
				<tr>
					<td>'.$row["id"].'</td>
					<td>'.$row["qty"].'</td>
					<td>'.$row["name"].'</td>
					<td>'.$row["description"].'</td>
					<td>'.$row["price"].'</td>
				</tr>
			';
		}
	}
	if($type == ''){
		echo '</tbody></table>';
		die();
	}
	if(count($rowJson) > 0){
		die(json_encode($rowJson));
	}
	
}