Hi,
I am quite new to Drupal and XPath. I need to import some data from the following xml file:
<?xml version="1.0"?>
<order id="invoice 1">
<detail>
<type>apple</type>
<quantity>10</quantity>
<price>20</price>
</detail>
<detail>
<type>banana</type>
<quantity>5</quantity>
<price>3</price>
</detail>
</order>I am using the following mapping:
Context: //order
title: @id
field_type: detail/type
field_quantity: detail/quantity
field_price: detail/price
field_full_price: detail/quantity * detail/priceI am getting the following output:
invoice 1
type:
apple
banana
quantity:
10
5
price:
20.00
3.00
full price:
200.00
My 1st problem is, that I dont get the full price of the second product.
My 2nd problem is, that I dont know if its possible to get an output formatted like this:
type:..........quantity:..........price:..........full price:
apple...............10...............20...............200
banana...............5...............3...............15
(like a table or similar look)
My 3rd problem is, that I would need a field, which would represent the sum of full prices (in this case, it should be 215), but I dont know how the XPath query should look.
I would really appreciate any help. Thank you !
Comments
Comment #1
Robin Millette commentedComment #2
PatchRanger commented@mephiszto
1) Try to use FirePath addon for Firefox or similar extension to debug your XPath queries.
2) Outputting is not the goal of this module. The goal of this module is to get data. How you will output it - is the task of another module. See Views, Display Suite or Panels for a start.
3) It seems to me that you are trying to achieve e-commerce order page representing, right? For this purpose (again) there are other modules : Drupal Commerce and Ubercart, choose whatever you like. They have almost everything you need to launch e-shop including order page.
Comment #2.0
PatchRanger commentededited just the desing of the xml