diff --git a/public/property.html b/public/property.html
index 591919b..fb1acb7 100644
--- a/public/property.html
+++ b/public/property.html
@@ -1228,55 +1228,8 @@
Propiedades Similares
Otras opciones que podrían interesarte
-
@@ -1638,7 +1591,77 @@
const urlParams = new URLSearchParams(window.location.search);
const lang = urlParams.get('lang') || 'es';
switchLanguage(lang);
+
+ // Load similar properties
+ loadSimilarProperties();
});
+
+ // ============ SIMILAR PROPERTIES ============
+ async function loadSimilarProperties() {
+ const container = $('#similarPropertiesGrid');
+ const currentSlug = window.location.pathname.split('/').pop() || 'terreno-urbano-adeje';
+
+ try {
+ const response = await fetch('/api/properties?limit=3');
+ const result = await response.json();
+
+ if (!result.success || !result.data) {
+ container.html('No hay propiedades disponibles
');
+ return;
+ }
+
+ // Filter out current property and get first 3
+ const similarProps = result.data
+ .filter(p => p.slug !== currentSlug)
+ .slice(0, 3);
+
+ const typeLabels = {
+ urban: { es: 'Urbano', ru: 'Городской', class: 'urban' },
+ agricultural: { es: 'Agrícola', ru: 'Сельхоз', class: 'agricultural' },
+ house: { es: 'Casa', ru: 'Дом', class: 'house' },
+ apartment: { es: 'Apartamento', ru: 'Апартаменты', class: 'apartment' }
+ };
+
+ container.empty();
+
+ similarProps.forEach((property, index) => {
+ const typeInfo = typeLabels[property.type] || typeLabels.urban;
+ const typeLabel = typeInfo[currentLang];
+ const images = JSON.parse(property.images || '[]');
+ const mainImage = images[0] || 'https://images.unsplash.com/photo-1564013799919-ab600027ffc6?w=600&q=80';
+ const priceFormatted = new Intl.NumberFormat('es-ES').format(property.price);
+ const areaFormatted = new Intl.NumberFormat('es-ES').format(property.area);
+ const title = property[`title_${currentLang}`] || property.title_es;
+
+ const card = `
+
+ `;
+ container.append(card);
+ });
+ } catch (error) {
+ console.error('Error loading similar properties:', error);
+ container.html('Error al cargar propiedades
');
+ }
+ }