Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2008
    Location
    Arkansas
    Posts
    6
    Plugin Contributions
    0

    help question Call username and cart total in template

    Hello.

    I have been working in Zen-Cart for about 2 years now. I design templates for our web design clients. Usually whenever I have an issue I can find a solution by searching the forums or using google to search these forums. However, tonight... I am at a small loss.

    I might not be searching for the correct terms. If anyone can point me to the files to look into or provide me with the code I would appreciate it.

    Here are the things I need to do:

    1. Call the user's username/nickname in the template (I already have a session switch in place to check to see if they are logged in or not)
    2. Call the total dollar amount that is currently in their cart. Even if it is zero.


    I look forward to your replies.
    Thanks!
    - Brian

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Call username and cart total in template

    I have been working in Zen-Cart for about 2 years now
    If anyone can point me to the files to look into or provide me with the code I would appreciate it.
    Hopefully you know that we might need to know where you want this displayed as the files required change depending on where

  3. #3
    Join Date
    Apr 2008
    Location
    Arkansas
    Posts
    6
    Plugin Contributions
    0

    help question Re: Call username and cart total in template

    It will need to be called in the tpl_main_page.php file.

    What I am doing is this:
    • When logged out, in the upper right hand corner of the template it says "Welcome Guest! Sign In or Register."
    • When logged in, I need that to change to something like "Welcome Mr. Smith! Your cart total is now $0.00"
    • Or it could say "You are logged in as [email protected]. You have 0 items in your cart".

    Username or email address would be fine, as would cart total $ amount or # of items. Which ever is easier to do... the client is not that picky, we just need it to change and have more funtion then just "You are logged in" (which is what I have now)

    I have the logic in place to check to see if they are logged in and change what is displayed. But I do not know where to find (or the code) to pull only the items I need into a sentence in the code.

    Thank you for your help.

  4. #4
    Join Date
    Apr 2008
    Location
    Arkansas
    Posts
    6
    Plugin Contributions
    0

    Default Re: Call username and cart total in template

    by the way, I see this in the language index file:

    Code:
    define('TEXT_GREETING_PERSONAL', 'Hello <span class="greetUser">%s</span>! Would you like to see our <a href="%s">newest additions</a>?');
    I figure I need to do something like this, but again... I am just missing the direction needed to develop an edited version for my needs.

    I would even search the "developers tool kit" to find the logic, if I could only figure out what part of the logic is.

    Thanks again for any help given.
    - Brian

  5. #5
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Call username and cart total in template

    From /includes/languages/english/index.php
    Code:
    define('TEXT_GREETING_PERSONAL', 'Hello <span class="greetUser">%s</span>! Would you like to see our <a href="%s">newest additions</a>?');
    This returns a logged in users first name
    From /includes/templates/sideboxes/tpl_shopping_cart.php
    Code:
    $content .= '<div class="cartBoxTotal">' . $currencies->format($_SESSION['cart']->show_total()) . '</div>';
    returns cart total

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Call username and cart total in template

    Logic in response to your last post:

    in languages the index.php has defines that you will copy/move to header.php

    then in the functions_customers.php file see the linkage - as this already exists you can just use it
    cart total will be different

  7. #7
    Join Date
    Apr 2008
    Location
    Arkansas
    Posts
    6
    Plugin Contributions
    0

    Default Re: Call username and cart total in template

    Thank you very much for your help.

  8. #8
    Join Date
    Apr 2008
    Location
    Arkansas
    Posts
    6
    Plugin Contributions
    0

    Default Re: Call username and cart total in template

    ok... I got the amount to work, but not the name.

    Is there something like this available?
    Code:
    <?php echo $_SESSION['customers_firstname']; ?>
    I can't seem to find where the name is defined in the session...

  9. #9
    Join Date
    Apr 2008
    Location
    Arkansas
    Posts
    6
    Plugin Contributions
    0

    Default Re: Call username and cart total in template

    Nevermind...

    Found it.

    Code:
    <?php echo $_SESSION['customer_first_name'] ?>
    Thanks again!

 

 

Similar Threads

  1. Replies: 4
    Last Post: 30 May 2012, 10:20 AM
  2. shopping cart total and sub total missmatch v1.3.8
    By James Dunstone in forum General Questions
    Replies: 0
    Last Post: 15 Jun 2011, 09:51 PM
  3. How do I call the Username and Password of the current admin?
    By bparker in forum Basic Configuration
    Replies: 7
    Last Post: 17 Sep 2009, 05:40 PM
  4. how do I change mysql username and pw for an existing zen cart?
    By nguyenkhv in forum General Questions
    Replies: 1
    Last Post: 16 Sep 2008, 04:34 PM
  5. Call for price and add to cart
    By Outlawlb in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 19 Feb 2007, 05:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg