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
  #1  
Old 01-06-2009, 02:07 PM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default help with if then statment for detailed description

HI All,

I am trying to add an if then statement to a button I created that I have placed in the detailed description box.
I have the button working but I want to limit the pages that this button appears on.

This is what I have done.
I created a new .tpl called sizing_help.tpl that looks like this.

{if $c.order_by gt 4 and $c.order_by lt 41}
{/if}

<table cellspacing="0" cellpadding="0" onclick="javascript: self.location='http://1090495.nwinetworks.com/xcart/pages.php?pageid=1';" class="ButtonTable">
<tr><td><input type="image" src="{$ImagesDir}/but1.gif" class="ButtonSide_menu" alt="" /></td><td class="Button"><font class="Button">
Click Here For Help With Product Sizing</font>
</td><td><img src="{$ImagesDir}/but2.gif" class="ButtonSide_menu" alt="" /></td></tr></table>

I placed this in the buttons directory. The button works fine but I want to limit the pages that the button appears on so I thought the way to di that would be with a conditional statement -shown above in red- calling only the pages from 4 to 41

This did not work. The button still worked but it still appears on all the pages.

I have also tried

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


and placed this in the customer/main/product.tpl thinking perhaps that the conditional statment needed to be there, but with no luck. I removed the conditional statement from the buttons/sizing_help.tpl when I did this.

In theory I would think that this idea should work but now not sure if I am approaching the problem the right way. I am hoping that the conditional statment just needs to be corrected and that someone can look at it and tell me what I need to do to get the button just to appear on the select pages.

If there is a better way to do this I am not wed to this idea it just seemed like a good solution so I am open to other suggestions.

As always any help here is greatly appreciated from any and all that can reply.


Thanks in advance
Best

Scott V
fotodog13
4.1.2 gold
4.1.8 pro
Apache
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #2  
Old 01-06-2009, 04:30 PM
  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

Print this to the page to see if it the c.order_by variable holds a value (which I suspect it doesn't):

Code:
{if $c.order_by}It exists: {$c.order_by}{else}No it doesn't exist{/if}
Reply With Quote
  #3  
Old 01-07-2009, 04:03 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

Hi Jon,

Thanks for the reply. I pasted the code you provided above mine ( shown in red above) into the product.tpl. then checked the page. It returned the does not exsist message on the page so I would think that you are correct that the c variable is not being recognized.
Is there away to write the statement so that the variable is recognized here and allows for the button to appear only on the pertinent pages?

Thanks again I really appreciate the help
Best

Scott V
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #4  
Old 01-07-2009, 07:26 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

Can you provide a page url where you want this button to appear?
Reply With Quote
  #5  
Old 01-07-2009, 09:02 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

HI Jon,
Thanks for the reply.
Here is the url for the page where the button should appear.
http://1090495.nwinetworks.com/xcart/product.php?productid=33&cat=15&page=1

You can see the does not exist message is there.
* This page is on a closed test server. I think you should be ale to get on with the URL I have posted above but if it you get asked to log in let me know and I will private message you the password info
Thanks for looking at this
Scott
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #6  
Old 01-07-2009, 09:41 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

It's asking me to login, but by default you can't use category order_by variables on a product details page.
Reply With Quote
  #7  
Old 01-07-2009, 09:58 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

Hi Jon,

I thought that might be the problem. DO you know If I was to take the button out of the detailed description box and put it up near the breadcrumbs could I call the category pages from there?

That button does not necessarily need to be in the detailed description box but I only want the button to come up on pages where sizing information is something the user might need to access. Understand what I am saying.

Let me what you think

Thanks

Scott
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #8  
Old 01-07-2009, 10:14 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

No where on the page can you access the category variables, you can query them from product.php and assign to smarty.
Reply With Quote
  #9  
Old 01-07-2009, 11:57 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

Hi Jon,
Thanks again. I think I understand what you are saying but not sure how to write it. would it look like this?

$smarty->assign
{if $c.order_by gt 4 and $c.order_by lt 41}
{include file="buttons/sizing_help.tpl"}
{/if}
;
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #10  
Old 01-08-2009, 02:09 AM
  Vetrivel's Avatar 
Vetrivel Vetrivel is offline
 

eXpert
  
Join Date: Apr 2008
Posts: 398
 

Arrow Re: help with if then statment for detailed description

Hi scott ,


Can you explain the condition for the button to display in word.I understand that you want to display that button only to products in certain categories .Am i right if not pls give me your explanation as to based on what condition you want the button to be displayed
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:54 AM.

   

 
X-Cart forums © 2001-2020