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)

instinctual 08-12-2004 09:33 AM

common if/then modifications I make to x-cart...
 
Hi all, thought I'd post a short list of if/then modifications I usually make to x-cart out of the box just so others can benefit from it as well...

-------------------------------------------------

1. In skin1/ either rectangle_top.tpl or head.tpl, depending on where you put your store's "header" html code, I usually put this: {if $usertype eq "C"} at the very beginning of my html code. I then put the corresponding {/if} at the end of my "header" html code, right after the last line. What does this do? It takes away your site design from the backend interface, so that you are only looking at the navigation links and x-cart interface. Do this to whichever "footer" file you are using as well - either rectangle_bottom.tpl or bottom.tpl under skin1/. This works in ANY version of x-cart.

-------------------------------------------------

2. In similar fashion, there are some things that I want my store admins to see, and there are some things I want to see as the developer logging in with the username "master". Some of the menu items in the right column I like to have for "master" only, and some for the other admins I create. So...that being said, following the logic in #1 - here's an if/then I usually surround items with in the admin menu files like skin1/admin/menu_admin.tpl and skin1/provider/menu.tpl : {if $login eq "master"} {/if} - you can put that around any item you ONLY want visible to the user "master". This works in ANY version of x-cart.

-------------------------------------------------

3. Sometimes I don't want my "store admins" to be able to create new administrators - - - sounds easy to do with the logic above, but you don't want to just take out the link "users" because that disables the ability for them to administrate their customers as well. So this fix makes it so that the "manage administrators" link dissapears while keeping the "manage customers" link intact. This is a tricky fix... I'm running out the door but will post this fix and more later tonight.

-------------------------------------------------

4. Ugh, onto #4, will dig up #3 again in a bit ;) So..another common one I use is to have different "buy now" buttons for different categories of products. In this case, I am usually working with either products.tpl or products_t.tpl - depending on your site layout. In example, here is a recent if/then I used in products.tpl that will display a different "buy now" button depending on whether or not the category is #5 -

Code:

