Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/wreyesus/Sencillo_Carrito_de_Compras_en_PHP/llms.txt

Use this file to discover all available pages before exploring further.

YUME|TEC is designed as a self-contained learning example, and its simplicity makes customization straightforward. Because there is no framework, no ORM, and no build pipeline, most changes come down to three things: editing database content, swapping image files, and updating a handful of configuration constants scattered across a small number of PHP files. The sections below walk through each category of change.

Adding a new product

Products are stored in the productos table. Each row requires a category ID (id_cat), a name, a manufacturer, a price, an image filename, and a description. The descripcion field supports newline characters — the detail page renders them with nl2br().
INSERT INTO productos (id_cat, nombre, fabricante, precio, imagen, descripcion)
VALUES (1, 'Intel Core i7-12700K', 'Intel', 349.99, 'i7_12700k.jpg',
        'Modelo: Core i7-12700K\nFrecuencia: 3.6GHz (5.0GHz Boost)\n12 cores / 20 threads\nSocket LGA1700');
After inserting the row, place the product image in two locations:
  • imagenes/productos/i7_12700k.jpg — thumbnail displayed in the category listing at 200×200 px
  • imagenes/productos/detalle/i7_12700k.jpg — full-size image displayed on the detail page (detalles.php) at 200×200 px
Both filenames must exactly match the value in the imagen column. The listing and detail templates reference them with no additional path resolution.

Adding a new product category

1

Insert the category row

Add the new category to the categorias table. Note the auto-incremented id_cat value that MySQL assigns — you will need it in the next step.
INSERT INTO categorias (nombre, contiene)
VALUES ('tarjetas_graficas', 10);
-- Note the new id_cat value returned by LAST_INSERT_ID()
The contiene column is informational only. It does not enforce a product limit — the actual count displayed on the categories page is always computed live by the SQL query against the productos table.
2

Create the listing page

Duplicate one of the existing category files (for example, copy cat_procesadores.php to cat_tarjetas_graficas.php) and change the WHERE id_cat= value in the query to match your new category’s id_cat:
// Before (cat_procesadores.php)
$query_listado = "SELECT * FROM productos WHERE id_cat=1";

// After (cat_tarjetas_graficas.php)
$query_listado = "SELECT * FROM productos WHERE id_cat=4";
Also update the <title> tag and any heading text in the new file to reflect the category name.
3

Link the category from categorias.php

Add a category image to the img/ directory and add the corresponding link block inside categorias.php. Follow the same pattern used for the three existing categories:
<a href="cat_tarjetas_graficas.php">
  <img src="img/cat_tarjetas_graficas.jpg" alt="Tarjetas Gráficas" />
</a>

Replacing images

All store images are plain files — no thumbnailing, resizing pipeline, or CDN involvement. Replace any file in-place with an identically named replacement to update it site-wide.
PathRole
img/banner.jpgHero banner displayed on the homepage
img/logo.jpgStore logo shown in the page header
img/cat_procesadores.jpgCategory landing image for Processors (276×309 px)
img/cat_motherboards.jpgCategory landing image for Motherboards (276×309 px)
img/cat_rams.jpgCategory landing image for RAM (276×309 px)
imagenes/productos/{filename}.jpgCatalog thumbnail for a product (200×200 px in the listing)
imagenes/productos/detalle/{filename}.jpgFull-size product image on the detail page (rendered at 200×200 px)
To replace the hero banner, for example, export your new image as banner.jpg at the appropriate dimensions and drop it into img/, overwriting the existing file.

Changing the store name

The store is identified as YUME | TEC (with spaces around the pipe) in page <title> tags and the copyright footer, as YUME-TEC in some CSS class names, and as Yume|TEC in heading text within the sliding login panel. To rebrand the store, perform a find-and-replace across all .php files for each of the following strings:
  • YUME | TEC
  • YUME-TEC
  • Yume|TEC
Most editors and command-line tools (grep -r, sed -i) can handle a project-wide replacement in one pass. Remember to also update the footer copyright line:
<p>Copyright 2011 - YUME | TEC. Hecho por Jaime Lainez, Jeronimo Castaneda y Saul Guardado</p>

Updating PHPMailer settings

The store sends two types of email: a registration confirmation (from registro.php) and an order confirmation (from final.php). Both use the bundled PHPMailer library (class.phpmailer.php and class.smtp.php). See the Email Notifications page for the full list of PHPMailer properties to update — including SMTP host, port, credentials, sender address, and message body templates.

Updating PayPal settings

The checkout flow in final.php builds an HTML form with hidden fields that are posted directly to PayPal’s standard payment gateway. You must update those hidden field values to point to your own PayPal account and configure the correct return and cancel URLs. See the Checkout page for the complete list of PayPal hidden field values to update in final.php.

Enabling PHP 7+ compatibility

YUME|TEC was written for PHP 5 and uses the mysql_* extension family, which was removed entirely in PHP 7.0. To run the project on a modern server, every mysql_* call must be replaced with its mysqli_* equivalent.
1

Update the connection in Connections/tienda.php

Replace mysql_pconnect() with mysqli_connect(), passing the database name as the fourth argument:
// PHP 5 (original)
$tienda = mysql_pconnect($hostname_tienda, $username_tienda, $password_tienda);
mysql_select_db($database_tienda, $tienda);

// PHP 7+ (mysqli)
$tienda = mysqli_connect($hostname_tienda, $username_tienda, $password_tienda, $database_tienda);
2

Update every query call

Pass the connection handle as the first argument to mysqli_query():
// Before
$result = mysql_query($sql);

// After
$result = mysqli_query($tienda, $sql);
3

Update result-set functions

Replace each legacy function with its mysqli_* counterpart:
Legacy (mysql_*)Replacement (mysqli_*)
mysql_fetch_array($result)mysqli_fetch_array($result)
mysql_fetch_assoc($result)mysqli_fetch_assoc($result)
mysql_num_rows($result)mysqli_num_rows($result)
mysql_error()mysqli_error($tienda)
4

Update GetSQLValueString()

Replace the escaping call inside GetSQLValueString() to pass the connection handle:
// Before
$theValue = function_exists("mysql_real_escape_string")
    ? mysql_real_escape_string($theValue)
    : mysql_escape_string($theValue);

// After
global $tienda;
$theValue = mysqli_real_escape_string($tienda, $theValue);
Consider migrating to PDO with prepared statements instead of mysqli_*. PDO’s bindParam() / bindValue() interface eliminates the need for manual escaping entirely and also fixes the SQL injection vulnerabilities present in the login and registration queries, where user-supplied credentials are currently interpolated directly into query strings.

Build docs developers (and LLMs) love