mcpField
S
sfcc-business-manager

sfcc-business-manager

github.com/finsilabsその他6078 回インストール6 日前に更新
リポジトリ

sfcc-business-manager について

sfcc-business-managerは、Business Managerを扱うSFCC管理者や開発者向けのガイドです。カタログやサイト設定、プロモーション、XMLによる一括入出力、ジョブのトラブルシューティングを説明します。

主な機能

  1. 01カタログと商品データの管理
  2. 02サイトプリファレンスの設定
  3. 03XMLで在庫と価格をインポート
  4. 04インポートジョブの設定と実行
  5. 05ジョブログの確認と問題調査

活用シーン

  1. 01新しいSFCCサイトのカタログを初期設定
  2. 02ERPやPIMから商品データをインポート
  3. 03カスタムカートリッジのサイト設定
  4. 04インポート失敗やジョブログを調査

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/finsilabs/awesome-ecommerce-skills --skill sfcc-business-manager

インストール後、Claude Code で/sfcc-business-managerを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

tile.json
evals/catalog-xml-structure-and-variation-prod/
criteria.json
task.md
evals/import-job-automation-via-webdav-and-job/
criteria.json
task.md
evals/site-preferences-xml-and-cartridge-acces/
criteria.json
task.md

詳細

SFCC ビジネスマネージャー

概要

ビジネスマネージャー(BM)は、https://{instance}.dx.commercecloud.salesforce.com/on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage からアクセスする SFCC の管理インターフェースです。カタログや商品管理、サイトの環境設定、プロモーションエンジン、コンテンツアセット、A/B テスト、ジョブのスケジュール設定など、SFCC インストールのあらゆる要素を管理します。一括データ操作は、Import & Export フレームワークを使用した XML のインポート/エクスポートで行います。このフレームワークは、スケジュールされたジョブを介して IMPEX ディレクトリ内のファイルを処理します。

このスキルを使用する場面

  • 新しい SFCC サイトの初期カタログ設定を行う場合
  • XML を介して ERP または PIM システムから商品、価格、在庫をインポートする場合
  • API クライアント登録用に OCAPI 設定を行う場合
  • カスタムカートリッジ設定用にサイトの環境設定を行う場合
  • サイト全体のプロモーション、クーポンキャンペーン、A/B テストを管理する場合
  • ビジネスマネージャーでジョブの失敗を診断したり、インポートエラーログを確認したりする場合

