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
  #11  
Old 01-08-2009, 09:25 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

Hi Vetrivel,

Thanks for the rsponse.
I am working on a site that sells pet items. On some of the pages the product needs to be ordered by size so the client has and embedded page on the site that shows how to measure the animal correctly in order to make sure that you order the correct size product.

I thought that if I put a button in the detailed description box and called it through the product.tpl I could then limit when the button appeared by using and if then statement so that the only time that the button appeared in the detailed description product box was when a relevant page was called .

It seems like it makes sense but the if then statement that I tried is not recognizing the variables for the category pages so the button appears on all the pages.
I tried to follow Jon's suggestion above but have not been able to figure out how to write the code to put in the product.php and assign it to smarty to see if this would work.

Understand ? Let me know. I think the problem is solvable but I am just a few steps away from it.

Would appreciate your thoughts

Best

Scott
4.1.2 gold
4.1.8 pro
Apache
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #12  
Old 01-08-2009, 11:52 AM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

I am still trying to figure this out If I understand you correctly Jon, you are saying to query the categories from the product.php and assign them to smarty.
I have tried a few things here the latest being

$smarty->assign('customer/category', 'category');
include ("customer/main/product.tpl");

which I thought would assign the category and include the product.tpl which would then display the button on the correct pages but I am obviously still not doing something correctly as this does not change the response to the page.

If anyone can tell me how to do this I would be really grateful.
Thanks

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

I can't figure out which pages you want the button to be displayed on?
__________________
xcart 5.1.2
Reply With Quote
  #14  
Old 01-08-2009, 02:21 PM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

Hi Ashley,

Thanks for the reply.
I am definitely over my head a bit here and not exactly sure of what I am doing
What I was hoping to do was call the product.tpl
and inside that I have placed this

{if $c.order_by}It exists: {$c.order_by}{else}No it doesn't exist{/if}
{if $c.order_by gt 4 and $c.order_by lt 41}{/if}
{include file="buttons/sizing_help.tpl"}

so that when the category pages with POS 4 thru 41 were called the button/sizing.tpl would be called and it would then display the button I have made.

If I understand Jon ( see above) reply to me I might be able to do this if I query the category variables in the product.php and assign to smarty.

The line
$smarty->assign('customer/category', 'category');
include ("customer/main/product.tpl");

is my latest failed attempt of things I have placed in the product.php page.

Hope you now understand what I am trying to do. I am not wed to this solution if you have a better one I am interested in that

Thanks again

Best

Scott V
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #15  
Old 01-08-2009, 02:27 PM
  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

I think the problem is that you need to pull the info from the database in the product.php file. I believe you will need to assign a variable to a SQL query. the assign that variable to smarty. Then the order_by info will be available for the product.tpl.
__________________
xcart 5.1.2
Reply With Quote
  #16  
Old 01-08-2009, 02:35 PM
  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

could you add this to product.php?

$order_by = func_query_hash("SELECT order_by FROM xcart_categories");

$smarty->assign("order_by", $order_by);


Im not sure if it's this simple? Im not much of a database guy.
__________________
xcart 5.1.2
Reply With Quote
  #17  
Old 01-08-2009, 02:38 PM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

A bit over my head but I think I follow you, and will try to figure that out.
Instead of what I have described above do you know if there is a way to call a duplicate product.tpl from the customer/home_main.tpl

( I think if I duplicated the product.tpl and called it something like
product_b.tpl and placed my button in there I would have 2 product.tpl files one with a button one without.)

I am not sure if this would be any easier to do, it might require doing the same as you have described above just to a different smarty variable.

Thanks again let me know what you think

Best

Scott V
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #18  
Old 01-08-2009, 02:47 PM
 
fotodog13 fotodog13 is offline
 

Senior Member
  
Join Date: Sep 2007
Posts: 126
 

Default Re: help with if then statment for detailed description

Hi Ashley,

Thanks for the attempt. It might be me but it does not seem to work. Unfortunately I am not much of a database person either
__________________
scott v
x cart version 4.1.8 (Unix)
Reply With Quote
  #19  
Old 01-08-2009, 02:51 PM
  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 hopefully someone can shed some light on this. I'd like to know how to do this.
__________________
xcart 5.1.2
Reply With Quote
  #20  
Old 01-08-2009, 03:09 PM
  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

{foreach from=$categories item=c}

I don't think $c is defined in product.tpl.

It is created in categories.tpl I believe.

in the product.tpl you may need to do something like:

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

that's if the SQL is correct. man I now have more questions than answers. not much help here.
__________________
xcart 5.1.2
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 01:31 PM.

   

 
X-Cart forums © 2001-2020