• プラグイン一覧
    - WCEX Item Combo Set
    - WCEX Amazon Pay
    - WCEX Wishlist お気に入りリスト
  • リリース情報
  • お役立ちコラム
  • お問い合わせ
  • サポート
    • よくある質問
      • WCEX Amazon Pay
      • WCEX Wishlist お気に入りリスト
      • wcex-item-combo-set
    • リファレンス
      • WCEX Amazon Pay
      • WCEX Wishlist お気に入りリスト
      • wcex-item-combo-set
新規会員登録
ログイン
新規会員登録
ログイン
カート
  • プラグイン一覧
    • - WCEX Item Combo Set
    • - WCEX Amazon Pay
    • - WCEX Wishlist お気に入りリスト
  • リリース情報
  • お役立ちコラム
  • サポート
    • - よくある質問
      • - WCEX Amazon Pay
      • - WCEX Wishlist お気に入りリスト
      • - wcex-item-combo-set
    • - リファレンス
      • - WCEX Amazon Pay
      • - WCEX Wishlist お気に入りリスト
      • - wcex-item-combo-set
  • お問い合わせ
Aivec APPs > WCEX Amazon Pay > クラス > Container
レファレンス
バージョン
2.6.4
絞り込み:

目次

  • ソース
  • 関数

フック

  • アクション
  • フィルター

