CMXX - Updated Products page

This commit is contained in:
“VeLiTi”
2025-02-04 12:59:28 +01:00
parent 68a16e5419
commit fa09268cd8
9 changed files with 375 additions and 237 deletions

View File

@@ -556,10 +556,12 @@ function freeShipment($price, $type){
$delivery_status = ($price >= free_shipment_price) ? $free_delivery : $non_free_delivery.currency_code.free_shipment_price.',-';
$style = ($delivery_status == $free_delivery) ? 'style="color:green;font-weight: bold;"' : 'style="color:gray;font-weight: lighter;"';
echo '
$shipment = '
<'.$type.' class="delivery">
<p '.$style.'> '.$delivery_status.'</p>
</'.$type.'>';
return $shipment;
}
function consent()
@@ -781,4 +783,72 @@ function debuglog($error){
$filelocation = './log/log_'.date('m').'.txt';
error_log($test, 3, $filelocation);
}
?>
//------------------------------------------
// Retrieve all $_GET from URL
//------------------------------------------
function urlGETdetails($input){
//GET Details from URL
if(isset($input) && !empty($input)){
$GET_VALUES = '';
foreach ($input as $KEY => $VALUE){
$GET_VALUES .= $KEY.'='.$VALUE;
$GET_VALUES .= '&';
}
return $GET_VALUES = rtrim($GET_VALUES, "&");
}
else {
return $GET_VALUES = '';
}
}
//------------------------------------------
// API TO API version 2
//------------------------------------------
function ioAPIv2($api_call, $data, $token){
$url = api_url.$api_call;
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//SEND BEARER CODE WHEN TOKEN PROVIDED
if ($token != ''){
$headers = array(
"Authorization: Bearer $token",
"Content-Type: application/json",
);
} else {
$headers = array(
"Content-Type: application/json",
);
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//IF DATA PROVIDED CONSIDER POST
if (!empty($data)){
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
$resp = curl_exec($curl);
$http_status = curl_getinfo($curl) ?? '200';
curl_close($curl);
//Check If errorcode is returned
if($http_status['http_code'] == '403' || $http_status['http_code'] == '400') {$resp = json_encode('NOK');}
if (debug){
$message = date('Y-m-d H:i:s').';'.$api_call;
debuglog($message);
}
//Response
return $resp;
}
?>