主な手順

  1. ビジネスマネージャーの主要なエリアに移動する

    ビジネスマネージャーの URL は、次のパターンに従います:{instanceUrl}/on/demandware.store/Sites-Site/default/{Controller-Action}

    # Site Selection (global)
    /on/demandware.store/Sites-Site/default/ViewApplication-DisplayWelcomePage
    
    # Catalog Management (site-specific)
    /on/demandware.store/Sites-{SiteID}/default/ViewCategories-Start
    
    # Site Preferences
    /on/demandware.store/Sites-{SiteID}/default/ViewSitePreference-StartGroups
    
    # OCAPI Settings
    /on/demandware.store/Sites-Site/default/ViewApplicationApiSettings-Start
    
    # Import & Export
    /on/demandware.store/Sites-{SiteID}/default/ViewJobSchedule-Start
    
    # Job Execution
    /on/demandware.store/Sites-Site/default/ViewJobSchedule-Start
    
  2. XML カタログインポートで商品をインポートする

    SFCC のカタログ XML は、Demandware の catalog.xsd スキーマに従います。商品はカタログオブジェクトとしてインポートされます:

    <?xml version="1.0" encoding="UTF-8"?>
    <catalog xmlns="http://www.demandware.com/xml/impex/catalog/2006-10-31" catalog-id="your-catalog">
    
      
      <category category-id="electronics">
        <display-name xml:lang="x-default">Electronics</display-name>
        <display-name xml:lang="en-US">Electronics</display-name>
        <online-flag>true</online-flag>
        <parent>root</parent>
      </category>
    
      
      <product product-id="PROD-001">
        <ean>1234567890123</ean>
        <upc>123456789012</upc>
        <display-name xml:lang="x-default">Wireless Headphones Pro</display-name>
        <display-name xml:lang="en-US">Wireless Headphones Pro</display-name>
        <long-description xml:lang="x-default">Premium wireless headphones with ANC</long-description>
        <online-flag>true</online-flag>
        <available-flag>true</available-flag>
        <searchable-flag>true</searchable-flag>
        <tax-class-id>standard</tax-class-id>
        <brand>AudioPro</brand>
        <manufacturer-sku>AP-WH-001</manufacturer-sku>
        <classification-category catalog-id="your-catalog">electronics</classification-category>
        <images>
          <image-group view-type="large">
            <image path="products/PROD-001-large.jpg"/>
          </image-group>
          <image-group view-type="small">
            <image path="products/PROD-001-small.jpg"/>
          </image-group>
        </images>
        <custom-attributes>
          <custom-attribute attribute-id="color">Black</custom-attribute>
          <custom-attribute attribute-id="batteryLife">30</custom-attribute>
        </custom-attributes>
      </product>
    
      
      <product product-id="SHIRT-MASTER">
        <display-name xml:lang="x-default">Classic Cotton Shirt</display-name>
        <online-flag>true</online-flag>
        <classification-category catalog-id="your-catalog">apparel</classification-category>
        <variations>
          <attributes>
            <variation-attribute attribute-id="color" variation-attribute-id="color">
              <display-name xml:lang="x-default">Color</display-name>
              <variation-attribute-values>
                <variation-attribute-value value="Blue">
                  <display-value xml:lang="x-default">Blue</display-value>
                </variation-attribute-value>
                <variation-attribute-value value="Red">
                  <display-value xml:lang="x-default">Red</display-value>
                </variation-attribute-value>
              </variation-attribute-values>
            </variation-attribute>
            <variation-attribute attribute-id="size" variation-attribute-id="size">
              <display-name xml:lang="x-default">Size</display-name>
              <variation-attribute-values>
                <variation-attribute-value value="S"><display-value xml:lang="x-default">S</display-value></variation-attribute-value>
                <variation-attribute-value value="M"><display-value xml:lang="x-default">M</display-value></variation-attribute-value>
                <variation-attribute-value value="L"><display-value xml:lang="x-default">L</display-value></variation-attribute-value>
              </variation-attribute-values>
            </variation-attribute>
          </attributes>
          <variants>
            <variant product-id="SHIRT-BLUE-S"/>
            <variant product-id="SHIRT-BLUE-M"/>
            <variant product-id="SHIRT-RED-M"/>
          </variants>
        </variations>
      </product>
    
      
      <product product-id="SHIRT-BLUE-S">
        <display-name xml:lang="x-default">Classic Cotton Shirt - Blue / S</display-name>
        <online-flag>true</online-flag>
        <variation-attribute-values>
          <variation-attribute-value attribute-id="color">Blue</variation-attribute-value>
          <variation-attribute-value attribute-id="size">S</variation-attribute-value>
        </variation-attribute-values>
      </product>
    
      
      <category-assignment category-id="electronics" product-id="PROD-001">
        <primary-flag>true</primary-flag>
      </category-assignment>
    </catalog>
    
  3. 在庫と価格をインポートする

    
    <?xml version="1.0" encoding="UTF-8"?>
    <inventory xmlns="http://www.demandware.com/xml/impex/inventory/2007-05-31">
      <inventory-list>
        <header list-id="your-inventory-list">
          <default-in-stock>false</default-in-stock>
          <description>Main Inventory</description>
        </header>
        <records>
          <record product-id="PROD-001">
            <allocation>150.00</allocation>
            <allocation-timestamp>2026-03-12T00:00:00.000Z</allocation-timestamp>
            <perpetual>false</perpetual>
            <preorderable>false</preorderable>
            <backorderable>false</backorderable>
          </record>
          <record product-id="SHIRT-BLUE-S">
            <allocation>42.00</allocation>
            <perpetual>false</perpetual>
          </record>
        </records>
      </inventory-list>
    </inventory>
    
    
    <?xml version="1.0" encoding="UTF-8"?>
    <pricebooks xmlns="http://www.demandware.com/xml/impex/pricebook/2006-10-31">
      <pricebook>
        <header pricebook-id="usd-m-list-prices">
          <currency>USD</currency>
          <display-name xml:lang="x-default">USD List Prices</display-name>
          <online-flag>true</online-flag>
        </header>
        <price-tables>
          <price-table product-id="PROD-001">
            <amount quantity="1">149.99</amount>
          </price-table>
          <price-table product-id="SHIRT-BLUE-S">
            <amount quantity="1">39.99</amount>
          </price-table>
        </price-tables>
      </pricebook>
    </pricebooks>
    
  4. カスタムカートリッジ設定用にサイトの環境設定を行う

    サイトの環境設定は、ビジネスマネージャー → Administration → Site Development → System Object Types → SitePreferences で定義するカスタム属性です:

    
    <?xml version="1.0" encoding="UTF-8"?>
    <metadata xmlns="http://www.demandware.com/xml/impex/metadata/2006-10-31">
      <type-extension type-id="SitePreferences">
        <custom-attribute-definitions>
          <attribute-definition attribute-id="myIntegration_apiEndpoint">
            <display-name xml:lang="x-default">My Integration API Endpoint</display-name>
            <type>string</type>
            <mandatory-flag>false</mandatory-flag>
            <externally-managed-flag>false</externally-managed-flag>
            <min-length>0</min-length>
            <max-length>255</max-length>
          </attribute-definition>
          <attribute-definition attribute-id="myIntegration_enabledFlag">
            <display-name xml:lang="x-default">My Integration Enabled</display-name>
            <type>boolean</type>
            <mandatory-flag>false</mandatory-flag>
          </attribute-definition>
        </custom-attribute-definitions>
        <group-definitions>
          <attribute-group group-id="MyIntegration">
            <display-name xml:lang="x-default">My Integration Settings</display-name>
            <attribute attribute-id="myIntegration_apiEndpoint"/>
            <attribute attribute-id="myIntegration_enabledFlag"/>
          </attribute-group>
        </group-definitions>
      </type-extension>
    </metadata>
    

    カートリッジの ISML/コントローラーでのアクセス方法:

    // In SFCC ISML controller (server-side JS)
    var Site = require('dw/system/Site');
    var currentSite = Site.getCurrent();
    
    var apiEndpoint = currentSite.getCustomPreferenceValue('myIntegration_apiEndpoint');
    var isEnabled = currentSite.getCustomPreferenceValue('myIntegration_enabledFlag');
    
  5. インポートジョブを設定して実行する

    SFCC のインポートジョブは、ビジネスマネージャー → Administration → Operations → Jobs で設定します。ジョブでは、/IMPEX/src/ に配置するか、Jobs API でアップロードした XML フィードファイルを使用します:

    // Upload an XML file to IMPEX via OCAPI WebDAV before triggering job
    const importFile = fs.readFileSync('./catalog.xml');
    
    // Upload via WebDAV (SFCC exposes IMPEX as WebDAV)
    const webdavUrl = `${instanceUrl}/on/demandware.servlet/webdav/Sites/Impex/src/catalog-import.xml`;
    
    await fetch(webdavUrl, {
      method: "PUT",
      headers: {
        Authorization: `Basic ${Buffer.from(`${clientId}:${clientSecret}`).toString("base64")}`,
        "Content-Type": "application/xml",
      },
      body: importFile,
    });
    
    // Trigger the import job via Jobs API
    const jobResponse = await fetch(
      `${instanceUrl}/s/-/dw/data/v23_2/jobs/sfcc-site-archive-import/executions`,
      {
        method: "POST",
        headers: {
          Authorization: `Bearer ${adminToken}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          parameters: [
            { name: "ImportFile", value: "catalog-import.xml" },
            { name: "catalogID", value: "your-catalog" },
          ],
        }),
      }
    );
    

例

ERP 同期用に注文をエクスポートする


// Paginated order export via OCAPI Data API
async function exportOrdersSince(sinceDate: string) {
  const token = await getAdminToken();
  const instanceUrl = process.env.SFCC_INSTANCE_URL!;
  const siteId = process.env.SFCC_SITE_ID!;

  let start = 0;
  const count = 100;
  const allOrders = [];

  while (true) {
    const response = await fetch(
      `${instanceUrl}/s/${siteId}/dw/data/v23_2/order_search`,
      {
        method: "POST",
        headers: {
          Authorization: `Bearer ${token}`,
          "Content-Type": "application/json",
        },
        body: JSON.stringify({
          query: {
            filtered_query: {
              query: { match_all_query: {} },
              filter: {
                range_filter: {
                  field: "creation_date",
                  from: sinceDate,
                },
              },
            },
          },
          select: "(**)",
          count,
          start,
          sorts: [{ field: "creation_date", sort_order: "asc" }],
        }),
      }
    );

    const { hits, total } = await response.json();
    allOrders.push(...(hits ?? []));
    start += count;
    if (start >= total) break;
  }

  return allOrders;
}
OCAPI でプロモーションを作成する
async function createPromotion(promo: {
  id: string;
  name: string;
  discountPercent: number;
  startDate: string;
  endDate: string;
}) {
  const token = await getAdminToken();
  const instanceUrl = process.env.SFCC_INSTANCE_URL!;
  const siteId = process.env.SFCC_SITE_ID!;

  await fetch(
    `${instanceUrl}/s/${siteId}/dw/data/v23_2/promotions/${promo.id}`,
    {
      method: "PUT",
      headers: {
        Authorization: `Bearer ${token}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        id: promo.id,
        name: { default: promo.name },
        enabled: true,
        start_date: promo.startDate,
        end_date: promo.endDate,
        discount: {
          type: "percentage",
          value: promo.discountPercent,
        },
        promotion_class: "order",
      }),
    }
  );
}

