plugin and theme sync
This commit is contained in:
@@ -106,9 +106,16 @@ if ($vehicle_id) {
|
||||
|
||||
if (!is_wp_error($similar_vehicles_response) && wp_remote_retrieve_response_code($similar_vehicles_response) === 200) {
|
||||
$similar_vehicles = json_decode(wp_remote_retrieve_body($similar_vehicles_response), true);
|
||||
$filtered_vehicles = array_filter($similar_vehicles, function ($vehicle) use ($vehicle_details) {
|
||||
return $vehicle['id_vehicle'] !== $vehicle_details['id_vehicle'];
|
||||
});
|
||||
if (is_array($similar_vehicles)) {
|
||||
$filtered_vehicles = array_filter($similar_vehicles, function ($vehicle) use ($vehicle_details) {
|
||||
return $vehicle['id_vehicle'] !== $vehicle_details['id_vehicle'];
|
||||
});
|
||||
} else {
|
||||
$filtered_vehicles = array_filter([], function ($vehicle) use ($vehicle_details) {
|
||||
return $vehicle['id_vehicle'] !== $vehicle_details['id_vehicle'];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// echo '<pre>';
|
||||
// print_r($filtered_vehicles);
|
||||
@@ -480,9 +487,29 @@ $image_description = !empty($vehicle_images[0]['description']) ? $vehicle_images
|
||||
|
||||
<?php
|
||||
get_footer();
|
||||
|
||||
|
||||
|
||||
// Extracting necessary details
|
||||
$importantDetails = array(
|
||||
'title' => $vehicle_details['year'] . ' ' . $vehicle_details['make'] . ' ' . $vehicle_details['model'] . ' ' . $vehicle_details['trim'] . ' - ' . $vehicle_details['exterior_color'] . ' ' . $vehicle_details['interior_color'],
|
||||
'id_vehicle' => $vehicle_details['id_vehicle'],
|
||||
'advertise_price'=> $vehicle_details['advertise_price']
|
||||
);
|
||||
|
||||
// Encoding important details as JSON
|
||||
$importantDetailsJSON = json_encode($importantDetails);
|
||||
?>
|
||||
|
||||
<script>
|
||||
// Assigning important details JSON to a JavaScript variable
|
||||
const appointmentVehicle = <?php echo $importantDetailsJSON; ?>;
|
||||
|
||||
// Creating a new object to merge with appointment form data
|
||||
const mergedDetails = {
|
||||
image_title: <?php echo json_encode($vehicle_images[0]['url']); ?>,
|
||||
...appointmentVehicle
|
||||
};
|
||||
// modal
|
||||
const handleFinanceChanges = (financeForm) => {
|
||||
if (document.querySelectorAll('.paymentSpan').length) {
|
||||
@@ -515,8 +542,8 @@ get_footer();
|
||||
};
|
||||
|
||||
const vehicleDetails = <?php echo json_encode($vehicle_details); ?>;
|
||||
const appointmentForm = new AppointmentForm();
|
||||
const financeForm = new FinanceForm(vehicleDetails, handleFinanceChanges);
|
||||
const appointmentForm = new AppointmentForm(mergedDetails);
|
||||
const financeForm = new FinanceForm(vehicleDetails, appointmentForm, handleFinanceChanges);
|
||||
const modal = new Modal(<?php echo $vehicle_id ?>);
|
||||
document.body.appendChild(modal.initModal());
|
||||
|
||||
@@ -586,7 +613,6 @@ get_footer();
|
||||
var queryString = window.location.search;
|
||||
var urlParams = new URLSearchParams(queryString);
|
||||
var filters = JSON.parse(decodeURIComponent(urlParams.get('filters')));
|
||||
console.log(filters);
|
||||
setFeatureImage(0);
|
||||
const accordionHeaders = document.querySelectorAll('[data-accordion-target]');
|
||||
accordionHeaders.forEach(header => {
|
||||
|
Reference in New Issue
Block a user