2

Shopfiy開発者の皆さん、こんにちは。

API呼び出しによるnotes属性に問題があります。1か月前までは機能していましたが、その後は横向きになり始めました。構文は変更されましたか?これは、forループでエラーを返す私のコードのスニペットです。

エラーメッセージ「未定義のインデックス:foreach行のnote_attribute」

// Overwrite custom status field if it's defined in note-attributes
if(array_key_exists('note-attributes', $o))
{
    // For whatever reason, the note-attributes are formatted
    // differently if there's only one key => value pair
    // ( * see examples at end of this file )
    // If the note-attribute array has the key 'name' in it, it's just a single pair.
    // Otherwise, the note-attribute array would be numerically indexed with keys 0,1,2.. etc
    if(array_key_exists('name',$o['note-attributes']['note_attribute']))
    {
        if($o['note-attributes']['note_attribute']['name'] == "custom_status")
            $arr_tmp[7] = $o['note-attributes']['note_attribute']['value'] ;
    }
    else
    {
        foreach($o['note-attributes']['note_attribute'] as $na) //Fails here
        {
            if($na['name'] == "custom_status")
                $arr_tmp[7] = $na['value'] ;
        }
    }
}

あなたの助けは大歓迎です。ありがとうございました。

4

1 に答える 1

1

ここでの問題は、XML ノード構文の変更が原因でした。Shopifyには応答で に変更されたリグレッションがあり、元に戻されましたnote-attributesnote_attributes

于 2012-09-16T14:36:18.163 に答える