{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y" and $products[product].categoryid ne "5"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{else}
{include file="customer/main/member_buy_now.tpl" product=$products[product]}
{/if}


Notice the "and $products[product].categoryid ne "5" part - - this is where you can change the categoryid number you're trying to affect. So above, I'm saying if the category # is not equal to "5" - then display the normal include - if not - and the category DOES equal five, display the special include. Of course, you'll have to copy "buy_now.tpl", make your own, and call it in the tag above. This works in ANY version of x-cart.

-------------------------------------------------

5. Ah, but somebody says, what about if I want to do this same thing on the "product.tpl" template? Same tag doesn't work, you may have noticed. Just use this syntax instead:

Code:

{if $product.categoryid == 4 or $product.categoryid == 5}{/if}

This works in ANY version of x-cart.

-------------------------------------------------

6. Ok, so here is some if/then mods I have made to the skin1/main/register_personal_info.tpl and other "register_" tpl files in that directory. I have mainly used these when I needed to add a custom field to the xcart_customers table and then have it show up in the registration process for the customer as well as the admin.

There are other places in this forum that discuss how to go about adding fields to the registration process, so I won't go in-depth there - but once you've added the fields and you are wanting to make a <select> box or something similar for the answer choices, these if/then's help.

In this next example, I have added a field called "region" to my customer table, and would like to display it, along with the customers' answer, in the profile section.

Code:

<tr valign=middle>
<td align=right>Your Area</td>
<td></td>
<td nowrap>
<select name=area {if $usertype eq "C"}disabled{/if}>
<option value="">
<option value="area1" {if $userinfo.area eq "area1"}selected{/if}>area1
<option value="area2" {if $userinfo.area eq "area1"}selected{/if}>area2
<option value="area3" {if $userinfo.area eq "area3"}selected{/if}>area3 <option value="area4" {if $userinfo.area eq "area4"}selected{/if}>area4
<option value="area5" {if $userinfo.area eq "area5"}selected{/if}>area5
</select>
</td>
</tr>


Notice that I have several if/then's going on here - I've "disabled" some of the select boxes if you are a customer, and also provided statements that will correctly display your chosen answer if you have already filled out your profile. Pretty straightforward stuff - - you just put $userinfo. before the name of your new field you added to the customers table.


-------------------------------------------------


7. Ok, so this is also elsewhere on the forums, but have you ever tried to have an "on" state to a button when you were on that particular static page in your x-cart store? So when you're on the "about us" page your About Us graphic is the "over state" of the graphic?

You need a simple if/then to do it:

Code:

{if $smarty.get.pageid eq "22"}[img]button.gif[/img]{/if}

This will obviously show the image if the static page id is "22". I have used this successfully in bottom.tpl, rectangle_bottom.tpl, rectangle_top.tpl, and head.tpl, but I'm sure it would work in others as well.

-------------------------------------------------

8. Similar to the above - what about if you want to show something specific to the category you're on? Well, similar situation:

Code:

{if $cat eq "9"}show this{/if}

So above if the category equals "9" - it will show the "show this" text. Don't know what category # your categories are? Simply click on a category via the frontend in your browser, and in the url string you will see the category # as x-cart has assigned it. I have only successfully used this tag with THIS syntax on the products.tpl template - check above for other syntax that works on other templates.

-------------------------------------------------

9. Ah, one more before I hit the bed - ever wanted to display something based on whether a customer was not only logged in, but whether or not they had a "membership level" as well?

The "if logged in" part is easy:

Code:

{if $login ne ""} display this {/if}

The above tag will display the "display this" text if a person has logged in. If they have not, it will display nothing.

Now, determining whether they have a membership level is a different tag:

Code:

{if $user_membership ne ""} display this {/if}

The above tag will only display the text if a membership level is detected by x-cart. Useful if you have "member-only" pages or messages. I have used this in the past to surround pricing tags in product.tpl and products.tpl, as well as for displaying navigation tabs, etc.

It is also useful for displaying a message such as "become a member for extra savings, click here" if you want non-members to feel like they should check out becoming a member of your store when they are looking at products.

Another useful place for this tag is on your static pages - many people have complained of not having "content protection" on x-cart - well, this is how you do it. Create your static page, make sure you have "parse smarty tags in static pages" checked in your general setting for static pages, and then at the top of your html where your content begins, simply put that tag in there surrounding your "real" content, and then an {else} for your message to people who don't have the membership.

Something like this:

Code:

{if $user_membership ne "Level 1"}
I'm sorry, you don't have a membership, so this content is not accessible.  Please click here to become a member and get the goodies.
{else}
Your real html content
{/if}


-------------------------------------------------


10. Lol, here's a fun one for a special situation - we had a client that wanted a certain payment method available to just "some" people within a membership level of xcart. As you know xcart doesn't let you specify this "out of the box" per user so we came up with a handy dandy if/then for the checkout.tpl file down where the {section} lists out the payment methods for display. Now obviously this isn't gonna work if you have a huge list of people - this was for a handful, so keep that in mind ;o) - check it out:


Code:

{section name=payment loop=$payment_methods}
{if $payment_methods[payment].payment_method eq 'Special Payment Method' and $login ne 'samsmith' and $login ne 'poopybrown' and $login ne 'classclown'}<!---{/if}
<TR>
<TD width="1"><INPUT type="radio" name="paymentid" value="{$payment_methods[payment].paymentid}"{if $payment_methods[payment].is_default eq "0"} checked{/if}></TD>
<TD nowrap>{$payment_methods[payment].payment_method}</TD>
<TD>{$payment_methods[payment].payment_details}</TD>
</TR>{if $payment_methods[payment].payment_method eq 'Special Payment Method' and $login ne 'samsmith' and $login ne 'poopybrown' and $login ne 'classclown'}--->{/if}
{/section}



That lil' segment there only shows the payment method "Special Payment Method" if you are one of those users and are logged in, even though it's activated in xcart for the entire membership level.

Why did I use an html comment instead of a smarty comment to get rid of it? I couldn't get the if/then to work using a smarty comment - it always read the comment regardless of the if/then, leading me to believe it's not possible to write an if/then in order to print a smarty comment. ;o)

