View Single Post
  #6  
Old 01-12-2011, 12:04 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Adding a link to category from product listing

Here is a quick mod for this:

1. create a new Smarty modifier plugin -> "include/templater/plugins/modifier.getproductmaincat.php" with the following content:

PHP Code:
<?php

if (!defined('XCART_START')) { header("Location: ../../../"); die("Access denied"); }

function 
smarty_modifier_getproductmaincat($productid) {
        global 
$sql_tbl;

        return 
func_query_first_cell("SELECT categoryid FROM $sql_tbl[products_categories] WHERE productid='$productid' AND main='Y'");
}

?>

2. add something like this:
Code:
<a href="home.php?cat={$products[product].productid|getproductmaincat}">{$lng.lbl_more}</a>

anywhere inside main section loop in the "skin1/customer/main/products_t.tpl" template.

e.g. right before this code -> {*** Uncomment it if you need 'Buy Now' button ***
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote