Importing price from XML (use first price)

Closed

Import WP Pro Updated 1 month ago 2 Replies

Ioan asked 2 months ago on November 26, 2024 at 10:27 pm

I\\\\\\\’m trying to import the price for a product. The XML looks like this:

  • <Price>
    • <PriceType>
      • 02
    • <DiscountCoded>
      • <DiscountCodeType>
        • 02
      • <DiscountCodeTypeName>
        • BCW Item Group Discount Code
      • <DiscountCode>
        • BCWG04
    • <DiscountCoded>
      • <DiscountCodeType>
        • 01
      • <DiscountCodeTypeName>
        • BIC discount group code
      • <DiscountCode>
        • ABCOW04
    • <PriceAmount>
      • 4.2
    • <Tax>
      • <TaxType>
        • 01
      • <TaxRateCode>
        • S
      • <TaxRatePercent>
        • 20.0
      • <TaxableAmount>
        • 3.5
      • <TaxAmount>
        • 0.7
    • <CurrencyCode>
      • GBP
    • <Territory>
      • <CountriesIncluded>
        • GB IM
  • <Price>
    • <PriceType>
      • 01
    • <PriceAmount>
      • 3.5
    • <CurrencyCode>
      • GBP
    • <Territory>
      • <RegionsIncluded>
        • WORLD
      • <CountriesExcluded>
        • GB IM

In the XML Data Selector, when I use

{/ProductSupply/SupplyDetail/Price/PriceAmount[1]}

(using the [1] to select the first value)

I\\\\\\\’m getting

Preview: 4.2,3.5

Instead of 

Preview: 4.2

I\\\\\\\’m sure this is something very easy, but I\\\\\\\’m new to this…

Thanks,

Ioan

J

James replied Support Agent

2 months ago on November 27, 2024 at 8:15 am

Hi Loan,

It looks like the multiple values are coming from the fact there are two Price nodes.

{/ProductSupply/SupplyDetail/Price/PriceAmount[1]}

I think if you want to target the first one you need to also mape it Price[1]

{/ProductSupply/SupplyDetail/Price[1]/PriceAmount[1]}

James

IP

Ioan replied

1 month ago on December 9, 2024 at 4:44 pm

Perfect, thanks!