CMXX - Catalog API
This commit is contained in:
21
products.php
21
products.php
@@ -41,6 +41,13 @@ $query_total = ioServer($api_url,'');
|
||||
//Decode Payload
|
||||
if (!empty($query_total)){$query_total = decode_payload($query_total);}else{$query_total = null;}
|
||||
|
||||
//CALL TO API
|
||||
$api_url = '/v2/media/';
|
||||
$media_responses = ioServer($api_url,'');
|
||||
|
||||
//Decode Payload
|
||||
if (!empty($media_responses)){$media_responses = json_decode($media_responses,true);}else{$media_responses = null;}
|
||||
|
||||
// Handle success messages
|
||||
if (isset($_GET['success_msg'])) {
|
||||
if ($_GET['success_msg'] == 1) {
|
||||
@@ -125,15 +132,23 @@ $view .= '
|
||||
}
|
||||
else {
|
||||
foreach ($responses as $response){
|
||||
$picture = glob('./assets/images/products/'.$response->productcode.'.{jpg,jpeg,png,gif}', GLOB_BRACE);
|
||||
|
||||
|
||||
//GET PATH OF ASSIGNED MEDIA
|
||||
$full_path = '';
|
||||
|
||||
foreach ($media_responses as $media){
|
||||
if($response->product_media == $media['rowID']){
|
||||
$full_path = $media['full_path'];
|
||||
}
|
||||
}
|
||||
|
||||
$view .= '
|
||||
<tr>
|
||||
<td>'.$response->productcode.'</td>
|
||||
<td>'.${'part_type'.$response->parttype}.'</td>
|
||||
<td>'.${'product_category'.$response->product_category}.'</td>
|
||||
<td class="responsive-hidden">
|
||||
'.(($picture)?'<img style="border-radius: 4px;height: 50px;" src="'.$picture[0].'" alt="">' : '').'
|
||||
'.(($full_path !='')?'<img style="border-radius: 4px;height: 50px;" src="'.$full_path.'" alt="">' : '').'
|
||||
</td>
|
||||
<td>'.(${$response->productname} ?? $response->productname).'</td>
|
||||
<td><a href="index.php?page=product&rowID='.$response->rowID.'" class="btn_link">'.$general_view .'</a></td>
|
||||
|
||||
Reference in New Issue
Block a user