03/02/2012, 10:03
|
| | Fecha de Ingreso: febrero-2012
Mensajes: 6
Antigüedad: 12 años, 9 meses Puntos: 0 | |
Respuesta: Modificar plantilla de productos relacionados
Virtuemart 1.1.9
joomla 1.5.25
MVC no lo conozco.
Me defiendo en php (pero no tanto).
Por lo que he investidago dentro de joomla hay que modificar el ps_product.php (diria)
El archivo que llama al mostrar productos relacionados es el realtedProducts.tpl.php, y en el vemos que lo unico que hace es llamar a una funcion que se encuentra en el ps_product.php
Te pongo el codigo aqui:
Código:
/**
* display a snapshot of a product based on the product sku.
* This was written to provide a quick way to display a product inside of modules
*
* @param string $product_sku The SKU identifying the product
* @param boolean $show_price Show the product price?
* @param boolean $show_addtocart Show the add-to-cart link?
* @param boolean $show_product_name Show the product name?
*/
function show_snapshot($product_sku, $show_price=true, $show_addtocart=true, $show_product_name = true ) {
echo $this->product_snapshot( $product_sku, $show_price, $show_addtocart, $show_product_name );
}
/**
* Returns HTML code for a snapshot of a product based on the product sku.
* This was written to provide a quick way to display a product inside of modules
*
* @param string $product_sku The SKU identifying the product
* @param boolean $show_price Show the product price?
* @param boolean $show_addtocart Show the add-to-cart link?
* @param boolean $show_product_name Show the product name?
*/
function product_snapshot( $product_sku, $show_price=true, $show_addtocart=true, $show_product_name = true ) {
global $sess, $mm_action_url;
$db = new ps_DB;
require_once(CLASSPATH.'ps_product_category.php');
$ps_product_category = new ps_product_category;
$q = "SELECT product_id, product_name, product_first_image, product_parent_id, product_thumb_image FROM #__{vm}_product WHERE product_sku='$product_sku'";
$db->query( $q );
if ($db->next_record()) {
$product_id = $db->f("product_id" );
$tpl = new $GLOBALS['VM_THEMECLASS']();
$cid = $ps_product_category->get_cid( $product_id );
$tpl->set( 'product_id', $product_id);
$tpl->set( 'product_name', $db->f("product_name") );
$tpl->set( 'show_product_name', $show_product_name );
if ($db->f("product_parent_id")) {
$url = "?page=shop.product_details&category_id=$cid&flypage=".$this->get_flypage($db->f("product_parent_id"));
$url .= "&product_id=" . $db->f("product_parent_id");
} else {
$url = "?page=shop.product_details&category_id=$cid&flypage=".$this->get_flypage($db->f("product_id"));
$url .= "&product_id=" . $db->f("product_id");
}
$product_link = $sess->url($mm_action_url. "index.php" . $url);
$tpl->set( 'product_link', $product_link );
$tpl->set( 'product_thumb_image', $db->f("product_thumb_image"), "alt=\"".$db->f("product_name")."\"");
$tpl->set( 'product_first_image', $db->f("product_first_image"), "alt=\"".$db->f("product_name")."\"");
if (_SHOW_PRICES == '1' && $show_price) {
// Show price, but without "including X% tax"
$price = $this->show_price( $db->f("product_id"), true );
$tpl->set( 'price', $price );
}
if (USE_AS_CATALOGUE != 1 && $show_addtocart
&& isset( $GLOBALS['product_info'][$product_id]['price']['product_price_id'] ) // Product must have a price to add it to cart
&& !$this->product_has_attributes($product_id, true) // Parent Products and Products with attributes can't be added to cart this way
) {
$url = "?page=shop.cart&func=cartAdd&product_id=" . $db->f("product_id");
$addtocart_link = $sess->url($mm_action_url. "index.php" . $url);
$tpl->set( 'addtocart_link', $addtocart_link );
}
return $tpl->fetch( 'common/productsnapshot.tpl.php');
}
return '';
}
diria que esta parte hay que modificarla para poder mostrar la categoria |