-------------------------------------------------

11. Ok, here's one where we had a special need. We needed customers to only be able to order certain products within one of our cateogires with a qty that WE specified, not from a dropdown, and not specifying it themselves in an open text box. We needed a product ordered in increments of 1000 - so you could order 1k, 2k, 3k, 4k, and 5k - and that's it.

Impossible you say...given that xcart controls the qty field, and the math of the cart depends upon that field. You can limit the min qty in the backend, but no way to modify the increments of qty that can be ordered per product.

So...we came up with this if/then on the product.tpl template that does the trick - this should replace the qty dropdown xcart has in there now, after replacing my "regular xcart qty <select> qty code" comment with the standard xcart <select> qty dropdown:

Code:

{if $product.productid == 10 || $product.productid == 12 || $product.productid == 17}
<SELECT name="amount"{if $active_modules.Product_Options ne ''} onchange="check_wholesale(this.value);"{/if}>
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
<option value="4000">4000</option>
<option value="5000">5000</option>
</select>

{else}

regular xcart qty <select> qty code. 
{* I would post it but mine is heavily modified and confusing *}

{/if}


Again this is for a special situation, and as you can see we've done it by productid - so doing this for 100 products you would want to get fancy with your smarty tag and do a range of productid's.


-------------------------------------------------

Hope somebody finds some peace through this info, I'll keep adding on as I have time - thanks for the nudge!


***EDITED by Balinor to make Sticky *****

adpboss 09-25-2004 02:10 PM

Instinctual,

Finish this post! It's a good one!

magder 10-04-2004 01:21 PM

instinctual, thanks for the post.

I've figured out some of this stuff but the product.tpl will bring me some peace.

It would be great to see more.

jcaisse 10-06-2004 04:14 PM

Thanks for the post! Number 2 and 3 are GREAT!

magder 10-12-2004 01:52 AM

I've been having some trouble with an {if} statement on a mod for paid membership. I thought this would be fairly simple.

I want to change the cart checkout button to join when it is a membership product.

I found this in the membership sign up script:

Quote:

if (empty($add_to_cart)) {
$amount = ($product_options == "Membership Sign Up") ? 1 : $amount;
$options = "Memberships: " . $product_options;

So I tried this which doesn't seem to be working:

Quote:

{if $products[product].product_options eq "Membership Sign Up"}<td>
{include file="buttons/update.tpl" type="input"}



</td>
<td align=right>
{include file="buttons/checkout.tpl" style="button"}
{else}
{include file="buttons/update.tpl" type="input"}


{include file="buttons/clear_cart.tpl"}
</td>
<td align=right>{include file="buttons/continue_shopping.tpl" style="button"}
<a href="cart.php?mode=checkout">{include file="buttons/checkout.tpl" style="button"}{/if}

I also tried using {if $user_membership ne ""} but that didn't work either. Is there something about the cart that handles these variables differently?

instinctual 10-12-2004 10:25 AM

by product id
 
hmmm...well, not having checked that your variables are in the right syntax, and whether or not they can be used on the cart page like this, I'd say try this instead:

{if $products[product].product_options == "Membership Sign Up"}

See if that does the trick!

I'm almost thinking though that you would need to be using $cart_contents or something like that instead though - checking the cart contents for products with options that match, right now I think this tag is more for the products.tpl and product.tpl templates.

Lemme know!

Instinctual
Colorado
X-Cart Versions 3.5.x - 4.0.4

magder 10-12-2004 11:54 AM

It didn't work. I think I'd tried that once before after reading your post.
Is there another variable i might try?

instinctual 10-12-2004 05:58 PM

Lemme do some diggin'
 
Lemme do some diggin' and I'll see what I can come up with :)

Instinctual
Colorado
X-Cart Versions 3.5.x - 4.0.4

