• プラグイン一覧
    - 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-item-combo-set > クラス > ItemPage
レファレンス
バージョン
1.0.6
絞り込み:

目次

  • ソース
  • 関数

フック

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

ファンクション

    クラス

    ItemPage

    商品詳細ページ HTML and JS

    ソース #ソース

    ファイル: src/Pages/ItemPage/ItemPage.php

    class ItemPage
    {
        /**
         * Initializes item page
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @return void
         */
        public static function init() {
            (new ConditionalAssetsLoader())->loadItemPageAssets(function () {
                $loadcore = apply_filters('wcexics_filter_load_item_page_default_css', true);
                if ($loadcore === true) {
                    Loader::loadCoreCss();
                    wp_enqueue_style(
                        'wcexics-item-page',
                        WCEXICS_PLUGIN_URL . '/src/Pages/ItemPage/item-page.css',
                        [],
                        WCEXICS_VERSION
                    );
                }
                wp_enqueue_script(
                    'wcexics-item-page',
                    WCEXICS_DIST_JS_URL . '/item-page.js',
                    [],
                    WCEXICS_VERSION,
                    true
                );
                do_action('wcexics_load_item_page_assets');
            });
    
            add_action('usces_theme_item_single_before_options', 'wcexics_combo_set_form');
            add_filter('usces_filter_item_sku_button', [get_class(), 'filterAddToCartButton'], 10, 1);
        }
    
        /**
         * Replaces `Add to Cart` input name with `wcexicsAddToCart` for custom processing
         *
         * @author Evan D Shaw <evandanielshaw@gmail.com>
         * @global \usc_e_shop $usces
         * @global \WP_Post $post
         * @param string $html
         * @return string
         */
        public static function filterAddToCartButton($html) {
            global $usces, $post;
    
            $comboset = ComboSet::getComboSetFromSkuCode($post->ID, $usces->itemsku['code']);
            if ($comboset instanceof GenericError) {
                return $html;
            }
    
            if (empty($comboset->getGroups())) {
                return $html;
            }
    
            $empty = true;
            foreach ($comboset->getGroups() as $group) {
                if (!empty($group->getItems())) {
                    $empty = false;
                    break;
                }
            }
    
            if ($empty === true) {
                return $html;
            }
    
            $id = $comboset->getId();
            $html = preg_replace('/name="inCart/', 'data-combo-set-id="' . $id . '" name="wcexicsAddToCart', $html);
            return $html;
        }
    }
    

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


    関数 #関数

    Top ↑

    • filterAddToCartButton — Replaces `Add to Cart` input name with `wcexicsAddToCart` for custom processing
    • init — Initializes item page

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

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

    ※Amazon、Amazon.co.jp、Amazon Payおよびそれらのロゴは、Amazon.com,inc.またはその関連会社の商標です。

    © 2025 Aivec llc All Rights Reserved.