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

$cat.category..........desc?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 09-03-2009, 10:36 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default $cat.category..........desc?

So I'm developing a dynamic section that loads all the categories from $categories

And it's going perfectly. It loads the link, it loads the category picture. And I've figured out a way to make it so that the description COULD load next to it and still remain dynamic and neat and pretty.

Der Problem

How do I load the description? I'm pretty sure there's a variable like the variable categoryid. Only I need categorydesc. I tried taking the code from main/subcategories.tpl ( {$current_category.description} )

But unfortunately it doesn't load

Der Info

This is the code I have so far and the example is here (scroll to the bottom)

Code:
<!-- Pulls the bot_cat class to make sure it stays within 900px --> <div class="bot_cat" align="left"> <!-- Creates an Array from $categories and classifies it as "cat" --> {foreach from=$categories item=cat} <!-- Pulls the bot_products class to make sure each item stays in 200px --> <!-- The link comes from here --> <a class="bot_products" href="home.php?cat={ $cat.categoryid }"> <!-- The image is pulled from here --> <img src="{$xcart_web_dir}/image.php?id={ $cat.categoryid }&amp;type=C" alt="" /> <!-- Ending statements --> </a> {/foreach} </div>

Class bot_cat is just to make sure it wraps at 900px
Class bot_products is the size 200px 12px margin for both sides
(completely irrelevant to the problem)

Der Request

I want the text to load to the right of the Category Images.

But I can't seem to load the descriptions... At all. Not even a little.

Does anyone know what variable string it might be? or another solution?

Also... Could I find this if I had DB access? (my boss isn't letting me have that access, but he might let me if I tell him I have to find it from there.)
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
  #2  
Old 09-03-2009, 10:57 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: $cat.category..........desc?

You probably have to edit php file responsible for writing the $category array and include description in the query. It just depends where you are doing this but take a look at function func_get_category_data($cat) in include/func/func.category.php
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
cowsdonthack (09-03-2009)
  #3  
Old 09-03-2009, 10:58 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Re: $cat.category..........desc?

Thanks for the lead! I'll take a look at this right away
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
  #4  
Old 09-03-2009, 11:18 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Re: $cat.category..........desc?

Der Find

So I went into *.*/include/func/func.category.php

Unfortunately, there is no func_get_category_data($cat)
However I did find func_get_category_parents down below

Code:
function func_get_category_parents($categoryid) { global $sql_tbl; if (!is_array($categoryid)) $categoryid = array($categoryid); $res = db_query("SELECT categoryid_path FROM $sql_tbl[categories] WHERE categoryid IN ('".implode("','", $categoryid)."')"); if (!$res) return false; $cats = array(); while ($c = db_fetch_row($res)) { $cats = array_unique(func_array_merge($cats, explode("/", array_pop($c)))); } db_free_result($res); return $cats; }

I created a Test Variable to try and find where in the Database they placed the Descriptions in hopes of finding it. I'm not sure if this will help, but I figured it points to the location of where the descriptions are.

Code:
INSERT INTO xcart_categories_lng VALUES ('US', 167, 'Door Closers', 'test 03'); INSERT INTO xcart_categories VALUES (167, 0, '167', 'Door Closers', 'test 03', '', 'Y', 347, 0, 3, 66, '');

Test 03 is where the information was placed.

---

Is there someway that I could develop the functionality for xcart to get the information from where the description would be, if I copied the code for where it gets categoryid, and point it to where test 03 currently is?
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
  #5  
Old 09-03-2009, 11:22 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: $cat.category..........desc?

Ok I just saw you are on 4.1 and this was for 4.2. Sorry. The fuction for 4.1 is in include/categories.php
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
cowsdonthack (09-04-2009)
  #6  
Old 09-03-2009, 11:26 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Re: $cat.category..........desc?

Wow, you really know where everything in xCart is. I found it and I'm looking for where I might find a variable for the description and if not, where it's getting categoryid so that I might be able to copy that functionality.

Any ideas on where to go from here while I'm searching?
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
  #7  
Old 09-03-2009, 11:32 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: $cat.category..........desc?

This query is in there

Code:
$to_search .= ",IF(($sql_tbl[categories_lng].category IS NOT NULL AND $sql_tbl[categories_lng].category != ''), $sql_tbl[categories_lng].category, $sql_tbl[categories].category) as category, IF(($sql_tbl[categories_lng].description IS NOT NULL AND $sql_tbl[categories_lng].description != ''), $sql_tbl[categories_lng].description, $sql_tbl[categories].description) as description, $sql_tbl[categories].category as category_name_orig";

The code is from 4.1.11 so don't just copy/paste
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
cowsdonthack (09-04-2009)
  #8  
Old 09-03-2009, 11:40 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Re: $cat.category..........desc?

Very cool

I found this code in include/categories.php although I'm not sure how to utilize it.

To me it seems what I want is $categories.description or $category.description

But unfortunately neither of those seem to work. Description seems to be the variable, since they seem to use categoryid similarly

I'm pretty lost
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
  #9  
Old 09-03-2009, 11:41 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: $cat.category..........desc?

try this...


if ($short_list === X_CATEGORIES_FOR_SELECT_BOX) { added description to 3
$to_search = "$sql_tbl[categories].description, $sql_tbl[categories].categoryid as cid, $sql_tbl[categories].categoryid, $sql_tbl[categories].parentid, $sql_tbl[categories].categoryid_path, $sql_tbl[categories].category";

} elseif ($short_list) {
$to_search = "$sql_tbl[categories].description, $sql_tbl[categories].categoryid as cid, $sql_tbl[categories].categoryid, $sql_tbl[categories].parentid, $sql_tbl[categories].categoryid_path, $sql_tbl[categories].category, $sql_tbl[categories].avail, $sql_tbl[categories].order_by";

} else {
$to_search = "$sql_tbl[categories].description, $sql_tbl[categories].categoryid as cid, $sql_tbl[categories].*";
}
__________________
xcart 5.1.2
Reply With Quote

The following user thanks ARW VISIONS for this useful post:
cowsdonthack (09-04-2009)
  #10  
Old 09-03-2009, 11:51 AM
  cowsdonthack's Avatar 
cowsdonthack cowsdonthack is offline
 

Advanced Member
  
Join Date: May 2009
Location: Out in the field. Chewin some grass
Posts: 89
 

Default Re: $cat.category..........desc?

Ummm... Where would I place that... -_-

(out for 40 minutes -_-)
Attached Files
File Type: php categories.php (16.2 KB, 75 views)
__________________
Moo?
Quality Door & Hardware

Version
X-Cart 4.1.108

Add-ons
X-AOM (Advanced Order Management)
Ad / Banner X-cart Mod (BCSE)
DSEFU
Dynamic Image Mod
Pre-login Shipping Calculator
Power Filter
Contact Us Form
Shipping Carrier Mod
Submit Button

Send me a message, I can talk about anything.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 12:38 AM.

   

 
X-Cart forums © 2001-2020