IndieDepot 05-25-2005 11:10 AM

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

Originally Posted by instinctual
4. Ugh, onto #4, will dig up #3 again in a bit ;) So..another common one I use is to have different "buy now" buttons for different categories of products. In this case, I am usually working with either products.tpl or products_t.tpl - depending on your site layout. In example, here is a recent if/then I used in products.tpl that will display a different "buy now" button depending on whether or not the category is #5 -

{if $usertype eq "C" and $config.Appearance.buynow_button_enabled eq "Y" and $products[product].categoryid ne "5"}
{include file="customer/main/buy_now.tpl" product=$products[product]}
{else}
{include file="customer/main/member_buy_now.tpl" product=$products[product]}
{/if}

Notice the "and $products[product].categoryid ne "5" part - - this is where you can change the categoryid number you're trying to affect. So above, I'm saying if the category # is not equal to "5" - then display the normal include - if not - and the category DOES equal five, display the special include. Of course, you'll have to copy "buy_now.tpl", make your own, and call it in the tag above. This works in ANY version of x-cart.


Unfortunately #4 does not work in 4.0.13. I guess this was a solution for earlier versions of X-Cart. it would have been nice though. I guess now X-Cart doesn't list the 'categoryid' with the product tables anymore. And therefore you can grab the category ID in the products.tpl file anylonger.

I sure wish I knew how to do this. I wish I knew how to do it for manufacturers too. I'd like to list the manufacturers in the sub-categories AND i would like to list the categories in the product profile. Alas, nobody knows how.

- Shannon

instinctual 05-25-2005 12:47 PM

try this
 
Try $product.productid or $products.productid - - - ;o) One of these variations will work, I've done it in the 4.o.x branch - if they don't I'll dig up what WILL work, so lemme know....

AgileMolecule 06-07-2005 05:07 PM

Hey Instinctual-
I want to let you know that a couple of your tips were just what I needed to really get a handle on how to get working with Smarty and XCart.

Sometimes a tiny little bit of data is all that is needed to get a whole new chapter of learning started.

Thanks much!

instinctual 06-08-2005 05:25 AM

thanks
 
Thanks - always appreciate the comments - this thread seems to live long and prosper ;o) I'll try and take some more time to keep adding to it :roll:

maineiac 06-15-2005 08:49 PM

Instinctual,

Thank You for these excellent tips! I am a newbie to Xcart and your instructions have helped me tremendously during this learning stage while modding the cart for my purposes.

I am wondering what happened to #3, or am I just missing something here?

Quote:

3. Sometimes I don't want my "store admins" to be able to create new administrators - - - sounds easy to do with the logic above, but you don't want to just take out the link "users" because that disables the ability for them to administrate their customers as well. So this fix makes it so that the "manage administrators" link dissapears while keeping the "manage customers" link intact. This is a tricky fix... I'm running out the door but will post this fix and more later tonight.

Using xcart v4.0.13 I am creating a new admin level based on the 'Fulfillment staff' templates. I've created a new directory and inserted home.tpl and menu.tpl in it to show only what I want this level of admin to see. So far so good - it works! Now I run into the problem of the "In this section" dialog box under "Users Management". I want to hide some of those links - in particular the ability to create new admins!

I think I have it narrowed down to dialog_tools.tpl, but cannot get any further...

Many thanks in advance for any help you can offer!

maineiac 06-15-2005 10:10 PM

Quote:

Now I run into the problem of the "In this section" dialog box under "Users Management". I want to hide some of those links - in particular the ability to create new admins!
Solved by surrounding the links I do not wish this admin level to see with
Code:

if ($login == "master"){}
in admin/users_tools.php. For example:
Code:

if ($login == "master"){
if (empty($active_modules["Simple_Mode"])) {
        $dialog_tools_data["left"][] = array("link" => "user_add.php?usertype=A", "title" => func_get_langvar_by_name("lbl_create_admin_profile"));
       
        $dialog_tools_data["left"][] = array("link" => "user_add.php?usertype=P", "title" => func_get_langvar_by_name("lbl_create_provider_profile"));
}
else {
        $dialog_tools_data["left"][] = array("link" => "user_add.php?usertype=P", "title" => func_get_langvar_by_name("lbl_create_admin_profile"));
}
}


instinctual 06-16-2005 05:47 AM

ah yes
 
Ah, yes, sorry I didn't get back to you in time, excellent work ;o)


I usually disable the whole "see also" section up there as well, in dialog_tools.tpl by just commenting out that <td> that they're in.

Thanks for adding to the post!

instinctual 10-09-2005 12:54 PM

bump.

Since editing a post doesn't seem to affect the last post date, I'm shamelessly bumping this post to let you all know I've added to it and edited it.

I like to keep it all in one simple post so I always edit the first one here ;o)

Cheers :P

mffowler 10-09-2005 01:10 PM

Cheers! I always have a use for your offerings....

- Mike

chrisinoz 10-21-2005 01:59 PM

Hi Instinctual

What a wonderful post. Most appreciated.

I was asking about one of these in the forum and Patraick pointed me here however I can not get this very simple one to work

{if $user_membership eq "Premium"} display this {/if}

I setup test user and attributed xcart default Premium membership to it and get a blank.

Checked db and it attributes Premium to this user.

Tried this in 4.014 and 4.016

Scratching head here.

Can't see what I am missing here!

Cheers

Chris

4.03 - 4.016

mffowler 10-21-2005 02:06 PM

Do you have it set so that you need to "approve" membership?

- Mike

chrisinoz 10-21-2005 04:11 PM

Hi Mike

Thx for reply

I went to my test site - still 4.04 and setup a user in Wholesale Membership.

When I login it recognises the login and shows me a wholesale price I setup so I know that xcart is recognising that group.

So I added {if $user_membership eq "Wholesale"} display this {/if}

to customer/home.tpl

Yet it shows nothing on screen.

BTW I did not know you could set it to approve membership but I don''t see that as a problem here.

Cheers

Chris

instinctual 10-23-2005 05:48 PM

Problem solved in this thread 3rd page ----> http://forum.x-cart.com/viewtopic.php?p=112207#112088

chrisinoz 10-23-2005 10:45 PM

Hi Instinctual

Thanks for the feedback but I could not get that to work.

See

http://www.integrinet.com.au/image.gif

The first shot is the live site - text should have shown under the help menu.

Cheers

Chris

instinctual 10-24-2005 05:41 AM

Problem solved in this thread 3rd page ----> http://forum.x-cart.com/viewtopic.php?p=112207#112088

chrisinoz 10-24-2005 01:28 PM

Yippee

This worked

{if $userinfo.membership eq "Premium"} display this{/if}

Thanks heaps for persisting with this Instinctual

Cheers

Chris
4.016

chrisinoz 10-24-2005 01:37 PM

Well kind of Yippee.

It shows okay on cart.php pages but on any other pages eg home.php, pages.php etc it disappears again.

Here is my home.tpl .

Code:

{* $Id: home.tpl,v 1.67.2.9 2005/06/28 12:02:38 svowl Exp $ *}
{if $printable ne ''}
{include file="customer/home_printable.tpl"}
{else}
{config_load file="$skin_config"}
<HTML><HEAD><TITLE>
{if $config.SEO.page_title_format eq "A"}
{section name=position loop=$location}
{$location[position].0|escape}
{if not %position.last%} :: {/if}
{/section}
{else}{section name=position loop=$location step=-1}
{$location[position].0|escape}
{if not %position.last%} :: {/if}{/section}
{/if}</TITLE>

{ include file="meta.tpl" }
<LINK rel="stylesheet" href="{$SkinDir}/{#CSSFile#}">
</HEAD>

