CMXX - Catalog API

This commit is contained in:
“VeLiTi”
2025-01-30 09:28:50 +01:00
parent 661783270a
commit a669b2fadf
19 changed files with 579 additions and 118 deletions

View File

@@ -42,6 +42,14 @@ $responses = ioServer($api_url,'');
if (!empty($responses)){$responses = decode_payload($responses);}else{$responses = null;}
$responses = $responses[0];
//CALL TO API FOR RELATED
$api_url = '/v2/media/rowID='.$responses->product_media;
$media_responses = ioServer($api_url,'');
//Decode Payload
if (!empty($media_responses)){$media_responses = json_decode($media_responses,true);}else{$media_responses = null;}
$media_responses = $media_responses[0];
//CALL TO API FOR Product_versions
$api_url = '/v1/products_versions/productrowid='.$_GET['rowID'];
$product_versions = ioServer($api_url,'');
@@ -61,7 +69,7 @@ $products_configurations = ioServer($api_url,'');
if (!empty($products_configurations)){$products_configurations = json_decode($products_configurations,true);}else{$products_configurations = null;}
//------------------------------
//Variables
// Variables
//------------------------------
$status_text = 'prod_status_'.$responses->status ?? '';
$product_category_text = 'product_category'.$responses->product_category ?? '';
@@ -130,6 +138,10 @@ $view .= ' <div class="content-block order-details">
<div class="order-detail">
<h3>'.$product_name.'</h3>
<p>'.(${$responses->productname} ?? $responses->productname).'</p>
</div>
<div class="order-detail">
<h3>'.($product_slug ?? 'Product_slug').'</h3>
<p>'.(${$responses->url_slug} ?? $responses->url_slug).'</p>
</div>';
$view .='
@@ -140,11 +152,10 @@ $view .='<div class="content-block order-details">
<div class="block-header">
<i class="fa-solid fa-user fa-sm"></i>
</div>';
$picture = glob("./assets/images/products/".$responses->productcode.".{jpg,jpeg,png,gif}", GLOB_BRACE);
if (!empty($picture)){
if (!empty($media_responses['full_path'])){
$view .='
<div class="order-detail">
<img style="border-radius: 4px;height: 200px;margin: auto;" src="'.$picture[0].'" alt="">
<img style="border-radius: 4px;height: 200px;margin: auto;" src="'.$media_responses['full_path'].'" alt="">
</div>
';
}
@@ -175,6 +186,8 @@ if ($responses->configurable == 1){
<thead>
<tr>
<th>'.($product_configuration_version ?? 'Config-version').'</th>
<th>'.($product_configuration_assignment ?? 'Code').'</th>
<th>'.($product_configuration_assignment ?? 'Name').'</th>
<th>'.$general_actions.'</th>
</tr>
</thead>
@@ -182,8 +195,10 @@ if ($responses->configurable == 1){
foreach ($products_configurations as $product_config){
$view .= '<tr>
<td></td>
<td></td>
<td>'.$product_config['version'].'</td>
<td>'.$product_config['assignment'].'</td>
<td>'.(${$product_config['assignment_name']} ?? $product_config['assignment_name']).'</td>
<td><a href="index.php?page=products_configurations&productrowid='.$_GET['rowID'].'&rowID='.$product_config['rowID'].'" class="btn_link">'.$general_view.'</a></td>
</tr>';
}
$view .= '