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)
-   -   $cat.category..........desc? (https://forum.x-cart.com/showthread.php?t=49520)

cflsystems 09-08-2009 06:14 AM

Re: $cat.category..........desc?
 
You are trying to list more then one category - currect_category is just what it says and applies to currect category you are in and is only one category. This {foreach from=$current_category item=cat} will list individual properties under currect category and nothing else. Not sure yet where are you trying all of this and what variable are available. Try this
{foreach from=$categories key=c item=i}
$i.category : $i.description
{/foreach}
but looking at your debug file attached here you still don't have description included in categories arrays. You need to edit php file and include it

cowsdonthack 09-08-2009 06:20 AM

Re: $cat.category..........desc?
 
1 Attachment(s)
Quote:

Originally Posted by cflsystems
You are trying to list more then one category - currect_category is just what it says and applies to currect category you are in and is only one category. This {foreach from=$current_category item=cat} will list individual properties under currect category and nothing else. Not sure yet where are you trying all of this and what variable are available. Try this
{foreach from=$categories key=c item=i}
$i.category : $i.description
{/foreach}
but looking at your debug file attached here you still don't have description included in categories arrays. You need to edit php file and include it


Oh sorry about that, it's on the home_list.tpl which loads up in the home page. Ashley has the code working on his website.

The debug file attached is when you go into the category which is where the variable was original taken from and is working. But it doesn't work in home_list.tpl

Very sorry about that confusion.

---
Update
---

I tried changing the code you mentioned. What php did you think I should edit and include.

When I changed the code I realized it was also pulling up another variable and displaying it. Which was Category.

So that's neat, it can display the ID and the Category as well. But not the description? How do we make the array begin from Current_Category?

cflsystems 09-08-2009 06:28 AM

Re: $cat.category..........desc?
 
This is part of the debug window
Code:

{$categories} Array (14)
155 => Array (11)
  parentid => "0"
  categoryid_path => "155"
  category => "Access Control Hardware"
  avail => "Y"
  order_by => "0"
  subcategory_count => "4"
  product_count => "59"
  is_icon => "Y"
  image_path => "./images/C/01.gif"
  categoryid => 155
  icon_url => "http://www.qualitydoor.com/images/C/0..."
9 => Array (11)
  parentid => "0"
  categoryid_path => "9"
  category => "Bathroom Accessories"
  avail => "Y"
  order_by => "0"
  subcategory_count => "16"
  product_count => "173"
  is_icon => "Y"

as you can see there is no description in categories arrays. Edit php file as posted earlier so you can get the descr to show in arrays, then you will be able to access it
I assume you are trying to get this code to work
Code:

<div class="bot_cat" align="left">
{foreach from=$categories item=cat}
<a class="bot_products" href="home.php?cat={ $cat.categoryid }"><img src="{$xcart_web_dir}/image.php?id={ $cat.categoryid }&amp;type=C" alt="" />{ $cat.categoryid }
</a>{/foreach}
</div>

after you edit the php file and have descr in cat arrays they yes it will be {$cat.description} inside that code

cowsdonthack 09-08-2009 06:34 AM

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

Originally Posted by cflsystems
This is part of the debug window
Code:

{$categories} Array (14)
155 => Array (11)
  parentid => "0"
  categoryid_path => "155"
  category => "Access Control Hardware"
  avail => "Y"
  order_by => "0"
  subcategory_count => "4"
  product_count => "59"
  is_icon => "Y"
  image_path => "./images/C/01.gif"
  categoryid => 155
  icon_url => "http://www.qualitydoor.com/images/C/0..."
9 => Array (11)
  parentid => "0"
  categoryid_path => "9"
  category => "Bathroom Accessories"
  avail => "Y"
  order_by => "0"
  subcategory_count => "16"
  product_count => "173"
  is_icon => "Y"

as you can see there is no description in categories arrays. Edit php file as posted earlier so you can get the descr to show in arrays, then you will be able to access it
I assume you are trying to get this code to work
Code:

<div class="bot_cat" align="left">
{foreach from=$categories item=cat}
<a class="bot_products" href="home.php?cat={ $cat.categoryid }"><img src="{$xcart_web_dir}/image.php?id={ $cat.categoryid }&amp;type=C" alt="" />{ $cat.categoryid }
</a>{/foreach}
</div>

after you edit the php file and have descr in cat arrays they yes it will be {$cat.description} inside that code


Thank you so much for bringing that up, I didn't even know that the webmaster mode was giving me ALL the variables for each thing, that's very helpful

But when you mean editing the PHP file did you mean -->
func.category.php
categories.php
or the index or home_list?

cflsystems 09-08-2009 06:39 AM

Re: $cat.category..........desc?
 
See earlier posts. categories.php probably but just read through the thread

cowsdonthack 09-08-2009 06:52 AM

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

Originally Posted by Ashley
this worked. {$cat.description}

http://www.arwvisions.com/test2/xcart/


Hey, Ashley, if there's no problem with it, could you attach your categories.php to me? I'm going to compare it to the one that I have. And since I know the one you have is working, it would really help.

cowsdonthack 09-08-2009 08:44 AM

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

Originally Posted by cflsystems
See earlier posts. categories.php probably but just read through the thread


DER SUCCESS!

THANK YOU CFL and Ashley! Yeah, so I went into the categories.php I don't know if this was modified but you were absolutely right. I cross referenced with what Ashley said, and figured that it had nothing to do with the home_list page.

These were the exact lines that needed to be changed.

Code:

    if ($short_list) {
        $to_search = "$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].*";
    }


with

Code:

    if ($short_list) {
        $to_search = "$sql_tbl[categories].categoryid,$sql_tbl[categories].parentid,$sql_tbl[categories].categoryid_path,$sql_tbl[categories].category,$sql_tbl[categories].description,$sql_tbl[categories].avail,$sql_tbl[categories].order_by";
    } else {
        $to_search = "$sql_tbl[categories].*";
    }


I'm sorry if I wasn't listening clearly in the beginning.

Thank you once again guys!

ARW VISIONS 09-08-2009 08:57 AM

Re: $cat.category..........desc?
 
DERRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR!!!!! glad you got it!!

cowsdonthack 09-08-2009 09:15 AM

Re: $cat.category..........desc?
 
derrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrr

cflsystems 09-08-2009 10:09 AM

Re: $cat.category..........desc?
 
Keep on reading, you will get a lot more :)


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

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