v12/10B
Happy Monday, David!
Have a merchant who likes to run their model number in one continuous string.
Example: 123456789
Would like to be able to spit it / add a space after the 5th character/number.
Example: 12345 6789
Possible?
Thanks!
Hi David,
BRILLIANT, thank you!
Now, if I wanted to add that modified DATABASE field using the "Text After" filter, is that possible?
Current using "Text After" in the "Product Name" field using %SKU%, however it adds the SKU from the datafeed and not the database (which has the properly formatted SKU).
So, I want: Blue Widget 1234567 89 - but currently get Blue Widget 123456789.
Possible?
Thanks again for your fantastic assistance!
Hi,
If you want the results of previous filters to be visible to subsequent filters using placeholders, in includes/admin.php look for the following code at line 225:
$importRecord[$filter["field"]] = $execFunction($filter["data"],$importRecord[$filter["field"]]);
...and REPLACE with:
$importRecord[$filter["field"]] = $execFunction($filter["data"],$importRecord[$filter["field"]]);
$filter_record[$admin_importFeed["field_".$filter["field"]]] = $importRecord[$filter["field"]];
With that in place, as long as your Insert At is in sequence before the Text Before using %SKU% then it will pick up the modified version...
Cheers,
David.
--
PriceTapestry.com
Hi David,
Thank you. However, this did not prove successful.
Does it matter that we are using 'Text After', and not, 'Text Before'?
Thank you again for your assistance.
Hi,
The replacement above wasn't quite correct - please use:
$importRecord[$filter["field"]] = $execFunction($filter["data"],$importRecord[$filter["field"]]);
$filter_record[$admin_importFeed["field_".$filter["field"]]] = $importRecord[$filter["field"]];
(corrected above) - both Text After and Text Before support %fieldname% placeholders...
Cheers,
David.
--
PriceTapestry.com
Hi David,
Still no success.
Question:
The datafeed's field is called "SKU", however in the database it is "model".
In the database it is:
12345 6789
Seems to be pulling from the feed and not the database.
???
Hi,
is the HTML Entity for non-breaking space, so it's most likely actually in the datafeed in that format. Here's the code for an entity decode filter which will convert back into plain text, e.g. "12345 6789". Let me know if you're still not sure regarding use of the %SKU% place holder once this is in place - simply add the code below to includes/filter.php and then add a new HTML Entity Decode filter to the field...(model)
/*************************************************/
/* HTML Entity Decode */
/*************************************************/
$filter_names["htmlEntityDecode"] = "HTML Entity Decode";
function filter_htmlEntityDecodeConfigure($filter_data)
{
print "<p>There are no additional configuration parameters for this filter.</p>";
}
function filter_htmlEntityDecodeValidate($filter_data)
{
}
function filter_htmlEntityDecodeExec($filter_data,$text)
{
global $config_charset;
return html_entity_decode($text,ENT_QUOTES,$config_charset);
}
Cheers,
David.
--
PriceTapestry.com
LOL, Hi David!
NOW, I'm officially confused.
I am pasting (please do not publish) the URL showing why I am confused.
{link saved}
Note that the Item name consists of the name plus %SKU% using a filter. This seems to be pulling to database fields and merging them.
Note that the SKU is properly displayed in HTML (under product description and above 'Price'. This is pulled from the database and therefore is displaying correctly.
Thanks for taking the time to "un-confuse" us...
Hi,
Sorry again - (must be the heatwave we're having in the UK this week!) the variable is $filter_record not $filterRecord - modification described above should be:
$importRecord[$filter["field"]] = $execFunction($filter["data"],$importRecord[$filter["field"]]);
$filter_record[$admin_importFeed["field_".$filter["field"]]] = $importRecord[$filter["field"]];
Don't forget to re-import as this code only applies at import time...
Cheers,
David.
--
PriceTapestry.com
Hi,
Have a go with this filter code; insert into includes/filter.php just before the closing PHP tag;
/*************************************************/
/* Insert At */
/*************************************************/
$filter_names["insertAt"] = "Insert At";
function filter_insertAtConfigure($filter_data)
{
print "Insert Index:<br />";
print "<input type='text' size='3' name='index' value='".widget_safe($filter_data["index"])."' />";
widget_errorGet("index");
print "Insert Character or String:<br />";
print "<input type='text' size='40' name='text' value='".widget_safe($filter_data["text"])."' />";
print "<br />";
widget_errorGet("text");
}
function filter_insertAtValidate($filter_data)
{
if (!$filter_data["index"])
{
widget_errorSet("index","required field");
}
if (!$filter_data["text"])
{
widget_errorSet("text","required field");
}
}
function filter_insertAtExec($filter_data,$text)
{
$a = substr($text,0,$filter_data["index"]);
$b = $filter_data["text"];
$c = substr($text,$filter_data["index"]);
return $a.$b.$c;
}
...and then add a new "Insert Add" filter to the model number field in your feed, with an Insert Index of 5 and SPACE as the Insert Character or String...
Cheers,
David.
--
PriceTapestry.com