Forums / Templates, Stylesheets, Page Layout / Link to external Landing Page

Link to external Landing Page

Views: 2,081

Results 1 to 12 of 12
12 Feb 2014, 6:55 PM
#1
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Link to external Landing Page

ZC 1.5.1 store is access completely restricted to logged in customers only.

I have created a external landing page which looks just like my cart pages in the document root of my website where all traffic to "www.somedomain.com" goes. My store is in a subfolder callled "somestore" (not really).

When I access the external landing page and click the "Log In" link" I have created in the header h t t p s://www.somedomain.com/somestore/index.php?main_page=login" it goes to the log in screen of ZC.
So far so good..... (Customer decides not to login)

Now when I click on the "Home" link in the header instead of staying at the cart log in page (like it's supposed to) I would like it to go back to the external landing page.
What I want is to have the "Home" link switch between logged in (normal operation) and not logged in (Go back to external landing page).
This probably means adding some code to distinguish between a logged/not logged in.
Yes, this may be a core file edit which I'm willing to do......

Maybe there is already a solution for this but I have seen several persons asking for similar functionality but haven't been able to good solution.

12 Feb 2014, 7:56 PM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Link to external Landing Page

Something like```php
if ($_SESSION['customer_id']) { //there will only be a customer_id if logged in
//link for normal store operation
} else {
//link back to landing page
}


If you post the relevant section of tpl_header.php and the exact links you want (with the actual domain/subdirectory obfuscated if you wish), we can give you more detailed advice.
13 Feb 2014, 1:34 AM
#3
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Link to external Landing Page

If you absolutely need an external html page you could modify the index page filters that come with Twitch Wholesale + Attributes...

Or if you just want logged in/not logged in restrictions the combination of Twitch Wholesale and Twitch Restrict and the default Zen Cart Customer Authorization settings will lock the site down and maintain security without leaving the dynamic pages.

You can then point robots to follow or not follow the landing pages as you see fit.

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian

13 Feb 2014, 4:27 AM
#4
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Link to external Landing Page

ZC 1.5.1 store access completely restricted to logged in customers only. Customer either gets the external landing page or the internal login page

twitchtoo,
That would probably work but I am already way over my limit on plugin's and mods to the template & core. Also the site is in production so I'm very leery about adding more plugin's. I think there is simpler solution.

gjh42
I have modified the template and manipulated some core code in this area already.
Here's the code I'm refering to. Also see attached home01.jpg file

<body id="loginBody" onload="update_zone(document.create_account); update_zone_shipping(document.create_account);"> <div id="mainWrapper"> <!--bof-header logo and navigation display--> <div id="headerWrapper"> <!--bof-navigation display--> <div id="navMainWrapper"> <!-- Added code to display HOME to the left and the LOGIN & Cart to the right --> <div id="navMain"> <ul class="back"> <li><a href="http://www.somesite.com/store/">Home</a></li> EXPLANATION: At the internal login page I want the above link to be "http://www.somesite.com" when NOT logged in and "http://www.somesite.com/store/" when logged in </ul> </div> <div id="navMain"> <ul class="forward"> <li><a href="http://www.somesite.com/store/index.php?main_page=login&zenid=1f16ebb439862ddd8dc353179785c57f">Log In</a></li> </ul> </div> <div id="navMainSearch"> </div> <div class="clearBoth"></div>

Attachment 13774

13 Feb 2014, 5:35 AM
#5
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Link to external Landing Page

gjh42

Guy's, Previously I posted the html output not the code....
Here it is. Everything else is the same.

<!--bof-header logo and navigation display--> <?php if (!isset($flag_disable_header) || !$flag_disable_header) { ?> <div id="headerWrapper"> <!--bof-navigation display--> <div id="navMainWrapper"> <!-- Added code to display HOME to the left and the LOGIN & Cart the right --> <div id="navMain"> <ul class="back"> <li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li> EXPLANATION: At the internal login page I want the above link to be "http://www.somesite.com" when NOT logged in and "http://www.somesite.com/store/" when logged in. See html code in previous post. </ul> </div> <div id="navMain"> <ul class="forward"> <?php if ($_SESSION['customer_id']) { ?> <li><a href="<?php echo zen_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGOFF; ?></a></li> <li><a href="<?php echo zen_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a></li> <?php } else { if (STORE_STATUS == '0') { ?> <li><a href="<?php echo zen_href_link(FILENAME_LOGIN, '', 'SSL'); ?>"><?php echo HEADER_TITLE_LOGIN; ?></a></li> <?php } } ?> <?php if ($_SESSION['cart']->count_contents() != 0) { ?> <li> <!-- Commented out 2 items below to not display standard cart contents & shipping --> <!-- <a href="<?php // echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"><?php // echo HEADER_TITLE_CART_CONTENTS; ?></a> --> </li> <li> <!-- <a href="<?php // echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php // echo HEADER_TITLE_CHECKOUT; ?></a> --> </li> <!-- Added code lines 73 thru 77 to display cart data --> <li class="cartCountTotal"> <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"> Check Out: <?php $header_cart = $currencies->format($_SESSION['cart']->show_total()); echo $header_cart; ?></a></li> </a> <div class="clearBoth"></div> <!-- <br class="clearBoth" /> --> <?php }?> </ul> </div> <div id="navMainSearch"> <?php // require(DIR_WS_MODULES . 'sideboxes/search_header.php'); ?> </div> <div class="clearBoth"></div> <!-- <br class="clearBoth" /> --> </div> <!--eof-navigation display-->
13 Feb 2014, 4:35 PM
#6
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Link to external Landing Page

gjh42 & Twitchtoo
After thinking about your suggestions I implemented the below and after preliminary testing it seems to work without any side effects.
Do you see any problems with this solution?

For those of you who have this same issue with external landing pages I'm pretty sure you could apply some form of this to the original template.

Thanks, You guys are the best.

Replaced this:

<li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php // echo HEADER_TITLE_CATALOG; ?></a></li>

With this:
<?php if ($_SESSION['customer_id']) { ?>

<li><?php echo '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li> <?php } else { if (STORE_STATUS == '0') { ?> <li><?php echo '<a href="' . HTTP_SERVER . '">'; ?><?php echo HEADER_TITLE_CATALOG; ?></a></li> <?php } } ?>
14 Feb 2014, 4:21 AM
#8
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Link to external Landing Page

Elegant would be nice. :cool:
Care to show an example?
I'm learning as I hack. :ohmy:

14 Feb 2014, 8:03 AM
#9
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Link to external Landing Page

<li><?php echo '<a href="' . HTTP_SERVER . ($_SESSION['customer_id']? DIR_WS_CATALOG: '') . '">' . HEADER_TITLE_CATALOG; ?></a></li>
``` This will add the Zen Cart subfolder to the link path if logged in. It uses a kind of decision-maker called a "ternary operator", which says in effect "is x true? if yes do this: if no do this".
14 Feb 2014, 5:34 PM
#10
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Link to external Landing Page

Very "elegant"!

Thanks for sharing.

16 Feb 2014, 2:41 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Link to external Landing Page

linuxguy2:

Very "elegant"!

Thanks for sharing.

Had your "alternate" site been something different than the base of your domain, then it wouldn't have been "quite" as elegant, but could have used a very similar ternary operator. They can be a friend, but suggest not going overboard with them by putting too much between the breaks without some good notes, etc... Can get lost in the logic.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

18 Feb 2014, 6:18 PM
#12
linuxguy2 avatar

linuxguy2

Zen Follower

Join Date:
Sep 2013
Location:
Texas
Posts:
315
Plugin Contributions:
0

Re: Link to external Landing Page

ZC 1.5.1

Ok, I have a new thingy.

The cart is restricted to approved customers only.
So after the customer registers they get stuck on the "Customer Authorization Pending" page.
The only way to get out of that page is to logout which isn't intuitive.

What I would like to do is when they click "Home" or the "continue" button is to log them out and return them to the external landing page.
I could replace the "continue" button code with the "logout" code but I'm sure there's a more "elegant" solution.

Thanks