• プラグイン一覧
    - 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 Wishlist お気に入りリスト > クラス > Store
レファレンス
バージョン
3.1.6
絞り込み:
目的から探す
お気に入りデータを取得 お気に入りページのHTMLを取得 スナックバーアラート

目次

  • ソース
  • 関数

フック

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

ファンクション

  • データ取得
  • ユーティリティー
  • 条件判断
  • 表示系

クラス

Store

Error codes and corresponding messages

ソース #ソース

ファイル: src/Error/Store.php

class Store extends ErrorStore
{
    const WPDB_INTERNAL_ERROR = 'WpdbInternalError';
    const NOT_LOGGED_IN = 'NotLoggedIn';
    const WISHLIST_ITEM_NOT_FOUND = 'WishlistItemNotFound';
    const POST_IN_TRASH = 'PostInTrash';
    const ITEM_DELETED = 'ItemDeleted';
    const ITEM_SOLD_OUT = 'ItemSoldOut';
    const PER_PURCHASE_LIMIT_EXCEEDED = 'PerPurchaseLimitExceeded';
    const QUANT_EXCEEDS_STOCK_LIMIT = 'QuantExceedsStockLimit';
    const REQUIRED_FIELDS_MISSING = 'RequiredFieldsMissing';
    const REQUIRED_OPTIONS_MISSING = 'RequiredOptionsMissing';
    const UNSERIALIZATION_ERROR = 'UnserializationError';
    const SERIALIZED_ITEM_IS_MALFORMED = 'SerializedItemIsMalformed';
    const ITEM_OPTIONS_INVALID = 'ItemOptionsInvalid';
    const CONTINUE_CHARGE_REQUIRES_EMPTY_CART = 'ContinueChargeRequiresEmptyCart';
    const CART_CONTAINS_CONTINUE_CHARGE = 'CartContainsContinueCharge';
    const CANNOT_PROCESS_IN_BATCH_OP = 'CannotProcessInBatchOp';

    /**
     * Declares all `GenericError` objects
     *
     * @author Evan D Shaw <evandanielshaw@gmail.com>
     * @return void
     */
    public function populate() {
        $defaultError = $this->getErrorCodeMap()[parent::INTERNAL_SERVER_ERROR];
        $defaultMessage = $defaultError->message;

        $this->addError(new GenericError(
            self::WPDB_INTERNAL_ERROR,
            $this->getConstantNameByValue(self::WPDB_INTERNAL_ERROR),
            500,
            __('A wpdb method failed during execution. Wpdb most likely had a problem connecting to the database.', 'wcexwl'),
            $defaultMessage
        ));

        $this->addError(new GenericError(
            self::NOT_LOGGED_IN,
            $this->getConstantNameByValue(self::NOT_LOGGED_IN),
            401,
            __('You are logged out. Please login and try again.', 'wcexwl'),
            __('You are logged out. Please login and try again.', 'wcexwl')
        ));

        $this->addError(new GenericError(
            self::WISHLIST_ITEM_NOT_FOUND,
            $this->getConstantNameByValue(self::WISHLIST_ITEM_NOT_FOUND),
            404,
            function ($id) {
                // translators: ID of the wishlist item
                return sprintf(__('A wishlist item with ID 「%d」 does not exist.', 'wcexwl'), $id);
            },
            __('Wishlist item not found. Did you delete it in a different tab?', 'wcexwl')
        ));

        $isom = function ($sku) {
            // translators: SKU of the wishlist item
            return sprintf(__('%s is sold out.', 'wcexwl'), $sku);
        };
        $this->addError(new GenericError(
            self::ITEM_SOLD_OUT,
            $this->getConstantNameByValue(self::ITEM_SOLD_OUT),
            400,
            $isom,
            $isom
        ));

        $perpm = function ($itemRestriction, $sku) {
            return sprintf(
                // translators: 1. per purchase limit 2. SKU of the wishlist item
                __('This article is limited by %1$d at a time for %2$s.', 'wcexwl'),
                (int)$itemRestriction,
                $sku
            );
        };
        $this->addError(new GenericError(
            self::PER_PURCHASE_LIMIT_EXCEEDED,
            $this->getConstantNameByValue(self::PER_PURCHASE_LIMIT_EXCEEDED),
            400,
            $perpm,
            $perpm
        ));

        $qeslm = function ($sku, $checkstock) {
            // translators: 1. SKU of wishlist item 2. number of stock remaining
            return sprintf(__('%1$s only has %2$d stock remaining.', 'wcexwl'), $sku, (int)$checkstock);
        };
        $this->addError(new GenericError(
            self::QUANT_EXCEEDS_STOCK_LIMIT,
            $this->getConstantNameByValue(self::QUANT_EXCEEDS_STOCK_LIMIT),
            400,
            $qeslm,
            $qeslm
        ));

        $this->addError(new GenericError(
            self::POST_IN_TRASH,
            $this->getConstantNameByValue(self::POST_IN_TRASH),
            404,
            function ($id) {
                // translators: post ID of the item
                return sprintf(__('The item with post ID 「%d」 has been trashed.', 'wcexwl'), $id);
            },
            function ($sku = '') {
                // translators: SKU of the item
                return sprintf(__('%s is no longer for sale.', 'wcexwl'), $sku);
            }
        ));

        $this->addError(new GenericError(
            self::ITEM_DELETED,
            $this->getConstantNameByValue(self::ITEM_DELETED),
            404,
            function ($id) {
                // translators: post ID of the item
                return sprintf(__('The item with post ID 「%d」 has been deleted.', 'wcexwl'), $id);
            },
            function ($sku = '') {
                // translators: SKU of the item
                return sprintf(__('%s is no longer for sale.', 'wcexwl'), $sku);
            }
        ));

        $this->addError(new GenericError(
            self::REQUIRED_FIELDS_MISSING,
            $this->getConstantNameByValue(self::REQUIRED_FIELDS_MISSING),
            400,
            function ($field) {
                return 'The field "' . $field . '" is required.';
            },
            function ($message) {
                return $message;
            }
        ));

        $this->addError(new GenericError(
            self::REQUIRED_OPTIONS_MISSING,
            $this->getConstantNameByValue(self::REQUIRED_OPTIONS_MISSING),
            400,
            function ($message) {
                return $message;
            },
            function ($message) {
                return $message;
            }
        ));

        $this->addError(new GenericError(
            self::UNSERIALIZATION_ERROR,
            $this->getConstantNameByValue(self::UNSERIALIZATION_ERROR),
            400,
            function ($serial) {
                // translators: the string that could not be unserialized
                return sprintf(__('The following string could not be unserialized: %s', 'wcexwl'), (string)$serial);
            },
            $defaultMessage
        ));

        $this->addError(new GenericError(
            self::SERIALIZED_ITEM_IS_MALFORMED,
            $this->getConstantNameByValue(self::SERIALIZED_ITEM_IS_MALFORMED),
            400,
            __('The serialized item is missing required fields', 'wcexwl'),
            $defaultMessage
        ));

        $mcallback = function ($sku) {
            // translators: SKU of the item
            return sprintf(__('Options have changed for %s. Please add to cart from the item page.', 'wcexwl'), $sku);
        };
        $this->addError(new GenericError(
            self::ITEM_OPTIONS_INVALID,
            $this->getConstantNameByValue(self::ITEM_OPTIONS_INVALID),
            400,
            $mcallback,
            $mcallback
        ));

        $this->addError(new GenericError(
            self::CONTINUE_CHARGE_REQUIRES_EMPTY_CART,
            $this->getConstantNameByValue(self::CONTINUE_CHARGE_REQUIRES_EMPTY_CART),
            409,
            function ($message) {
                return $message;
            },
            function ($message) {
                return $message;
            }
        ));

        $this->addError(new GenericError(
            self::CART_CONTAINS_CONTINUE_CHARGE,
            $this->getConstantNameByValue(self::CART_CONTAINS_CONTINUE_CHARGE),
            409,
            function ($message) {
                return $message;
            },
            function ($message) {
                return $message;
            }
        ));

        $mcallback = function ($itemname) {
            // translators: name of the item
            return sprintf(__('%s cannot be processed in a batch operation.', 'wcexwl'), $itemname);
        };
        $this->addError(new GenericError(
            self::CANNOT_PROCESS_IN_BATCH_OP,
            $this->getConstantNameByValue(self::CANNOT_PROCESS_IN_BATCH_OP),
            422,
            $mcallback,
            $mcallback
        ));
    }
}

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


関数 #関数

Top ↑

  • populate — Declares all `GenericError` objects

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

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

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

© 2025 Aivec llc All Rights Reserved.