ファンクション

    クラス

    Container

    Checkout review page.

    ソース #ソース

    ファイル: src/Components/CheckoutReview/Container.php

    abstract class Container
    {
    
        /**
         * Slug name for our entry js script
         */
        const ENTRY_SCRIPT_SLUG = 'wcex-checkout-review';
    
        /**
         * Array of child components
         *
         * @var VueComponentLoader[]
         */
        public $childComponents;
    
        /**
         * AmazonPay module instance
         *
         * @var AmazonPay
         */
        protected $module;
    
        /**
         * Initializes member model var and registers hooks for quickpay page
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param AmazonPay $module
         */
        public function __construct(AmazonPay $module) {
            $this->module = $module;
        }
    
        /**
         * Instantiates child components
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        public function buildComponents() {
            $opts = $this->module->getActingOpts();
            $mmeta = !empty($_SESSION['usces_member']['ID']) ? new MemberMeta((int)$_SESSION['usces_member']['ID']) : -1;
            $buyerEmail = $_SESSION['amazonCheckoutSession']['buyer']['email'];
            $welcartEmail = !empty($_SESSION['usces_member']['mailaddress1']) ? $_SESSION['usces_member']['mailaddress1'] : '';
            $loadCouponForm = false;
            if (defined('WCEX_COUPON')) {
                $wccp = get_option('wccp');
                if ($wccp['front_display'] === '0' || ($wccp['front_display'] === '1' && usces_is_login())) {
                    $loadCouponForm = true;
                }
            }
            $loadPointsForm = usces_is_member_system() && usces_is_member_system_point() && usces_is_login() && usces_is_available_point();
            $loadGiftForm = !usces_is_login();
    
            $amazonCheckoutDetailsComponent = $this->getAmazonCheckoutDetailsComponent();
            $purchaseButtonComponent = $this->getPurchaseButtonComponent();
    
            $this->childComponents = [
                'orderSummary' => new VueComponentLoader(
                    new Components\OrderSummary\OrderSummary(),
                    $this->filterLoadOrderSummary(true)
                ),
                'pointsForm' => new VueComponentLoader(
                    new Components\PointsForm\PointsForm(),
                    $this->filterLoadPointsForm($loadPointsForm)
                ),
                'couponForm' => new VueComponentLoader(
                    new Components\CouponForm\CouponForm(),
                    $this->filterLoadCouponForm($loadCouponForm)
                ),
                'deliveryForm' => new VueComponentLoader(
                    new Components\DeliveryForm\DeliveryForm(),
                    $this->filterLoadDeliveryForm(true)
                ),
                'notesForm' => new VueComponentLoader(
                    new Components\Notes\Notes(),
                    $this->filterLoadNotesForm($opts['quickpay_notes_field'] === 'on')
                ),
                'giftForm' => new VueComponentLoader(
                    new Components\GiftForm\GiftForm(),
                    $this->filterLoadGiftForm($loadGiftForm)
                ),
                'customCustomerFields' => new VueComponentLoader(
                    new Components\CustomFields\CustomFields([
                        'ident' => 'customer',
                        'template' => 'welcart',
                        /**
                         * Filters whether or not error messages show directly above each カスタム・フィールド on
                         * the Quickpay checkout review page
                         *
                         * Used for all 4 custom field types:
                         * - カスタム・カスタマーフィールド
                         * - カスタム・デリバリーフィールド
                         * - カスタム・オーダーフィールド
                         * - カスタム・メンバーフィールド
                         *
                         * @param bool $flag Default: `false`
                         */
                        'display_errors' => apply_filters('wcexaap_checkout_review_filter_display_custom_fields_errors', false),
                    ]),
                    $this->filterLoadCustomCustomerFields(!usces_is_login())
                ),
                'customOrderFields' => new VueComponentLoader(
                    new Components\CustomFields\CustomFields([
                        'ident' => 'order',
                        'template' => 'welcart',
                        /**
                         * Filters whether or not error messages show directly above each カスタム・フィールド on
                         * the Quickpay checkout review page
                         *
                         * Used for all 4 custom field types:
                         * - カスタム・カスタマーフィールド
                         * - カスタム・デリバリーフィールド
                         * - カスタム・オーダーフィールド
                         * - カスタム・メンバーフィールド
                         *
                         * @param bool $flag Default: `false`
                         */
                        'display_errors' => apply_filters('wcexaap_checkout_review_filter_display_custom_fields_errors', false),
                    ]),
                    $this->filterLoadCustomOrderFields($opts['quickpay_custom_order_fields'] === 'on')
                ),
                'customDeliveryFields' => new VueComponentLoader(
                    new Components\CustomFields\CustomFields([
                        'ident' => 'delivery',
                        'template' => 'welcart',
                        /**
                         * Filters whether or not error messages show directly above each カスタム・フィールド on
                         * the Quickpay checkout review page
                         *
                         * Used for all 4 custom field types:
                         * - カスタム・カスタマーフィールド
                         * - カスタム・デリバリーフィールド
                         * - カスタム・オーダーフィールド
                         * - カスタム・メンバーフィールド
                         *
                         * @param bool $flag Default: `false`
                         */
                        'display_errors' => apply_filters('wcexaap_checkout_review_filter_display_custom_fields_errors', false),
                    ]),
                    $this->filterLoadCustomDeliveryFields($opts['quickpay_custom_delivery_fields'] === 'on')
                ),
                'amazonCheckoutDetails' => new VueComponentLoader($amazonCheckoutDetailsComponent, true),
                'purchaseButton' => new VueComponentLoader($purchaseButtonComponent, true),
                'registerWithAmazonForm' => new VueComponentLoader(
                    new Components\RegisterWithAmazon\RegisterWithAmazon(),
                    !usces_is_login()
                ),
                'linkMembersToAmazonForm' => new VueComponentLoader(
                    new Components\LinkMembersToAmazon\LinkMembersToAmazon(),
                    // Amazonアカウントと連携していない場合、チェックボックスを表示する。
                    usces_is_login() && $mmeta->getAllowAmazonToWelcartLogin() === false && ($buyerEmail === $welcartEmail)
                ),
            ];
        }
    
        /**
         * Load page and assets then exit
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        public function loadPage() {
            $this->buildComponents();
            add_action('wcexaap_checkout_review_template', [$this, 'containerTemplate']);
            add_action('wp_enqueue_scripts', [$this, 'enqueueAssets']);
    
            usces_get_entries();
            usces_get_carts();
            usces_get_members();
    
            $this->beforeTemplateInclude();
    
            $parent_path = get_template_directory() . '/wc_templates';
            $child_path = get_stylesheet_directory() . '/wc_templates';
            $plugins_url_path = WP_PLUGIN_DIR . '/wcex-amazonpay/templates';
            $theme_template = wp_get_theme()->template;
            // TCD Welcartの場合、プラグイン内のファイルを取り込む
            if (file_exists($child_path . '/cart/wc_amazon_quickpay_page.php')) {
                include($child_path . '/cart/wc_amazon_quickpay_page.php');
            } elseif (file_exists($parent_path . '/cart/wc_amazon_quickpay_page.php') && !defined('USCES_PARENT_LOAD')) {
                include($parent_path . '/cart/wc_amazon_quickpay_page.php');
            } elseif ($theme_template === 'glamour_tcd073') {
                include($plugins_url_path . '/glamour_tcd073/cart/wc_amazon_quickpay_page.php');
            } elseif ($theme_template === 'ego_welcart_tcd079') {
                include($plugins_url_path . '/ego_welcart_tcd079/cart/wc_amazon_quickpay_page.php');
            } elseif ($theme_template === 'iconic_tcd062') {
                include($plugins_url_path . '/iconic_tcd062/cart/wc_amazon_quickpay_page.php');
            } else {
                echo $this->getPageTemplate();
            }
    
            $this->afterTemplateInclude();
            exit;
        }
    
        /**
         * Enqueues necessary assets
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @global \usc_e_shop $usces
         * @return void
         */
        public function enqueueAssets() {
            Theme::enqueueThemeCss(WCEXAAP_PLUGIN_URL);
            wp_enqueue_style(
                self::ENTRY_SCRIPT_SLUG,
                WCEXAAP_PLUGIN_URL . '/src/Components/CheckoutReview/style.css',
                [],
                WCEXAAP_VERSION
            );
    
            // scripts
            wp_enqueue_script(
                self::ENTRY_SCRIPT_SLUG,
                WCEXAAP_PLUGIN_URL . '/dist/checkoutReview.js',
                [],
                WCEXAAP_VERSION,
                true
            );
            $this->loadCustomAssets();
            /**
             * Fires after enqueuing CSS and JS for the Quickpay page
             *
             * Use this hook to load custom CSS or JS on the Quickpay page
             *
             * @important
             */
            do_action('wcexaap_quickpay_custom_assets');
    
            wp_set_script_translations(self::ENTRY_SCRIPT_SLUG, 'wcexaap', WCEXAAP_LANGDIR);
            wp_localize_script(self::ENTRY_SCRIPT_SLUG, AmazonPay::L10N, $this->makeJSvars());
        }
    
        /**
         * Javascript variables to be sent into script(s)
         *
         * @return array
         */
        public function makeJSvars() {
            $entries = new API\WelcartEntries();
            $jsvars = [];
            $jsvars['order'] = $entries->getOrder();
            $jsvars['childComponents'] = $this->childComponents;
            $jsvars = $this->filterJSVars($jsvars);
            $jsvars = array_merge($jsvars, $this->module->getScriptInjectionVariables());
    
            return $jsvars;
        }
    
        /**
         * Loads components inside `#cart` div
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        protected function loadCartComponents() {
            $order = [
                'orderSummary',
                'pointsForm',
                'couponForm',
                'deliveryForm',
                'customDeliveryFields',
                'customCustomerFields',
                'customOrderFields',
                'notesForm',
                'giftForm',
            ];
            $order = $this->filterCartComponentsOrder($order);
            foreach ($order as $compname) {
                $this->childComponents[$compname]->templateIfLoad();
            }
        }
    
        /**
         * Loads components above `#info-confirm` div
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        protected function loadConfirmComponents() {
            $order = [
                'amazonCheckoutDetails',
                'purchaseButton',
                'registerWithAmazonForm',
                'linkMembersToAmazonForm',
            ];
            $order = $this->filterConfirmComponentsOrder($order);
            foreach ($order as $compname) {
                $this->childComponents[$compname]->templateIfLoad();
            }
        }
    
        /**
         * Template HTML
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return string
         */
        public function getPageTemplate() {
            /**
             * Filters whether or not to call `get_header()` and `get_footer()` on the Quickpay page
             *
             * *This filter will not run for themes using their own `wc_amazon_quickpay_page.php`
             * template file*
             *
             * @param bool $flag Default: `true`
             */
            $withHeaderFooter = apply_filters('wcexaap_filter_checkout_review_template_header_footer_flag', true);
            ob_start();
            if ($withHeaderFooter === true) {
                get_header();
            }
            ?>
            <div id="primary" class="site-content">
                <div id="content" class="cart-page" role="main">
                    <?php if (have_posts()) :
                        usces_remove_filter(); ?>
    
                        <article class="post" id="wc_confirm">
                            
                            <?php
                            /**
                             * Used to load all Vue components on the Quickpay page
                             */
                            do_action('wcexaap_checkout_review_template');
                            ?>
    
                        </article>
    
                    <?php else : ?>
                        <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
                    <?php endif; ?>
                </div>
            </div>
            <?php
            if ($withHeaderFooter === true) {
                get_footer();
            }
            $template = ob_get_clean();
    
            /**
             * Filters all Quickpay page HTML
             *
             * *This filter will not run for themes using their own `wc_amazon_quickpay_page.php`
             * template file*
             *
             * @param string                                                                         $template
             * @param \Aivec\Welcart\SettlementModules\AmazonPay\Components\CheckoutReview\Container $instance
             */
            return apply_filters('wcexaap_filter_checkout_review_template', $template, $this);
        }
    
        /**
         * Prints container wrapper with components for checkout review page
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        public function containerTemplate() {
            /**
             * Filters the HTML id name for the div that wraps the `checkout_review` Vue app
             *
             * @param string $wrapperid Default: `quickpay_wrapper`
             */
            $wrapperid = apply_filters('wcexaap_filter_quickpay_wrapper_div_id', 'quickpay_wrapper');
            ?>
            <div id="<?php echo esc_attr($wrapperid); ?>">
                <div id="checkout_review" class="wcexaap">
                    <div id="info-confirm">
                        <h1 class="cart_page_title"><?php _e('Confirmation', 'usces'); ?></h1>
    
                        <div class="confiem_notice">
                            <?php _e('Please do not change product addition and amount of it with the other window with displaying this page.', 'usces'); ?>
                        </div>
    
                        <div class="header_explanation">
                            <?php
                            /**
                             * Mirrored Welcart action hook
                             *
                             * @ignore
                             */
                            do_action('usces_action_confirm_page_header');
                            ?>
                            <?php echo $this->filterTemplateTopErrorMessage(''); ?>
                        </div>
    
                        <?php
                        /**
                         * Mirrored Welcart action hook
                         *
                         * @ignore
                         */
                        do_action('usces_action_delivery_page_inform');
                        ?>
                        <div id="cart">
                            <?php $this->loadCartComponents(); ?>
                        </div>
                        <?php $this->loadConfirmComponents(); ?>
                        <div class="footer_explanation">
                            <?php echo $this->filterTemplateBottomErrorMessage(''); ?>
                            <?php
                            /**
                             * Mirrored Welcart action hook
                             *
                             * @ignore
                             */
                            do_action('usces_action_confirm_page_footer');
                            ?>
                        </div>
                    </div>
                </div>
            </div>
            <?php
        }
    
        /**
         * Should return an instance of `AmazonCheckoutDetails`
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return Components\AmazonCheckoutDetails\AmazonCheckoutDetails
         */
        abstract protected function getAmazonCheckoutDetailsComponent();
    
        /**
         * Should return an instance of `VueComponent`
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return VueComponent
         */
        abstract protected function getPurchaseButtonComponent();
    
        /**
         * Executes before template file has been included
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        protected function beforeTemplateInclude() {
        }
    
        /**
         * Executes after template file has been included
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        protected function afterTemplateInclude() {
        }
    
        /**
         * Filters whether to load `deliveryForm` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadDeliveryForm($load) {
            return $load;
        }
    
        /**
         * Filters whether to load `notesForm` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadNotesForm($load) {
            return $load;
        }
    
        /**
         * Filters whether to load `giftForm` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadGiftForm($load) {
            return $load;
        }
    
        /**
         * Filters whether to load `pointsForm` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadPointsForm($load) {
            return $load;
        }
    
        /**
         * Filters whether to load `couponForm` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadCouponForm($load) {
            return $load;
        }
    
        /**
         * Filters whether to load `orderSummary` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadOrderSummary($load) {
            return $load;
        }
    
        /**
         * Filters whether to load `customCustomerFields` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadCustomCustomerFields($load) {
            return $load;
        }
    
        /**
         * Filters whether to load `customOrderFields` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadCustomOrderFields($load) {
            return $load;
        }
    
        /**
         * Filters whether to load `customDeliveryFields` component or not
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param bool $load
         * @return bool
         */
        protected function filterLoadCustomDeliveryFields($load) {
            return $load;
        }
    
        /**
         * Filters script injection variables
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param array $jsvars
         * @return array
         */
        protected function filterJSVars(array $jsvars) {
            return $jsvars;
        }
    
        /**
         * Filters order of top components
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param array $order
         * @return array
         */
        protected function filterConfirmComponentsOrder(array $order) {
            return $order;
        }
    
        /**
         * Filters order of cart components
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param array $order
         * @return array
         */
        protected function filterCartComponentsOrder(array $order) {
            return $order;
        }
    
        /**
         * Filters error message displayed at the top of the page
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param string $emessage
         * @return string
         */
        public function filterTemplateTopErrorMessage($emessage) {
            return $emessage;
        }
    
        /**
         * Filters error message displayed at the bottom of the page
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @param string $emessage
         * @return string
         */
        public function filterTemplateBottomErrorMessage($emessage) {
            return $emessage;
        }
    
        /**
         * Invoked after scripts and styles are enqueued
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        protected function loadCustomAssets() {
        }
    }
    

    ソースを伸ばす ソースを縮める


    関数 #関数

    Top ↑

    • __construct — Initializes member model var and registers hooks for quickpay page
    • afterTemplateInclude — Executes after template file has been included
    • beforeTemplateInclude — Executes before template file has been included
    • buildComponents — Instantiates child components
    • containerTemplate — Prints container wrapper with components for checkout review page
    • enqueueAssets — Enqueues necessary assets
    • filterCartComponentsOrder — Filters order of cart components
    • filterConfirmComponentsOrder — Filters order of top components
    • filterJSVars — Filters script injection variables
    • filterLoadCouponForm — Filters whether to load `couponForm` component or not
    • filterLoadCustomCustomerFields — Filters whether to load `customCustomerFields` component or not
    • filterLoadCustomDeliveryFields — Filters whether to load `customDeliveryFields` component or not
    • filterLoadCustomOrderFields — Filters whether to load `customOrderFields` component or not
    • filterLoadDeliveryForm — Filters whether to load `deliveryForm` component or not
    • filterLoadGiftForm — Filters whether to load `giftForm` component or not
    • filterLoadNotesForm — Filters whether to load `notesForm` component or not
    • filterLoadOrderSummary — Filters whether to load `orderSummary` component or not
    • filterLoadPointsForm — Filters whether to load `pointsForm` component or not
    • filterTemplateBottomErrorMessage — Filters error message displayed at the bottom of the page
    • filterTemplateTopErrorMessage — Filters error message displayed at the top of the page
    • getAmazonCheckoutDetailsComponent — Should return an instance of `AmazonCheckoutDetails`
    • getPageTemplate — Template HTML
    • getPurchaseButtonComponent — Should return an instance of `VueComponent`
    • loadCartComponents — Loads components inside `#cart` div
    • loadConfirmComponents — Loads components above `#info-confirm` div
    • loadCustomAssets — Invoked after scripts and styles are enqueued
    • loadPage — Load page and assets then exit
    • makeJSvars — Javascript variables to be sent into script(s)

    • 新規会員登録
    • ログイン
      • プラグイン一覧
      • 会社概要
      • リリース情報
      • よくある質問
      • お役立ちコラム
      • お問い合わせ
      • 個人情報保護方針
      • 特定商取引法に基づく表記
      • 情報セキュリティ基本方針
      • 利用規約

    アイベック合同会社は「Welcart」「Amazon Pay」の公式パートナーです。

    ※Amazon、Amazon.co.jp、Amazon Payおよびそれらのロゴは、Amazon.com,inc.またはその関連会社の商標です。
    ※LINE Pay、およびLINE Pay 提携サービスのロゴは、法律上保護を受ける商標です。

    © 2025 Aivec llc All Rights Reserved.