I've managed to create a table called brands which has filtered all the brands from those with brands currently assigned to them.
I'm looking to basically loop through the table, perhaps a static file or array? and then assign those with a blank brand if the name contains the brand name.
I'm getting a little lost in the code if i'm totally honest. Not sure where i should be placing this and what the best procedure for doing it would be.
I'm leaning towards using an array like stopwords instead of hindering the database during import.
Any guidence, point in the right direction would be appreciated. My mind id kinda blank atm, think i need some sleep :(
Cheers
Steve
Thanks david,
I did go down that route in the end, i posted directly after this message about it, i jumped the gun a bit, seems i can save a line or two with this though :)
You should set this forum up so we can edit a message that's awaiting moderation, so we don't need to duplicate posts. Would be a nice feature. I feel bad double posting, but i alway jump the gun and like to keep others informed if i make progress.
Cheers
Steve
No probs, Steve -
I'll take on board your comments; there's a number of improvements I'm planning to the to the forum now that it has grown so large / busy.
Cheers,
David.
--
PriceTapestry.com
Ah cool.
One thing, this doesn't seem to be doing anything from what i can see, at least the one feed i just imported that should have in fact been activated by it wasn't.
I can't see why it wouldn't work.
any idea's how i can check to see why it's not working?
Again, over eager oops :P
I was using a different variable as i had already created the brand names and named it brandWords, replaced, and is working fine thanks :)
Your a star for putting up with us lot heh.
Cheers Steve
Hi Steve,
An array just like that in stopwords.php would be the way to go. Let's say you create and manage the file includes/brandnames.php as follows:
<?php
$brandNames = array(
"Brand 1","Brand 2","Brand 3"
"Brand 4","etc."
);
?>
Then, in includes/admin.php, first add the following line right at the top, just after the opening PHP tag:
require("../includes/brandnames.php");
Finally, search for the following line within the import record handler function:
if (!$importRecord["merchant"]) return;
...and then ADD the following code after that line:
global $brandNames;
foreach($brandNames as $brandName)
{
if (strpos(strtolower($importRecord["name"]),strtolower($brandName))!==FALSE)
{
$importRecord["brand"] = $brandName;
break;
}
}
Hope this helps!
Cheers,
David.
--
PriceTapestry.com