クラス
CustomerPage
Customer page view.
説明 説明
A redirect to this page occurs if the buyer attempts to purchase a DLSeller item with QuickPay but is not logged in to their Welcart account.
ファイル: src/Views/CustomerPage/CustomerPage.php
class CustomerPage { /** * Loads CSS and JS assets for customer page * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public function loadAssets() { $semantic = new Semantic(); $semantic->loadCheckboxCss(); $semantic->loadMessageCss(); $semantic->loadSemanticJS(); wp_enqueue_style( 'wcexaap-dlseller-login', WCEXAAP_PLUGIN_URL . '/src/Views/CustomerPage/style.css', [], WCEXAAP_VERSION ); wp_enqueue_script( 'wcexaap-dlseller-login', WCEXAAP_PLUGIN_URL . '/dist/customerPage.js', [Semantic::JS_SLUG], WCEXAAP_VERSION, false ); } /** * Returns `true` if a DLSeller item or auto delivery item is in the cart * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return bool */ public function hasExOrder() { $ex_order = false; if (defined('WCEX_DLSELLER')) { $ex_order = !dlseller_have_dlseller_content() && !dlseller_have_continue_charge() ? false : true; } elseif (defined('WCEX_AUTO_DELIVERY')) { $ex_order = wcad_have_regular_order(); } return $ex_order; } /** * Customer page with login prompt for DLSeller items * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public function dlsellerLoginTemplate() { get_header(); ?> <div id="primary" class="site-content wcexaap"> <div id="content" class="cart-page" role="main"> <?php if (have_posts()) : usces_remove_filter(); ?> <article class="post" id="wc_customer"> <h1 class="cart_page_title"><?php _e('Customer Information', 'usces'); ?></h1> <div id="customer-info"> <div class="cart_navi"> <ul> <li><?php _e('1.Cart', 'usces'); ?></li> <li class="current"><?php _e('2.Customer Info', 'usces'); ?></li> <li><?php _e('4.Confirm', 'usces'); ?></li> </ul> </div> <div class="header_explanation"> <?php /** * Mirrored Welcart action hook * * @ignore */ do_action('usces_action_customer_page_header'); ?> </div> <div class="error_message"><?php usces_error_message(); ?></div> <?php if (usces_is_membersystem_state()) : ?> <form action="<?php echo $this->formAction ?>" method="post" name="customer_loginform" onKeyDown="if(event.keyCode == 13){return false;}"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="customer_form"> <tr> <th scope="row"><?php _e('e-mail adress', 'usces'); ?></th> <td><input name="loginmail" id="loginmail" type="text" value="<?php echo esc_attr($this->email); ?>" style="ime-mode: inactive" /></td> </tr> <tr> <th scope="row"><?php _e('password', 'usces'); ?></th> <td><input name="loginpass" id="loginpass" type="password" value="" /></td> </tr> </table> <?php if ($this->hasExOrder()) : ?> <p id="nav"> <a class="lostpassword" href="<?php usces_url('lostmemberpassword'); ?>"><?php _e('Did you forget your password?', 'usces'); ?></a> </p> <p id="nav"> <a class="newmember" href="<?php usces_url('newmember'); ?>&wcexaap_transition=newmember"><?php _e('New enrollment for membership.', 'usces'); ?></a> </p> <?php endif; ?> <div class="send"> <input name="customerlogin" class="to_memberlogin_button" type="submit" value="<?php _e(' Next ', 'usces'); ?>" /> <div class="ui checkbox"> <input name="allowAmazonLogin" type="checkbox" value="1" > <label for="allowAmazonLogin" style="cursor:pointer;" > <?php _e('Log me in automatically from now on when I use Amazon Pay.', 'wcexaap'); ?> </label> </div> <div class="ui warning message autologin-info" style="display: none;"> <p><?php _e('Note: this feature only works if your login email is the same as your Amazon account email', 'wcexaap'); ?></p> </div> </div> <?php /** * Mirrored Welcart action hook * * @ignore */ do_action('usces_action_customer_page_member_inform'); ?> </form> <?php endif; ?> <div class="footer_explanation"> <?php /** * Mirrored Welcart action hook * * @ignore */ do_action('usces_action_customer_page_footer'); ?> </div> </div> </article> <?php else : ?> <p><?php _e('Sorry, no posts matched your criteria.', 'usces'); ?></p> <?php endif; ?> </div> </div> <?php get_footer(); } /** * Loads customer page with login prompt for DLSeller items * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public function loadPage() { $this->email = $_SESSION['usces_entry']['customer']['mailaddress1']; if (isset($_POST['loginmail'])) { $this->email = $_POST['loginmail']; } $reqkey = WordPressRequestKeyRouteCollector::ROUTE_KEY; $currentRoute = isset($_REQUEST[$reqkey]) ? $_REQUEST[$reqkey] : ''; $redirect = isset($_REQUEST['wcexaapRedirect']) ? $_REQUEST['wcexaapRedirect'] : ''; $this->formAction = add_query_arg( [ $reqkey => rawurlencode($currentRoute), 'wcexaapRedirect' => rawurlencode($redirect), ], USCES_CART_URL ); $this->loadAssets(); $this->dlsellerLoginTemplate(); exit(); } }
- dlsellerLoginTemplate — Customer page with login prompt for DLSeller items
- hasExOrder — Returns true if a DLSeller item or auto delivery item is in the cart
- loadAssets — Loads CSS and JS assets for customer page
- loadPage — Loads customer page with login prompt for DLSeller items