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

help with if then statment for detailed description

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #31  
Old 01-10-2009, 11:05 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

HI GB

Thanks for the reply

I believe I am using the POS#'s from the category section I made in the ADMIN section.
I tried both

$cat_order_by variable instead of the $c.order_by variable
and get the same results.
( I just PM you a link to the page I am trying to add the button to- it is on a test server so you may need to log in to get to the page )

In the mean time this is what I currently have in the product.php

$main = "product";
$smarty->assign("main",$main);

$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);

and to the product.tpl

<td valign="top" width="100%">
<span>{if $product.fulldescr ne ""}{$product.fulldescr}{else}{$product.descr}{ /if}</span>

{if $cat.order_by gt 4 and $cat.order_by lt 41}
{include file="buttons/sizing_help.tpl"}{/if}

As I look at this now I am wondering of this is not working because the statement I have written is not correct ( incomplete)

THanks to all for the help
Best

Scott V




__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #32  
Old 01-10-2009, 11:16 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: help with if then statment for detailed description

Adapting previous code slightly, here's how I would do do it.

In product.php

FIND:

$smarty->assign("product",$product_info);

BEFORE add:

Code:
$product_info['cat_order_by'] = func_query_first_cell("select order_by from $sql_tbl[categories] where categoryid = '" . (intval($cat) > 0 ? $cat : intval($product_info['categoryid'])) . "'");

In product.tpl

Code:
{if $product.cat_order_by gt 4 and $product.cat_order_by lt 41} {include file="buttons/sizing_help.tpl"} {/if}
Reply With Quote
  #33  
Old 01-10-2009, 11:49 AM
  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 you are using the code that I posted - then the if/than statement you posted is wrong - I did not put the order_by into an array called cat - so instead of

{if $cat.order_by gt 4 and $cat.order_by lt 41}

use

{if $cat_order_by gt 4 and $cat_order_by lt 41}

If it still does not work - try Jon's code. It should work as well.

If you still have issues - post again - and I can offer more suggestions for how to debug - by checking the smarty variables.


__________________
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
  #34  
Old 01-11-2009, 07:53 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

gb2. Ashley, Jon, Vetrivel, and any others that I have missed here,

Thanks much for all the help you have given me here. I finally go this to work, and it seems to be perfect. The cat pages are calling perfectly and the button I made only appears on the pages that I have indicated by POS in the if then statement.

There is no way I would have ever been able to figure this out myself with out the help of you guys. Once again these forums have been my godsend.

Many , many thanks again to all you. I really appreciate your help. As I think there are others here that may benefit from this I am going to post the code for how to add a button and call your category pages in the product.tpl to the mod section, with hopes that this helps someone else.

Best

Scott V
aka
fotodog13
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #35  
Old 01-11-2009, 07:59 AM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Default Re: help with if then statment for detailed description

Quote:
Originally Posted by fotodog13
gb2. Ashley, Jon, Vetrivel, and any others that I have missed here,

Thanks much for all the help you have given me here. I finally go this to work, and it seems to be perfect. The cat pages are calling perfectly and the button I made only appears on the pages that I have indicated by POS in the if then statement.

There is no way I would have ever been able to figure this out myself with out the help of you guys. Once again these forums have been my godsend.

Many , many thanks again to all you. I really appreciate your help. As I think there are others here that may benefit from this I am going to post the code for how to add a button and call your category pages in the product.tpl to the mod section, with hopes that this helps someone else.

Best

Scott V
aka
fotodog13
Reply With Quote
  #36  
Old 01-11-2009, 08:01 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: help with if then statment for detailed description

well I really didn't help much just did some learning. would you post the final solution please? Interested to see what worked.
__________________
xcart 5.1.2
Reply With Quote
  #37  
Old 01-11-2009, 09:05 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

HI Ashley,

Don't kid yourself you were a big help to me.
I just pasted the code and solution in the completed mods section.
"how to add a button to the detailed description box"

I am using this for a site that sells dog accessories. One of the things they sell are dog coats. The owner has a lot of returns due to measuring the dog incorrectly.
To solve this problem they made an embedded page and that tells how to measure their dog to get the correct fit.
The previous person working on this site then added a button that appeared on every page of the site . Whether you were buying a dog toy, or t shirt the button appeared that took you to the how to measure your dog for the dog coat page.
Obviously this was not a good solution because if someone was buying something other than a dog coat there was really no need for the button to be there.
Adding this page lets the button appear only on the pages that have been assigned by the POS set in the category admin section.
I know I could of added a link to each particular page manually but that would be a pain in the but. I also saw scripts that allowed something like this to happen through the use of a pop up but was not sure that was a good solution here. ( then I would have to ask the potential customer to enable pop ups which they may or may not know how to do)
Anyway this works like a charm.
This site is under construction on a private ( closed ) server right now. If you want to see how it works I can PM you a link with a user name and password to see it

Hope you find this useful too.

Best

Scott V
aka
fotodog13
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #38  
Old 01-11-2009, 11:08 AM
  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

Glad it worked for you, Scott. I looked at the page and it is a good improvement over the current site. It was also thoughtful of you to post it as a completed mod to save others time from wading through our discussions!
__________________
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
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 03:35 PM.

   

 
X-Cart forums © 2001-2020