You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.5 KiB
PHTML
57 lines
1.5 KiB
PHTML
6 months ago
|
<?php
|
||
|
|
||
|
require APPPATH . 'libraries/RestController.php';
|
||
|
|
||
|
use App\RestServer\RestController;
|
||
|
|
||
|
class StoreFrontAPIController extends RestController
|
||
|
{
|
||
|
public function __construct()
|
||
|
{
|
||
|
parent::__construct();
|
||
|
|
||
|
// Set timezone to Philippines
|
||
|
date_default_timezone_set('Asia/Manila');
|
||
|
}
|
||
|
|
||
|
public function index_get() {
|
||
|
// Fetch data logic here
|
||
|
$data = ['message' => 'GET request received'];
|
||
|
$this->response($data, 200);
|
||
|
}
|
||
|
|
||
|
public function itemModel_get($modelno) {
|
||
|
|
||
|
$this->load->model("Items");
|
||
|
$result = $this->Items->getItemInfoByModelNo('GE-4558');
|
||
|
|
||
|
// disabled during testing
|
||
|
//$result = $this->Items->getItemInfoByModelNo($modelno);
|
||
|
|
||
|
$itemcount = $result->num_rows();
|
||
|
|
||
|
if($itemcount > 0)
|
||
|
{
|
||
|
$row = $result->row();
|
||
|
|
||
|
$item = [
|
||
|
'itemcode' => $row->itemcode,
|
||
|
'modelno' => $row->modelno,
|
||
|
'item_desc' => $row->item_desc,
|
||
|
'srp' => $row->srp,
|
||
|
'catCode' => $row->catCode,
|
||
|
'goldID' => $row->goldID
|
||
|
];
|
||
|
|
||
|
$data = ['status' => 'FOUND',
|
||
|
'item_count' => $itemcount,
|
||
|
'data' => $item];
|
||
|
}
|
||
|
else
|
||
|
$data = ['status' => 'NOTFOUND',
|
||
|
'item_count' => 0,
|
||
|
'data' => null];
|
||
|
|
||
|
$this->response($data, 200);
|
||
|
}
|
||
|
}
|