Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding a link to category from product listing

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 05-31-2006, 06:28 PM
  abeight's Avatar 
abeight abeight is offline
 

X-Adept
  
Join Date: Nov 2003
Location: Cleveland, OH
Posts: 479
 

Default 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!!
__________________
~ Andrea Beight
Reply With Quote
  #2  
Old 06-04-2006, 01:59 PM
 
furthermobile furthermobile is offline
 

Newbie
  
Join Date: May 2006
Posts: 4
 

Default Good idea

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

Jamie

xcartpro 4.1.1 [unix]
Reply With Quote
  #3  
Old 09-13-2006, 06:07 AM
  dalmuti's Avatar 
dalmuti dalmuti is offline
 

eXpert
  
Join Date: Oct 2004
Location: Kansas
Posts: 343
 

Default 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
__________________
Louise

Studio 57 Designs - X-Cart Customization
Providing X-Cart Services since 2004
Hottest Blog Directory - Submit Your Blog for a Free Listing
Reply With Quote
  #4  
Old 01-21-2010, 07:51 AM
 
presson83 presson83 is offline
 

Senior Member
  
Join Date: Sep 2008
Posts: 143
 

Default 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?!?!?
__________________
v 4.1.11, v 4.2
Reply With Quote
  #5  
Old 01-06-2011, 09:27 AM
 
rvcapital rvcapital is offline
 

Member
  
Join Date: Apr 2006
Posts: 12
 

Default 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!
__________________
X-Cart
Reply With Quote
  #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

The following user thanks qualiteam for this useful post:
gb2world (01-12-2011)
  #7  
Old 04-14-2011, 10:42 AM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default 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?
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
  #8  
Old 04-20-2011, 07:09 AM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default Re: Adding a link to category from product listing

Has anyone been able to show the category name on product.tpl in 4.4x?
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
  #9  
Old 04-21-2011, 04:17 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

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.
__________________
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
  #10  
Old 04-21-2011, 05:25 AM
  tqualizerman's Avatar 
tqualizerman tqualizerman is offline
 

X-Adept
  
Join Date: Jun 2008
Posts: 392
 

Default 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.
__________________
- www.nerdseven.com - Gadgets & Gizmos from Out of This World
- Sound Sensitive T-Shirts That Flash to the Beat of Music (http://www.tqualizer.com)


X-Cart Version 4.1.10
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 02:40 AM.

   

 
X-Cart forums © 2001-2020