CMXX - Shopping_cart + local fonts
This commit is contained in:
@@ -239,7 +239,9 @@ echo <<<EOT
|
||||
<link rel="icon" type="image/png" href="$icon_image">
|
||||
<link href="./style/admin.css" rel="stylesheet" type="text/css">
|
||||
<link rel="stylesheet" href="./style/leaflet.css" />
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v6.6.0/css/all.css">
|
||||
<link href="./assets/fontawesome/css/fontawesome.css" rel="stylesheet" />
|
||||
<link href="./assets/fontawesome/css/brands.css" rel="stylesheet" />
|
||||
<link href="./assets/fontawesome/css/solid.css" rel="stylesheet" />
|
||||
<script src="./assets/leaflet.js"></script>
|
||||
<script src="./assets/charts.js"></script>
|
||||
$veliti_analytics
|
||||
@@ -3034,4 +3036,54 @@ function processProductCollection($products) {
|
||||
}
|
||||
|
||||
return $processedProducts;
|
||||
}
|
||||
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
// CalculateTotalPrice based on options ++++++++++++++
|
||||
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
function calculateTotalPrice($product_data, $selected_options) {
|
||||
$base_price = floatval($product_data['price']);
|
||||
$total_price = $base_price;
|
||||
$selected_item_names = [];
|
||||
|
||||
foreach ($product_data['configurations'] as $config) {
|
||||
// Handle group configurations
|
||||
if (isset($config['attributes']) &&
|
||||
isset($selected_options[$config['assignment']])) {
|
||||
|
||||
$selected_group_attributes = $selected_options[$config['assignment']];
|
||||
|
||||
foreach ($selected_group_attributes as $selected_attribute_id) {
|
||||
foreach ($config['attributes'] as $attribute) {
|
||||
if ($attribute['attribute_id'] == $selected_attribute_id) {
|
||||
$total_price += $attribute['price_modifier'] == 1
|
||||
? floatval($attribute['price'])
|
||||
: -floatval($attribute['price']);
|
||||
|
||||
// Collect item names
|
||||
$selected_item_names[] = $attribute['item_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Handle additional products
|
||||
if (isset($selected_options['products']) &&
|
||||
$config['type'] == 'product' &&
|
||||
in_array($config['assignment'], $selected_options['products'])) {
|
||||
|
||||
/*/Include Pricing of optional products
|
||||
$total_price += $config['price_modifier'] == 1
|
||||
? floatval($config['price'])
|
||||
: -floatval($config['price']);
|
||||
*/
|
||||
// Collect product names
|
||||
$selected_item_names[] = $config['assignment_name'];
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'total_price' => $total_price,
|
||||
'selected_items' => implode(', ', $selected_item_names)
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user