<?php
include("src/Dealhot.php");
include("config.php");
$action = 'deal_record';
$rest_data = array(
 'productID' => $id
); 
$Dealhot = new Dealhot($auth_arr,$action,$rest_data);
$result_arr = $Dealhot->go();

if($result_arr["result"]=="fail"){
 $msg = 'You have failed to retrive a deal record. Reason: '.$result_arr["error"];
}
else{
  $title = $result_arr['title'];
  $deal_type = $result_arr['deal_type'];
  $keyinfo = $result_arr['keyinfo'];
  $start_date = $result_arr['start_date'];
  $end_date = $result_arr['end_date'];
  $des = $result_arr['des'];
  $wty = $result_arr['wty'];
  $price = $result_arr['price'];
  
  $price_other = $result_arr['price_other'];
  $ETA = $result_arr['ETA'];
  $ini_quantity = $result_arr['ini_quantity'];
  $qty_max = $result_arr['qty_max'];
  
  $submenu = '<a href="deal_edit.php?id='.$id.'">[text]</a> ';
  for($i=0;$i<4;$i++){
    if($result_arr["photo".$i])
      $submenu .= '<a href="deal_photo.php?id='.$result_arr["productID"].'&photo_index='.$i.'&pDate='.$result_arr["pDate"].'">[img'.($i+1).']</a> ';
    else
      $submenu .= '<a href="deal_photo.php?id='.$result_arr["productID"].'&photo_index='.$i.'&pDate='.$result_arr["pDate"].'">[+ img'.($i+1).']</a> ';
  }
  $submenu .= '<a target="_blank" href="'.$Dealhot->product_url($id).'">[preview]</a>';
}
?>