How osvaldo-ojeda/ecommerce works
Project type and purpose
• This is a monolithic, full-stack PHP/MySQL ecommerce application.
• Users browse products, add to a cart, log in/out, and administrators manage categories, products, and users via CRUD pages.
File structure
• Top-level PHP scripts (index.php, carrito.php, producto.php, admin*.php, login.php, logout.php) act as controllers/entry points.
• class/ holds model classes: Categoria.php, Producto.php, Usuario.php, and the database connector Conexion.php.
• config/ contains global configuration (config.php) and webserver rules (.htaccess).
• db/ holds the SQL schema/data dump (deBuenaMadera.sql).
• includes/ has reusable view fragments: header.html, nav.php, footer.php, paginador.php.
• css/ and js/ hold static assets (style.css, sweetalert2.js).
• images/ stores product images.
• CRUD form scripts (formAgregar*.php, formModificar*.php, formEliminar*.php) separate views from action scripts (agregar*, modificar*, eliminar*).
README for additional insights
• README confirms PHP, SQL, HTML5, and CSS3 stack.
a. Main components
• Users (Browsers/Mobile)
• Web Server (Apache/Nginx + PHP interpreter)
• Presentation Layer (HTML/CSS/JS + includes/)
• Application Layer (Controller scripts + business logic in class/)
• Data Access Layer (Conexion.php + SQL queries in model classes)
• Database (MySQL)
• Static Asset Storage (css/, js/, images/)
b. Relationships & interactions
• User → HTTP request → Web Server
• Web Server routes to PHP controllers (index.php, producto.php, carrito.php, admin*.php, login.php)
• Controllers invoke model classes via Conexion.php to read/write MySQL
• Controllers render views by including header, nav, content templates, and footer
• Static assets served directly (CSS, JS, images)
• Admin controllers perform CRUD via form scripts and redirect or render success/failure via SweetAlert2
c. Architectural patterns & principles
• Separation of concerns:
– Presentation (includes/, css/, js/)
– Controllers (standalone entry-point scripts)
– Models/Data (class/)
• Centralized configuration (config/config.php)
• Single-entry forms for each CRUD operation
• Use of PSR-style autoload or manual includes (if implemented)
d. Key technologies
• PHP 7.x/8.x
• MySQL
• Apache/Nginx with .htaccess
• HTML5, CSS3, SweetAlert2 (client feedback)
• Vanilla JS for dynamic alerts
Detail and capturing essentials
• CRUD boundary is shown (forms → action scripts → model calls).
• Config/config.php as a shared dependency for all controllers.
• Includes/ as reusable view fragments loaded by controllers.
• MySQL schema (deBuenaMadera.sql) and the major tables (categorias, productos, usuarios, carrito).