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

common if/then modifications I make to x-cart...

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #71  
Old 04-09-2008, 09:02 AM
  deadzebrainc's Avatar 
deadzebrainc deadzebrainc is offline
 

Advanced Member
  
Join Date: Apr 2008
Posts: 45
 

Default Re: common if/then modifications I make to x-cart...

Trying to do something (relatively?) simple, but I'm new to smarty so I need a bit of help.

I want to be able to change things in the category 1 products list (products.tpl) IF the product is also a member of a specific subcategory (3).


{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y" and $products[product].categoryid "3"}
*things to change would go here*
{/if}

Maybe I need to do an extra AND to include category 1, or is there a .subcategoryid variable? Not really sure what to do here Use an array and check the second ID?
__________________
DEAD ZEBRA, INC shop
X-cart 4.1.9
Reply With Quote
  #72  
Old 04-12-2008, 10:16 PM
 
hooter hooter is offline
 

X-Adept
  
Join Date: Dec 2004
Posts: 519
 

Default Re: common if/then modifications I make to x-cart...

@rkdiddy,

From the xcart instructions you quoted:
Quote:
1. add the following part of code to the end of your '<x-cart root directory>/auth.php' file:
You should be adding those codes to auth.php, not auth.tpl
__________________
Blog for X-Cart | Ebay Auction Manager
Reply With Quote
  #73  
Old 04-13-2008, 11:36 AM
  rkdiddy's Avatar 
rkdiddy rkdiddy is offline
 

Advanced Member
  
Join Date: Mar 2005
Posts: 60
 

Default Re: common if/then modifications I make to x-cart...

Thanks Hooter. You must have posted that right after I removed my post.

Thanks!
__________________
Stealth Cords - Discrete Power Cords for Automotive Enthusiasts
www.stealthcords.com
X-Cart version: 4.1.9
Reply With Quote
  #74  
Old 05-30-2008, 12:18 PM
 
amadecs amadecs is offline
 

Member
  
Join Date: Jan 2008
Posts: 20
 

Default Re: common if/then modifications I make to x-cart...

Quick question...

I know what these equal:

{if $main eq "catalog" and $current_category.category eq ""} = home page

{if $main eq "catalog" and $current_category.category ne ""} = any catalog page except the home page

Does anyone know what the code is for "Any product page?"

Thanks
__________________
X-Cart: Version 4.1.9
Apache: Version 1.3.39 (Unix)
PHP: Version 5.2.4
Reply With Quote
  #75  
Old 05-30-2008, 12:25 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: common if/then modifications I make to x-cart...

{if $main eq "product"}

Have a look at customer/home-main.tpl and common_templates.tpl - they have a lot of the $main values.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #76  
Old 06-28-2008, 06:02 PM
  beetlejuice's Avatar 
beetlejuice beetlejuice is offline
 

eXpert
  
Join Date: Apr 2007
Posts: 251
 

Default Re: common if/then modifications I make to x-cart...

I have one last task to do for a client and that is have different "Welcome" text depending whether customers are logged in or not.

I created a welcomenl.tpl (nl stands for not logged) and tried to call it in the home_main.tpl with:

{if $login ne ' ' }
{include file=customer/main/welcomenl.tpl}
{/if}

Doesn't work so I've tried to call a different text file based on the above

{if $login ne ' ' }
{inlcude file="$lng_txt_welcomenl}

that nada also.

Can anyone give me aheads up

Thanks
__________________
XCart 4.5.4, 4.6.1, 4.64 stores
Many, many mods from Altered Cart
XCart Mods Reboot template
The XCart Store Templates and Mods
WCM CDSEO Pro
BCSE Rewards Points and Gallery Mods
and a few others
Reply With Quote
  #77  
Old 06-29-2008, 05:40 AM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

Default Re: common if/then modifications I make to x-cart...

This is how I would handle it:
Code:
{if $login ne""} Whatever you want logged in customers to see. {else} Whatever you want not logged in visitors to see. {/if}

so in your case:
Code:
{if $login ne""} {include file=customer/main/welcome.tpl} {else} {include file=customer/main/welcomenl.tpl} {/if}

I believe it's simply the "" vs. the ' ' after the {if $login ne that's messing you up.

HTH
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #78  
Old 06-29-2008, 02:46 PM
  beetlejuice's Avatar 
beetlejuice beetlejuice is offline
 

eXpert
  
Join Date: Apr 2007
Posts: 251
 

Default Re: common if/then modifications I make to x-cart...

Thanks HWT,

you're on the money, I'm still not sure what the difference between "" & '' is to be honest.

Following your example I added the code to home_main.tpl and it initially made no difference probably due to this being active by default:

{elseif $main eq "catalog" and $current_category.category eq ""}
{include file="customer/main/welcome.tpl" f_products=$f_products}

So I added the code after the above, added the f_products etc to each, deleted {include file="customer/main/welcome.tpl" f_products=$f_products}

and wallah it works, thanks for the heads up again HWT.

Now can you tell me what the difference is between " " and ' '?

Thanks
__________________
XCart 4.5.4, 4.6.1, 4.64 stores
Many, many mods from Altered Cart
XCart Mods Reboot template
The XCart Store Templates and Mods
WCM CDSEO Pro
BCSE Rewards Points and Gallery Mods
and a few others
Reply With Quote
  #79  
Old 06-30-2008, 04:53 AM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

Default Re: common if/then modifications I make to x-cart...

I forgot that that part was in home_main.tpl. Sorry about that.

Have you tried replacing

Code:
{elseif $main eq "catalog" and $current_category.category eq ""} {include file="customer/main/welcome.tpl" f_products=$f_products}

with

Code:
{elseif $main eq "catalog" and $current_category.category eq "" and $login ne""} {include file="customer/main/welcome.tpl" f_products=$f_products} {elseif $main eq "catalog" and $current_category.category eq ""} {include file="customer/main/welcomenl.tpl" f_products=$f_products}

all I did was add in the condition of and $login ne"" to display one of the welcome messages, and left the condition out to display the other. Might work?

For those that might refer to this later, the welcome.tpl should be displayed to logged in users, and the welcomenl.tpl should be displayed to any site visitor who is not logged in.
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #80  
Old 07-10-2008, 05:59 AM
 
benhoffman benhoffman is offline
 

Member
  
Join Date: Jul 2006
Posts: 18
 

Default Re: common if/then modifications I make to x-cart...

Hey guys, what if I want to remove the header on ONLY one page? I tried something like {if $cat != 249} {include file="head_customer.tpl" } {/if} but it won't work. Maybe because it's in the customer/home.tpl?

Nevermind...I figured it out. I was able to add:

{if $main eq "product" and $cat eq "294"}
{else}
{include file="head_customer.tpl" }
{/if}

And now the header loads on all the pages except category 294.
__________________
x-cart 4.2.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 03:22 PM.

   

 
X-Cart forums © 2001-2020