X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Adding a link to category from product listing (https://forum.x-cart.com/showthread.php?t=22180)

abeight 05-31-2006 06:28 PM

Adding a link to category from product listing
 
One of my clients would like to have a link to a product's category in the product listing (customer/main/products_t.tpl). It would be similar to the featured products seen on this site: http://www.ncix.com/ - See how it says "More Processors" etc and links to the category? Does anyone know the smarty code to do this?

The cart version is 4.1.1

Thanks!!

furthermobile 06-04-2006 01:59 PM

Good idea
 
I would be interested in that too. Anyone have a suggestion?

Jamie

xcartpro 4.1.1 [unix]

dalmuti 09-13-2006 06:07 AM

Re: Adding a link to category from product listing
 
Anyone have an answer for this....what variable would be used to add the category name to the featured products or products listing for 4.1.x?

Thanks,

Louise

presson83 01-21-2010 07:51 AM

Re: Adding a link to category from product listing
 
Hi All,
I would like to do this same thing (get a hold of the category name / id and use it in my featured products listing). Does anyone know how to alter the product query to include the stinking category of the product in the product array?!?!?

rvcapital 01-06-2011 09:27 AM

Re: Adding a link to category from product listing
 
Also searching for this... A shitload of junk in the smarty variables, yet a simple category of the product nowhere to be found!

qualiteam 01-12-2011 12:04 AM

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 ***

tqualizerman 04-14-2011 10:42 AM

Re: Adding a link to category from product listing
 
This didn't work for me. :\

On my 4.1.10 build I was able to use the following: {$current_category.category} on product.tpl but on my 4.4 evaluation its not working.

I need to show the category link on the product page. Is there any way to do this?

tqualizerman 04-20-2011 07:09 AM

Re: Adding a link to category from product listing
 
Has anyone been able to show the category name on product.tpl in 4.4x?

qualiteam 04-21-2011 04:17 AM

Re: Adding a link to category from product listing
 
1. create a new Smarty modifier plugin -> "include/templater/plugins/modifier.getcatnamebyid.php" with the following content:
PHP Code:

<?php

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

function 
smarty_modifier_getcatnamebyid($categoryid) {  
        global 
$sql_tbl

        
x_load("category");

        
$category func_get_category_data($categoryid);

        return isset(
$category["category"]) ? $category["category"] : "";


?>


2. add something like this:
Code:

{$smarty.get.cat|getcatnamebyid}

into the "skin/common_files/customer/main/product.tpl" template.

tqualizerman 04-21-2011 05:25 AM

Re: Adding a link to category from product listing
 
Hi Alex,

Thanks for the idea. Unfortunately this solution doesn't seem to output anything though.


All times are GMT -8. The time now is 04:24 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.