You are here:  » Parser difficulties with QuantityPrice field


Parser difficulties with QuantityPrice field

Submitted by keymaster on Fri, 2006-07-07 09:15 in

Hi,

I have a feed which is a standard xml output of a yahoo store. The repeating record is within  <Product>... </Product> tags, as usual.

Within each product record is a <price> field, and within that, there is a <QuantityPrice> subfield, which looks like:

<QuantityPrice MinimumQuantity="1">59.95</QuantityPrice>
<QuantityPrice MinimumQuantity="2">113.95</QuantityPrice>
<QuantityPrice MinimumQuantity="3">165.95</QuantityPrice>

The problem is the parser does not seem to be picking up the quantity pricing the way one would expect.

Here is a snippet of the .xml feed:

<Products>
    <Product Id="0008arnpe">
      <Code>0008ARNPE</Code>
      <Description>America Magazine Subscription</Description>
      <Url>http://edited_out/0008arnpe.html</Url>
      <Thumb>&lt;img border=0 width=52 height=70 src=http://edited_out/I/supersuscriptions_1905_270526945&gt;</Thumb>
      <Picture>&lt;img border=0 width=500 height=674 src=http://edited_out/I/supersuscriptions_1905_11287337&gt;</Picture>
      <Orderable>YES</Orderable>
      <Taxable>YES</Taxable>
      <Pricing>
        <BasePrice>59.95</BasePrice>
        <LocalizedBasePrice>59.95</LocalizedBasePrice>
        <QuantityPrice MinimumQuantity="1">59.95</QuantityPrice>
        <QuantityPrice MinimumQuantity="2">113.95</QuantityPrice>
        <QuantityPrice MinimumQuantity="3">165.95</QuantityPrice>
      </Pricing>
      <Path>
        <ProductRef Id="culmag" Url="edited_out/culmag.html">Culture Magazines</ProductRef>
      </Path>
      <Caption>America Magazine provides a comprehensive look into the world of Catholics. Each issue of America features in-depth stories and interviews with Catholics from around the world. Published 52 times a year, America Magazine is a must (and a perfect gift) for all thinking Catholics and those who want to know what Catholics are thinking at all times. &lt;p&gt;America Magazine Subscription: 52 issues per year</Caption>
    </Product>

Here is how price tapestry displays the contents of the first record (at the bottom of the admin/feeds_register_step2.php page):

PRODUCT
PRODUCT-ID 0008arnpe
CODE 0008ARNPE
DESCRIPTION America Magazine Subscription
URL http://edited_out/0008arnpe.html
THUMB <img border=0 width=52 height=70 src=http://edited_out/I/supersuscriptions_1905...
PICTURE <img border=0 width=500 height=674 src=http://edited_out/I/supersuscriptions_19...
ORDERABLE YES
TAXABLE YES
PRICING
PRICING/BASEPRICE 59.95
PRICING/LOCALIZEDBASEPRICE 59.95
PRICING/QUANTITYPRICE 59.95
PRICING/QUANTITYPRICE-MINIMUMQUANTITY 1
PRICING/QUANTITYPRICE@1 113.95
PRICING/QUANTITYPRICE@1-MINIMUMQUANTITY 2
PRICING/QUANTITYPRICE@2 165.95
PRICING/QUANTITYPRICE@2-MINIMUMQUANTITY 3
PATH
PATH/PRODUCTREF Culture Magazines
PATH/PRODUCTREF-ID culmag
PATH/PRODUCTREF-URL http://edited_out/culmag.html
CAPTION America Magazine provides a comprehensive look into the world of Catholics. Each issue of America fe...

The intent of the feed merchant is the quantity price for 1 year should be $59.95,for 2 years should be $113.95, and for 3 years should be $165.95. You can see this is what he intended from the way the input feed is structured.

But the parser does not seem to be picking this up as one would expect.

The format string I am using is standard: xml|STOREEXPORT/PRODUCTS/PRODUCT/

So, the question is:

Why isn't the parser picking up the quantity pricing ? What can I do to get it working as intended?

Thanks very much.

Submitted by support on Fri, 2006-07-07 10:01

Hi,

Because the quantity pricing is contained within XML tags of the same name, the parser has had to resolve these into different names so that each value can be part of the associative array that is passed to the record handler function in your (or in this case the Price Tapestry) PHP script.

If it did not do this, the subsequent PRICING/QUANTITYPRICE fields would overwrite the first one.

In this case, the parser has successfully resolved out all 3 pricing / quantity variations; so you can choose which one you wish to register as the price field for this feed. Looking at this first record without any more information my recommendation would be that you register "PRICING/BASEPRICE" as the Price field in this instance.

You could even use the "Text After" filter to incorporate the 2 and 3 year pricing into the product description by configuring a new filter as follows:

Filter: Text After
Field: Description
Text: "Price shown is for 1 year subscription. You can save even more money and get a 2 year subscription for %PRICING/QUANTITYPRICE@1% or a 3 year subscription for just %PRICING/QUANTITYPRICE@2%"

(note that the value of the Text field should not include the quotes when you enter the value into the filter configuration).

Hope this helps - let me know if i've misunderstood what you're trying to do,

Cheers,
David.

Submitted by keymaster on Fri, 2006-07-07 12:18

Thanks, that's a good enough workaround - should work fine.

All the best.