Reputation: 1
i a have a problem with an import. I didn't have the type of the product like <product_type>value</product_type> But i have some nodes with :
<product_type>
<reference>value</reference>
<price>value</price>
</product_type>
I need to get the product type in my mapping...
Do you have any idea if you already use this script in wordpress ?
Thank for your help, Regards,
Fred
Need to check and get the name of the node.
Upvotes: 0
Views: 87
Reputation: 319
old question but.. let me write an answer for you or everyone else!
First of all, product_type in WC, should be simple
, variable
, grouped
or external
.
<product_type>
has two child nodes in your XML file. What are the real value of reference
.. Is it something from above? If not, maybe the product_type
node is useless in your case and should find another XML field to set as product_type
. Otherwise, you could drag - and - drop the field reference
inside the WP All Import field Set Product Type With XPath
. If this is not what you are looking for, perhaps you could try a PHP function to accomplish your goal. Thus, inside WP All Import field Set Product Type With XPath
, you could wirte something like this:
[check_product_type({drag_and_drop_your_field_from_xml})]
and inside Function Editor tab of WP All Import (find it at the bottom of the Import) you could write the PHP function you want, for example:
function check_product_type($product_type) {
if($product_type == "simple") {
return "simple";
}
else if($product_type == "variable") {
return "variable";
}
}
and so on! Hope that helps you somehow and give you ideas to achieve your goal
Upvotes: 0