View Single Post
  #22  
Old 01-08-2009, 06:12 PM
  gb2world's Avatar 
gb2world gb2world is offline
 

X-Wizard
  
Join Date: May 2006
Location: Austin, TX
Posts: 1,970
 

Default Re: help with if then statment for detailed description

Hi Scott -

If I understand what you are trying to do correctly, maybe this will help.

In product.tpl, the variable $cat contains the categoryid of the current product, so you could do if-than statements based on the $cat variable.

If you do need the category order_by, you will need to add a query to the product.php file to get it. I think this should work if you add it after you see $cat defined:


Code:
$cat_order_by = func_query_first_cell("select order_by from $sql_tbl[categories] where categoryid = '$cat'"); $smarty->assign("cat_order_by",$cat_order_by);

Then, you can do if-than statements based on $cat_order_by

You can try printing the variables in product.tpl to make sure they are as expected:

PHP Code:
category: {$cat}<br />
parent: {$current_category.parentid}<br />
order_by: {$cat_order_by

I've not done this before - so hopefully you won't find any unintended consequences.

Also - using this tip helps show you what smarty variables are available so that you do not have to guess.
__________________
X-CART (4.1.9,12/4.2.2-3/4.3.1-2/4.4.1-5)-Gold
(CDSEO, Altered-Cart On Sale, BCSE Preorder Backorder, QuickOrder, X-Payments, BCSE DPM Module)
Reply With Quote