Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / My idea for accessing zen cart sessions outside of zen...

My idea for accessing zen cart sessions outside of zen...

Locked

Started by glenelkins on 5 Sep 2008, 11:09 AM · Views: 5,593

Results 21 to 26 of 26
This thread is locked. New replies are disabled.
2 Oct 2008, 3:40 PM
#21
oboeonetwothree avatar

oboeonetwothree

New Zenner

Join Date:
Sep 2008
Posts:
24
Plugin Contributions:
0

Post #21 by oboeonetwothree

I want "login" to change to "logoff" when a person is logged in, and vice versa. The culprit is likely the session variables, although they should be accessible since the zencart directory is on the same server as the home, about, and contact web pages, which are in the website root.

I thought the code below should work:

                <?php if ($_SESSION['customer_id']) { ?>
                <li><a href="<?php print("$webroot"."$shop");?>index.php?main_page=login">Logout</a></li>
            <?php
                  } else {
                    if (STORE_STATUS == '0') {
            ?>
                <li><a href="<?php print("$webroot"."$shop");?>index.php?main_page=login">Login</a></li>
            <?php } } ?>

I saw an example with a bunch of zen_href_link references, so I was wondering if those additions to the code are necessary, with ez-pages that link to my "external"(outside zen cart) pages.

Hopefully this topic is relevant enough - I figured not too many other people would see a reason for this workaround.

I would move the zen-cart files into the website root, but:

  • I'm not sure if it solves the problem
  • Having all of the zencart files floating in the website root would make the file structure less organized.
2 Oct 2008, 3:50 PM
#22
oboeonetwothree avatar

oboeonetwothree

New Zenner

Join Date:
Sep 2008
Posts:
24
Plugin Contributions:
0

Post #22 by oboeonetwothree

It might be helpful to note my directory structure.
Website root > index.php,about/index.php, shop/index.php (and all other zencart files are also in the shop directory here)

2 Oct 2008, 4:01 PM
#23
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Post #23 by kobra

Website root > index.php,about/index.php, shop/index.php
Why do you have other pages at the root?

Make them ezpages and move your cart to the root - -
Zen Cart has elementary CMS functionality

Zen-Venom Get Bitten

2 Oct 2008, 4:05 PM
#24
oboeonetwothree avatar

oboeonetwothree

New Zenner

Join Date:
Sep 2008
Posts:
24
Plugin Contributions:
0

Post #24 by oboeonetwothree

I want my pages to look exactly as they are, and I don't want my home page to be in "myUrl.com/shop/modulesorsomething//main.php". I want my Home page to be in the root directory, with a products page below it(and the products page is the main zen-cart page).

I have also read that even ez-pages have session issues - but I'm not sure if this is only the case with external links

2 Oct 2008, 4:16 PM
#25
oboeonetwothree avatar

oboeonetwothree

New Zenner

Join Date:
Sep 2008
Posts:
24
Plugin Contributions:
0

Post #25 by oboeonetwothree

I also have php in my pages. I'm not sure if I can add them as is with everything parsedcorrectly...and keep the page names as main.php(home), product(index.php), etc.

2 Oct 2008, 9:57 PM
#26
oboeonetwothree avatar

oboeonetwothree

New Zenner

Join Date:
Sep 2008
Posts:
24
Plugin Contributions:
0

Post #26 by oboeonetwothree

kobra:

Why do you have other pages at the root?

Make them ezpages and move your cart to the root - -
Zen Cart has elementary CMS functionality

I seem to have created the functionality I addressed above as long as the home(shop/main.php) page is in the same directory as zen-cart(shop/index.php), and I included application_top.php at the top of the pages.

Am I missing any functionality by not using ezpages?