ベストプラクティス

  • アップロード前に、Demandware のスキーマに照らして XML インポートを検証してください — XSD ファイルはビジネスマネージャーの Administration → Site Development → System Object Types にあります。無効な XML は行単位のエラーメッセージなしで失敗します。
  • 同時インポートには一意のジョブ ID を使用してください — SFCC ではジョブ定義ごとにジョブはシングルスレッドで実行されます。カタログと在庫のインポートを並列で行う必要がある場合は、複数のジョブ定義を使用してください。
  • カタログ XML には必ず catalog-id を含めてください — カタログ ID が一致しない、または欠落していると、商品が誤ったカタログにインポートされたり、インポートが完全に失敗したりします。
  • 本番環境の前にステージング環境でインポートをテストしてください — カタログインポートには一括で取り消す機能がありません。まず少数のデータでテストしてください。
  • BM → Administration → Operations → Jobs でジョブログを監視してください — 失敗したジョブのログは /IMPEX/log/ に記録されます。自動インポートの直後にログをダウンロードして確認してください。
  • すべてのローカライズ文字列に <display-name xml:lang="x-default"> を使用してください — x-default ロケールは必須です。これがないと、すべてのロケールで表示に問題が発生します。
  • サイトの環境設定は手動ではなく、インポート XML で設定してください — 環境間の一貫性を保つため、すべてのカスタムサイト環境設定値をバージョン管理にコミットする XML ファイルに記録してください。