<BODY leftmargin="0" topmargin="0" rightmargin="0" bottomargin="0" marginwidth="0" marginheight="0"{if $body_onload ne ''} onload="{$body_onload}"{/if}><a name="top"></a>
{ include file="rectangle_top.tpl" }
{ include file="head.tpl" }
{if $active_modules.SnS_connector}
{include file="modules/SnS_connector/header.tpl"}
{/if}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0" align="center">
<TR valign=top>
<TD width="43" class="sidebglhs"></TD>
<TD width="145" class=sidebg valign="top">
{if $categories ne "" and ($active_modules.Fancy_Categories ne "" or $config.General.root_categories eq "Y" or $subcategories ne "")}
{ include file="customer/categories.tpl" }

{/if}

{if $active_modules.Manufacturers ne "" and $config.Modules.manufacturers_menu eq "Y"}
{ include file="modules/Manufacturers/menu_manufacturers.tpl" }
{/if}
{include file="about.tpl"}


{*<a href=giftcert.php>[img]{$ImagesDir}/gift_cert.gif[/img]</a>*}



{include file="help.tpl" }

{if $userinfo.membership eq "Premium"} display this{/if}

[img]{$ImagesDir}/spacer.gif[/img]</TD>
<TD width="20"></TD>
<TD valign="top">



{include file="printable.tpl"}

{if $main eq "catalog" and $current_category.category eq ""}{else}{include file="location.tpl"}{/if}

{include file="dialog_message.tpl"}

{if $active_modules.Special_Offers ne ""}
{include file="modules/Special_Offers/customer/new_offers_message.tpl"}
{/if}

{include file="customer/home_main.tpl"}



{ include file="minormenu.tpl" }

</TD>
<TD width="20"></td>
<TD width="6" class=menubgrhs></td>
<TD width="150" valign="top" class=menubgrhs>

{if $active_modules.SnS_connector}
{include file="modules/SnS_connector/button.tpl"}


{/if}
{if $active_modules.Feature_Comparison ne "" && $comparison_products ne ''}
{ include file="modules/Feature_Comparison/product_list.tpl" }


{/if}
{if $active_modules.Users_online ne "" and $users_online}
{ include file="modules/Users_online/menu_users_online.tpl" }


{/if}

{if $login eq "" }
{ include file="auth.tpl" }


{else}
{ include file="authbox.tpl" }


{/if}
{if $active_modules.Bestsellers ne "" and $config.Modules.bestsellers_menu eq "Y"}
{ include file="modules/Bestsellers/menu_bestsellers.tpl" }



{/if}
{ include file="news.tpl" }
{if $active_modules.Interneka ne ""}


{ include file="modules/Interneka/menu_interneka.tpl" }
{/if}


{ include file="poweredby.tpl" }


[img]{$ImagesDir}/spacer.gif[/img]
</TD>
<TD width="6" class=menubgrhs></TD>
</TR>
</TABLE>
{ include file="rectangle_bottom.tpl" }


</BODY>
</HTML>
{/if}


Cheers

Chris
4.016

instinctual 10-25-2005 08:12 PM

Problem solved in this thread 3rd page ----> http://forum.x-cart.com/viewtopic.php?p=112207#112088

chrisinoz 10-25-2005 08:30 PM

Thanks but that brings no joy at all - not on any page

Code:

{include file="help.tpl" }

{if $smarty.get.userinfo.membership eq "Premium"}display this{/if}


One for x-cart do you think???

Cheers Instinctual

Chris

instinctual 10-26-2005 06:08 AM

Problem solved in this thread 3rd page ----> http://forum.x-cart.com/viewtopic.php?p=112207#112088

chrisinoz 10-26-2005 01:33 PM

Hi Instinctual

We persist then :> Thanks.

This worked correctly on cart.php but not other pages

{if $userinfo.membership eq "Premium" or $user_membership eq 'Premium'} display this{/if}

The other code did not produce any results.

Cheers

Chris
4.016

mffowler 10-26-2005 05:43 PM

There must be a php expert out there who knows how to call the data into the home.php so the {if} can work?

Is there a developers manual for XC like the LC dev. manual?

- Mike

chrisinoz 10-26-2005 05:52 PM

Not that I know of Mike.

If we can't work it out I'll go to xcart for the solution and post it here.

