- Primary
- Success
- Danger
- Neutral
Blue Accent:
#3b82f6Used for prices, buttons, and primary actionsPowered by Mintlify
Auto-generate your docs
Understand your seller dashboard, statistics, and profile management features
perfil.html) is your command center on Mis Compras. It provides a comprehensive view of your account, products, and performance metrics all in one unified dashboard.
linear-gradient(135deg, #3b82f6, #1d4ed8)fa-user)function cerrarSesion() {
if (confirm("¿Cerrar sesión?")) {
localStorage.removeItem("id_usuario");
window.location.href = "index.html";
}
}
data.usuario.nombreDisplays your registered name on the platformdata.usuario.emailYour account email addressdata.usuario.fecha_registroDate when you created your accountdata.usuario.id_usuarioYour unique identifier (displayed as #123)document.addEventListener("DOMContentLoaded", async () => {
const id = localStorage.getItem("id_usuario");
if (!id) {
alert("Debes iniciar sesión para ver tu perfil.");
window.location.href = "index.html";
return;
}
try {
const resp = await fetch("php/obtener_usuario.php?id=" + id);
const data = await resp.json();
// Render user data in grid
const datosHTML = `
<div class="dato-item">
<span class="dato-label">Nombre completo</span>
<div class="dato-valor">${data.usuario.nombre}</div>
</div>
// ... more fields
`;
document.getElementById("datos-usuario").innerHTML = datosHTML;
} catch (error) {
// Display error message
}
});
<button id="btn-editar-perfil" class="btn-editar-perfil">
<i class="fas fa-pencil-alt"></i> Editar
</button>
.dato-item {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
transition: transform 0.2s ease;
}
.dato-item:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
fa-box) alongside the title.productos-lista {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
}
async function cargarMisProductos() {
const id = localStorage.getItem("id_usuario");
try {
const resp = await fetch("php/mis_productos.php?id=" + id);
const data = await resp.json();
if (!data.exito || data.productos.length === 0) {
// Show "no products" message
return;
}
// Update counter
document.getElementById("contador-productos").textContent =
`${data.productos.length} producto${data.productos.length !== 1 ? 's' : ''}`;
// Update statistics
document.getElementById("vistas-totales").textContent =
data.productos.reduce((sum, p) => sum + (p.vistas || 0), 0);
// Render product cards
// ...
} catch (error) {
// Handle errors
}
}
<button onclick="window.location.href='publicar_producto.html'" class="boton-publicar">
<i class="fas fa-plus"></i> Publicar nuevo producto
</button>
#3b82f6)#3b82f6)#3b82f6)#3b82f6)// Total Views
document.getElementById("vistas-totales").textContent =
data.productos.reduce((sum, p) => sum + (p.vistas || 0), 0);
// Total Sales
document.getElementById("ventas-realizadas").textContent =
data.productos.reduce((sum, p) => sum + (p.ventas || 0), 0);
// Seller Rating (placeholder in current implementation)
document.getElementById("calificacion").textContent = "0";
.estadistica-minimal {
background: white;
padding: 20px;
border-radius: 12px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
text-align: center;
}
#3b82f6Used for prices, buttons, and primary actions#059669Used for edit buttons and positive actions#ef4444Used for delete buttons and logout hover#1e293b#64748b#e2e8f0font-family: 'Inter', sans-serif;
.perfil-contenedor {
backdrop-filter: blur(5px);
background: rgba(255, 255, 255, 0.277);
border-radius: 20px;
padding: 40px;
margin: 40px auto;
max-width: 1000px;
}
body {
background:
linear-gradient(rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.25)),
url('imagenes/fondo3.jpg');
background-size: cover;
background-position: center;
background-attachment: fixed;
}
fondo3.jpg)@media (max-width: 768px) {
.perfil-header {
flex-direction: column;
align-items: flex-start;
gap: 20px;
}
.productos-lista {
grid-template-columns: 1fr;
}
.datos-grid {
grid-template-columns: 1fr;
}
.estadisticas {
grid-template-columns: 1fr;
}
.producto-acciones {
flex-direction: column;
gap: 10px;
}
}
if (!id) {
alert("Debes iniciar sesión para ver tu perfil.");
window.location.href = "index.html";
return;
}
catch (error) {
document.getElementById("datos-usuario").innerHTML = `
<div class="dato-item" style="grid-column: 1 / -1; text-align: center; color: #ef4444;">
<i class="fas fa-exclamation-circle"></i>
<div class="dato-valor">Error al cargar los datos</div>
</div>
`;
}
catch (error) {
cont.innerHTML = `
<div class="sin-productos" style="grid-column: 1 / -1; color: #ef4444;">
<i class="fas fa-exclamation-triangle"></i>
<p>Error al cargar los productos</p>
</div>
`;
}
Check Your Profile Regularly
Keep Information Current
Use Statistics to Optimize
Maintain a Professional Presence
vendedor.html).
Seller Information
fetch('php/obtener_vendedor.php?id=' + encodeURIComponent(id))
.then(r => r.json())
.then(data => {
const v = data.vendedor;
// Display: name, fecha_registro, rating, valoraciones
});
Can't Access Profile
localStorage.id_usuario existsProducts Not Displaying
Statistics Show Zero
Images Not Loading
imagenes/ directorydefault-product.svg is implemented