2

如何使用简单的饼图从下面的 s:variant 块中获取标题标签?

<s:variant>
  <id>product_variants-96590662</id>
  <title>Default Title</title>
  <s:price currency="GBP">10.00</s:price>
  <s:sku>002</s:sku>
  <s:grams>0</s:grams>
</s:variant>

我尝试了以下方法,以及“变体”和“s”

$caption = $item->get_item_tags('http://www.w3.org/2005/Atom', 's:variant');

有问题的提要在这里(来自 shopify),get_item_tags 上的文档在这里

4

1 回答 1

3

s您可以从<feed>标签中读取 xml 命名空间。

<feed xmlns:s="http://jadedpixel.com/-/spec/shopify" xml:lang="en-US" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/" xmlns="http://www.w3.org/2005/Atom">

根据它,您必须在 中http://jadedpixel.com/-/spec/shopify用作命名空间参数get_item_tags(),第二个参数是不带s:.

$varinat = $item->get_item_tags('http://jadedpixel.com/-/spec/shopify', 'variant');
于 2011-06-03T15:33:59.050 回答