Advertisement
Guest User

Mophilly Technology Inc PHP cart example

a guest
Aug 25th, 2013
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.     Copyright of Mophilly Technology Inc.
  3.     Template Name: Shopping Cart
  4.     Version 2.1
  5. */
  6.  
  7. get_header(); ?>
  8.  
  9. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  10. <?php get_template_part('includes/breadcrumbs'); ?>
  11.  
  12. <?php if (get_option('magnificent_integration_single_top') <> '' && get_option('magnificent_integrate_singletop_enable') == 'on') echo(get_option('magnificent_integration_single_top')); ?>
  13.  
  14.     <div id="entries">
  15.         <div class="entry post entry-full">
  16.             <div class="border">
  17.                 <div class="bottom">
  18.                     <div class="entry-content clearfix">
  19.                         <h1 class="title"><?php the_title(); ?></h1>
  20.  
  21.  
  22.                         <?php if (get_option('magnificent_page_thumbnails') == 'on') { ?>
  23.  
  24.                             <?php $thumb = '';
  25.                             $width = 218;
  26.                             $height = 218;
  27.                             $classtext = '';
  28.                             $titletext = get_the_title();
  29.  
  30.                             $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext);
  31.                             $thumb = $thumbnail["thumb"]; ?>
  32.  
  33.                             <?php if($thumb <> '') { ?>
  34.                                 <div class="thumbnail">
  35.                                     <?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
  36.                                     <span class="overlay"></span>
  37.                                 </div>  <!-- end .thumbnail -->
  38.                             <?php }; ?>
  39.  
  40.                         <?php }; ?>
  41.                         <?php // begin custom code
  42.                         global $current_user;
  43.                         get_currentuserinfo();
  44.                         //08/26 2012 mophilly; check for valid user registration
  45.                         $isregistered = false;
  46.                        
  47.                         $log_text = 'Shopping Cart Page: Current user id is ' . $current_user->ID;
  48.                         $mo_debug->log_msg($logText,true);
  49.                         echo $log_text;
  50.                        
  51.                         if ( isset($current_user->ID) && $current_user->ID == 0 ) { ?>
  52.                             <div id="logon-register">
  53.                                 <p>Please sign on or register a new account to purchase classes and online training.</p>
  54.                                 <p id="nav">
  55.                                     <a href="#login-form" class="fancybox sav-nav" id="show-logon">Sign On To Your Account</a><br>
  56.                                     <a href="#register-form" class="fancybox sav-nav" id="show-register">Create A New Account</a>
  57.                                 </p>
  58.                                 <br />
  59.                             </div>
  60.                         <?php } else {
  61.                             $customers = new Customer();
  62.                             $cust = $customers->getCustomerByWPid($current_user->ID);                          
  63.                            
  64.                             $log_text = 'Shopping Cart Page: Current customer id is ' . $cust['id'];
  65.                             $mo_debug->log_msg($logText,true);
  66.                             echo $log_text;
  67.                        
  68.                             if ( isset($cust['id']) && $cust['id'] > 0) {
  69.                                 $registration = $customers->validate($cust, false);
  70.                                 $log_text = 'Shopping Cart Page: Current registration is ' . $registration;
  71.                                 $mo_debug->log_msg($logText,true);
  72.                                 echo $log_text;
  73.  
  74.                                 if ( $registration !== '' ) { ?>
  75.                                     <div id="account-register">
  76.                                         <p>Your registration is incomplete. Please visit the "My Account" page to complete your registration.</p>
  77.                                         <p id="nav">
  78.                                             <a href="<?php echo get_permalink($profile_page_id) ?>" class="sav-nav" id="show-account">View My Account</a>
  79.                                         </p>
  80.                                         <br />
  81.                                     </div>
  82.                                 <?php }
  83.                             }
  84.                         }
  85.                         // end custom code ?>
  86.                         <?php the_content(); ?>
  87.                        
  88.                         <div class="fancybox-hidden" style="display:none">
  89.                             <div id="register-form">
  90.                                 <div class="title">
  91.                                     <h3>Create A New Account</h3>          
  92.                                    
  93.                                 <div>
  94.                                     <form name="registerform" id="registerform" action="<?php echo wp_login_url() ?>?action=register&redirect_to=<?php echo get_permalink() ?>" method="post">
  95.                                         <input type="hidden" name="redirect_to" value="<?php echo get_permalink() ?>" />
  96.                                         <div class="alignleft" style="width: 100%;">
  97.                                             <label for="user_name">User Name<br />
  98.                                             <input type="text" name="user_login" id="user_login_register" class="input reg_input" placeholder="your account name" value="" /></label>&nbsp;<small>This is the "account" name; keep it short</small>
  99.                                             <br />
  100.                                             <label for="user_email">Email Address<br />
  101.                                             <input type="text" name="user_email" id="user_email" class="input reg_input" placeholder="your email address" value="" /></label>&nbsp;<small>This must be a working address</small>
  102.                                             <br />
  103.                                             <ul class="sav-nav">
  104.                                                 <li class="sav-nav" style="font-size: 18px;"><a id="AcceptRegister" href="#" >Register</a></li>
  105.                                                 <li class="sav-nav" style="font-size: 18px;" ><a id="CancelRegister" href="#" >Cancel</a>&nbsp;|</li>
  106.                                             </ul>
  107.                                         </div>
  108.                                         <div class="alignleft"  style="width: 100%;">
  109.                                             <hr />  
  110.                                             <p class="statement">A password will be e-mailed to you.</p> 
  111.                                             <p class="statement">Please check your "junkmail" and "spam" mail box if you don't see it in your inbox.</p>
  112.                                         </div>
  113.                                     </form>
  114.                                 </div>
  115.                             </div>
  116.  
  117.                             <div id="login-form">
  118.                                 <div class="title">
  119.                                     <h3>Sign On To Your Account</h3>
  120.                                 </div>
  121.                                 <div>
  122.                                     <form name="loginform" id="loginform" action="<?php echo wp_login_url(get_permalink()) ?>" method="post">
  123.                                         <div class="alignleft" style="width: 100%;">
  124.                                             <input type="hidden" name="redirect_to" value="<?php echo get_permalink() ?>" />
  125.                                             <input type="hidden" name="testcookie" value="1" />
  126.                                             <label for="user_login">Username<br />
  127.                                             <input type="text" name="log" id="user_login_signon" class="input login_input" placeholder="your user name" value="" />
  128.                                             </label> <br /> <label for="user_pass">Password<br />
  129.                                             <input type="password" name="pwd" id="user_pass" class="input login_input" placeholder="your password" value="" />
  130.                                             </label> 
  131.                                             <ul class="sav-nav">
  132.                                                 <li class="sav-nav" style="font-size: 14px;"><a id="AcceptLogin" href="#" >Sign-In</a></li>
  133.                                             </ul>
  134.                                         </div>
  135.                                         <div class="alignleft"  style="width: 100%;">
  136.                                             <hr />  
  137.                                             <label for="rememberme">
  138.                                             <input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="90" />
  139.                                             Remember Me</label> 
  140.                                         </div>
  141.                                     </form>
  142.                                 </div>
  143.                                 <a href="<?php echo wp_lostpassword_url() ?>" title="Password Lost and Found">Lost your password?</a>
  144.                             </div>
  145.                         </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement