> For the complete documentation index, see [llms.txt](https://ventaspop.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ventaspop.gitbook.io/docs/catalogo/catalog-product.php.md).

# catalog/product.php

## Detalle de producto

Este template muestra el detalle de un producto

| Objetos disponibles | Descripción                         |
| ------------------- | ----------------------------------- |
| $\_category         | Categoría activa.                   |
| $\_product          | Producto activo.                    |
| $\_campaign         | Campaña activa.                     |
| $\_parentCategory   | Categoría padre.                    |
| $\_stock            | Stock del producto.                 |
| $\_attribute        | Atributos del producto.             |
| $\_related          | Productos relacionados.             |
| $\_totalRelated     | Cantidad de productos relacionados. |
| $\_available        | Producto disponible (bool).         |
| $\_sizechartLarge   | Guía de tallas (desktop).           |
| $\_sizechartSmall   | Guía de tallas (móviles).           |
| $\_kit              | Kit asociado.                       |
| $\_providerId       | Id de proveedor.                    |
| $\_provider         | Proveedor del producto.             |

{% hint style="info" %}
Esta es una de las vistas más importantes de tu tienda
{% endhint %}

#### Código de ejemplo

```php
<?=$_product->breadcrumb()?>
<div id="product" class="clearfix" itemscope itemtype="http://schema.org/Product">
	
	<div class="clearfix">
	
		<div id="photos">
			<a href="<?=$_front->resize($_product->image()->get('image'), 500)?>" class="fancyboxMain"><img src="<?=$_front->thumb($_product->image()->get('image'), 600, 600)?>" alt="<?=$_product->get('name')?>" data-zoom-image="<?=$_front->resize($_product->image()->get('image'), 500)?>" class="zoom"></a>
			
			<ul>
				<?php foreach($_product->get('images') as $img): ?>
				<li><a href="<?=$_front->resize($img->get('image'), 500)?>" class="fancybox" rel="gallery"><img src="<?=$_front->thumb($img->get('image'), 150, 150)?>" alt="<?=$_product->get('name')?>" width="150"></a></li>
				<?php endforeach; ?>
			</ul>
			
		</div>
	
		<div id="info">
			
			<form action="<?=$_product->getURL()?>" method="post" id="buy" data-name="<?=$_product->get('name')?>" data-manufacturer="<?=$_product->get('manufacturers.name')?>" data-category="<?=$_product->category()->get('name')?>">
				
				<h1 itemprop="name"><?=$_product->get('name')?></h1>
				
				<?php if($_product->get('buyNow')): ?>
				<p class="price" itemprop="offers" itemscope itemtype="http://schema.org/Offer"><?=$_front->price($_product->price())?></p>
				
				<div class="attributes">				
				
					<?php while($_attribute->getNext()): ?>
					<label>
						<?=$_attribute->get('name')?>
						<select name="attributes[<?=$_attribute->get('id')?>]" class="attribute" data-id="<?=$_attribute->get('id')?>">
							<?php foreach($_product->getAttributeValues($_attribute->get('id')) as $value): ?>
							<option value="<?=$value?>"><?=$value?></option>
							<?php endforeach; ?>
						</select>
					</label>
					<?php endwhile; ?>
					
					<?php if($_available > 0): ?>
					<div id="stockOk">
						
						<label id="quantity_label">
							Cantidad:
							<input id="product_buy_quantity" name="quantity" type="text" size="2" value="1" />
						</label>
						
					</div>
					<?php endif; ?>
					
				</div>
		
				<div id="stockError" <?=($_available ? 'style="display:none"' : '')?>>		
					<p>No disponible.</p>
				</div>
				
				<?php if($_available > 0): ?>
				<button name="buy" id="add_to_cart" class="button">Comprar</button>
				<?php endif; ?>				
				
				<input type="hidden" name="productId" id="productId" value="<?=$_product->get('id')?>" />

				<?php else: ?>
				
				<a href="<?=HOST?>contacto?productId=<?=$_product->get('id')?>" class="button">Consultar</a>
				
				<?php endif; ?>
		
			</form>
			
		</div>
	
	</div>
		
	<div class="tabs">
		
		<div class="tab">	
			<h2>Descripción</h2>
			<p itemprop="description"><?=nl2br($_product->get('description'))?></p>
		</div>
	
		<?php if(strip_tags($_shop->get('delivery')) != ''): ?>
		<div class="tab">	
			<h2>Tiempos de entrega</h2>
			<?=$_shop->get('delivery')?>			
		</div>
		<?php endif; ?>
	
		<?php if(strip_tags($_shop->get('warranty')) != ''): ?>
		<div class="tab">	
			<h2>Garantías y devoluciones</h2>
			<?=$_shop->get('warranty')?>			
		</div>
		<?php endif; ?>
		
	</div>
	
	<?php if($_totalRelated): ?>
	<h2>Productos relacionados</h2>
	<ul class="listado">
		<?php
			while($_related->getNext()) {
				$_product = $_related;
				require __DIR__.'/../inc/product.php';
			}
		?>
	</ul>	
	<?php endif; ?>
		
</div>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ventaspop.gitbook.io/docs/catalogo/catalog-product.php.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