I want to mainly use it for a Club /Premium member menu only to show for them.



Cheers

Chris

instinctual 10-27-2005 06:03 AM

lol, alright, let's get serious about this 8)

So - we can assign variables for sure - that shouldn't be a problem - here is what we should be working with from what I can tell - and I'd like to put this into your auth.php file.

Code:


$membershiplevel=array_pop(func_query_first("select membership from $sql_tbl[customers] where login='$login'"));
$smarty->assign("membershiplevel",$membershiplevel);


Now, this really should do the trick I would think - may need some slight tweaking though so lemme know. You can pretty much stick this at the end of the file...

Then your if/then tag would look like:

Code:

{if $membershiplevel eq 'Premium'}Do it!{/if}

Cheers!

chrisinoz 10-27-2005 01:32 PM

Hi Instinctual

Added to home.tpl


Code:

{if $membershiplevel eq 'Premium'}Do it!{/if}

Added the code to auth.php

Code:


#
# membership levels
#

$membershiplevel=array_pop(func_query_first("select membership from $sql_tbl[customers] where login='$login'"));
$smarty->assign("membershiplevel",$membershiplevel);



No joy yet.

FYI this is the site I am working on, though that won't help of course. Only one product so far of course as I test and build.

www.seriouslygourmet.com.au/index.php

Logging in with

peter
piper

Who is a Premium member

Cheers
4.016

instinctual 10-27-2005 04:47 PM

Make sure you're adding this after the very last "}" in auth.php - (sorry, not sure what your smarty/php experience is). Or you can add it above the $pages_menu func query if you like as well.

Nice site btw - really good layout - most people don't do the expanding/contracting design, I likey ;o)

chrisinoz 10-27-2005 04:56 PM

Hey Instinctual

It's where I put it in auth.php that was the problem.

It works like a treat now!

So for others who read this - the solution at Posted: Thu Oct 27, 2005 9:03 am is the crroect one. Check where you place it in auth.

I really appreciate you sticking with this one. Others will surely benefit

Cheers

Chris

chrisinoz 10-27-2005 05:02 PM

Further to this - This will work a treat with a small mod I had x-cart do with my embedded static pages.

I can make a page but select it so that it does not display in the standard help menu but is still available.

This way I can make up a new menu for only members and load it with static page urls I have created. Then with what Instinctual has worked through I can now make this menu only show when a person logs in as a Member.

Cheers

Chris
4.016

instinctual 10-27-2005 05:24 PM

Cheers!

I will be sure to hoot and holler as I'm ripping through some singletrack on my motox bike tomorrow :lol:

I'll edit my previous posts to all point to the correct one for the solution ;o) You may want to do the same.

chrisinoz 10-27-2005 05:29 PM

My future son-in-law would love to join you 8000' in the Rockies - pity he is in Australia. He has a WR450 Yamaha trail bike.

I'll look at my posts also.

Cheers

Chris

instinctual 10-27-2005 09:35 PM

lol, I'm headin' upto 13k tomorrow - will be the last ride of the season that high, but what a great time of the year for it ;o)

Takin' the YZ250F - should be some good times, woot!

danbass 11-30-2005 12:09 PM

Quote:

Originally Posted by instinctual
lol, alright, let's get serious about this 8)

So - we can assign variables for sure - that shouldn't be a problem - here is what we should be working with from what I can tell - and I'd like to put this into your auth.php file.

Code:


$membershiplevel=array_pop(func_query_first("select membership from $sql_tbl[customers] where login='$login'"));
$smarty->assign("membershiplevel",$membershiplevel);


Now, this really should do the trick I would think - may need some slight tweaking though so lemme know. You can pretty much stick this at the end of the file...

Then your if/then tag would look like:

Code:

{if $membershiplevel eq 'Premium'}Do it!{/if}

Cheers!


Can this be altered so that people who are unregistered can see a specific membership level. I want the unregistered users to see the Retail products and registered users to see the products based on their membership level.


All times are GMT -8. The time now is 05:36 PM.

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