Posts Tagged ‘pricetapestry’
Is it possible to code in default field mapping in page feeds_register_step2.php?
In admin/feeds_register_step2.php, you will find this function which generates the drop-down boxes for each of the field mappings:
function field($title,$name,$prefixHTML="")
{
global $productRecordFields;
print "<tr>";
print "<td><nobr>".$title."</nobr></td>";
print "<td>".$prefixHTML;
$default = (isset($_POST[$name]) ? $_POST[$name] : “”);
widget_selectArray($name,$productRecordFields,$default,”Select..”);
widget_errorGet($name);
print “</td>”;
print “</tr>”;
}Simply replace the entire function with this version:
function field($title,$name,$prefixHTML="")
{
global $productRecordFields;
print "<tr>";
print "<td><nobr>".$title."</nobr></td>";
print "<td>".$prefixHTML;
$default = (isset($_POST[$name]) ? $_POST[$name] : “”);
if (!$default)
{
$defaults["fieldName"] = array(”PRODUCTNAME”,”NAME”,”PRODUCT_NAME”,”productTitle”);
$defaults["fieldDescription"] = array(”DESCRIPTION”,”shortdescription”);
$defaults["fieldImageURL"] = array(”IMAGEURL”,”IMAGE_URL”,”imageurl”);
$defaults["fieldBuyURL"] = array(”DEEPLINK”,”PRODUCTURL”,”deeplink”);
$defaults["fieldPrice"] = array(”PRICE”,”Price”);
if (is_array($defaults[$name]))
{
foreach($defaults[$name] as $test)
{
if ($productRecordFields[$test])
{
$default = $test;
break;
}
}
}
}
widget_selectArray($name,$productRecordFields,$default,”Select..”);
widget_errorGet($name);
print “</td>”;
print “</tr>”;
}In this version you will see an array of default values for each of the different fields, used from left-to-right, the first one found in the record will be used as the mapped field name. Simply edit these lists as appropriate for your own feeds. The above work great with the UK networks Affiliate Window / Tradedoubler / Webgains…