Results 1 to 4 of 4
May 17th, 2008, 04:26 PM #1How to create a custom SKU#
I have working from the bullet proof datafeed thread and retooling and creating a new datafeed driven site. I have a merchant for which I'd like to create a custom SKU. I thought about using the feedID and product row number in the feed to create a SKU.
Ex. FeedID = 4001 and product row in the feed = 467
so the SKU would be 4001467
I can see a potential problem though. If, more like when, the merchant adds or removes a product from the feed. That would result in a new SKU for all the products after the row where the change occured.
I then thought about just using the feedID with a number and adding one to the number for each product that was added. But I can see the same type of think happening if the merchant adds or removes a product from the feed. IE all prodcts after the point of the change will have anew SKU.
I am trying to keep a unique SKU for each product in the DB. Any ideas on a methood for creating a SKU which will not change when products are added or removed from the source datafeed?Thanks,
May 17th, 2008, 05:43 PM #2
You could take some part of the merchant's name or initials.
For a site of mine, I found it helpful to have a field for the merchant's own sku, and then I have another that I do what I stated above.
So, for example, if Haiko sold purple underwear here at ABestWeb, and the sku was 123456, I would probably have the unique sku of ABW123456. This way there's no concern for additional products or deletion of products.
Is this what you're asking?
Help this helps,
May 17th, 2008, 09:10 PM #3
Ok, I don't think I need to make a custom SKU. I found something in my code.
Why does this work (single quotes)
$query = "select * from $tablename Where Sku = '$productID'";
while this gives me a column not found error (no single quotes)
$query = "select * from $tablename Where Sku = $productID";
May 18th, 2008, 08:09 AM #4
Single quotes work because you are querying to look for that value contained with the quotes.
No quotes returns that error because you are querying where Sku is equal to a field in your database named $productID, which your database does not contain. That is why it is not found.
Also, I just wanted to point out that queries are more efficient if you don't have
rather you should specifically ask for just the fields that you need, such as
SELECT prod_id, prod_name
I am guilty of throwing in an asterisk every now and then myself however. But I try to avoid it when it may affect visitors to my site.
Have a great day,