よくある問題

問題解決方法
商品をインポートしたが、ストアフロントに表示されない商品の online-flag が true であること、カテゴリの割り当てで primary-flag が設定されていること、サイトカタログが現在のサイトに割り当てられていることを確認します
インポートジョブが完了したが、ログに「処理済みレコード数:0」と表示されるファイルが正しい IMPEX パスにアップロードされていることと、ジョブの ImportFile パラメーターに拡張子を含む正確なファイル名が指定されていることを確認します
カスタムサイト設定が BM UI に表示されないsystem-objecttype-extensions.xml が BM → 管理 → サイト開発 → インポートとエクスポートからインポートされていること、キャッシュがクリアされていることを確認します
インポートは成功しているのに在庫が更新されないXML の inventory-list の list-id が、BM → マーチャントツール → 商品とカタログでサイトに割り当てられた在庫リストと一致していることを確認します
OCAPI Data API がジョブの実行時に 403 を返すクライアント ID に jobs リソースの Data API 権限が必要です。BM → 管理 → サイト開発 → OCAPI 設定 → Data で確認します
インポートした価格表ではなく、デフォルトのカタログ価格が表示されるBM → マーチャントツール → 価格設定 → 価格表で、価格表をサイトの顧客グループに割り当てます。インポートした価格表は、割り当てるまで有効になりません

関連スキル

  • @sfcc-cartridge-development
  • @sfcc-ocapi-scapi
  • @catalog-management
  • @product-import-export
  • @promotion-engine

コメント