@@ -74,7 +75,15 @@ layout_header('Checkout', 'Checkout con QR, tarjeta, transferencia y comprobante
-
+
+
+
+ = payment_icons_html('mt-2') ?>
+
@@ -82,7 +91,7 @@ layout_header('Checkout', 'Checkout con QR, tarjeta, transferencia y comprobante
-
+
diff --git a/includes/store.php b/includes/store.php
index 8d122d4..344e8d2 100644
--- a/includes/store.php
+++ b/includes/store.php
@@ -75,6 +75,11 @@ function money(float $amount): string {
return '$' . number_format($amount, 2) . ' USD';
}
+function payment_icons_html(string $extraClass = ''): string {
+ $class = trim('payment-icons ' . $extraClass);
+ return 'VISAMastercard
';
+}
+
function ensure_orders_table(): void {
db()->exec("CREATE TABLE IF NOT EXISTS lb_orders (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
diff --git a/index.php b/index.php
index 5d3813a..50d03e8 100644
--- a/index.php
+++ b/index.php
@@ -10,8 +10,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && ($_POST['action'] ?? '') === 'add')
$product = get_product($id);
if ($product) {
$_SESSION['cart'][$id] = min((int)$product['stock'], (int)($_SESSION['cart'][$id] ?? 0) + $qty);
- $notice = $product['name'] . ' añadido al carrito.';
+ $next = (string)($_POST['next'] ?? 'cart');
+ if ($next === 'checkout') {
+ header('Location: checkout.php');
+ exit;
+ }
+ header('Location: cart.php?added=' . rawurlencode($id));
+ exit;
}
+ $notice = 'No pudimos agregar el producto. Inténtalo de nuevo.';
}
layout_header('Tienda virtual', 'LA BORGUITA: tienda virtual con catálogo, carrito, QR de pago y confirmación manual.');
@@ -33,7 +40,7 @@ $logoPath = store_logo_path();
-
 ?>)
LA BORGUITAPagos Visa · Mastercard · Transferencia
+
 ?>)
LA BORGUITAPagos Visa · Mastercard · Transferencia= payment_icons_html('compact') ?>
Espacio para QR de pagoSube aquí tu QR definitivo desde el editor cuando lo tengas listo.
Pedidos pendientesRevisión manual
@@ -59,12 +66,15 @@ $logoPath = store_logo_path();
= h($product['name']) ?>
= h($product['description']) ?>
= h(money((float)$product['price'])) ?>
-
@@ -78,7 +88,7 @@ $logoPath = store_logo_path();
QR reservadoBloque visual listo para colocar el código real.
-
Visa/MastercardMétodo visible para integrar pasarelas MX/US.
+
Visa/MastercardMétodo visible para integrar pasarelas MX/US.= payment_icons_html('mt-2') ?>
Admin apruebaLos comprobantes quedan pendientes hasta revisión.
diff --git a/product.php b/product.php
index 83a5dac..57d2ad3 100644
--- a/product.php
+++ b/product.php
@@ -7,7 +7,11 @@ if (!$product) { http_response_code(404); layout_header('Producto no encontrado'
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$qty = max(1, min((int)$product['stock'], (int)($_POST['qty'] ?? 1)));
$_SESSION['cart'][$product['id']] = min((int)$product['stock'], (int)($_SESSION['cart'][$product['id']] ?? 0) + $qty);
- header('Location: cart.php');
+ if (($_POST['next'] ?? 'cart') === 'checkout') {
+ header('Location: checkout.php');
+ exit;
+ }
+ header('Location: cart.php?added=' . rawurlencode((string)$product['id']));
exit;
}
layout_header($product['name'], $product['description']);
@@ -23,9 +27,10 @@ layout_header($product['name'], $product['description']);
= h($product['description']) ?>
= h(money((float)$product['price'])) ?>
Disponible en almacén: = (int)$product['stock'] ?> unidades
-