X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   common if/then modifications I make to x-cart... (https://forum.x-cart.com/showthread.php?t=8881)

deadzebrainc 04-09-2008 09:02 AM

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?

hooter 04-12-2008 10:16 PM

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

rkdiddy 04-13-2008 11:36 AM

Re: common if/then modifications I make to x-cart...
 
Thanks Hooter. You must have posted that right after I removed my post.

Thanks!

amadecs 05-30-2008 12:18 PM

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

balinor 05-30-2008 12:25 PM

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.

beetlejuice 06-28-2008 06:02 PM

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

HWT 06-29-2008 05:40 AM

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

beetlejuice 06-29-2008 02:46 PM

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

HWT 06-30-2008 04:53 AM

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.

benhoffman 07-10-2008 05:59 AM

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.


All times are GMT -8. The time now is 03:54 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.