Closed (fixed)
Project:
Node Import Update
Version:
6.x-0.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
10 Dec 2010 at 22:42 UTC
Updated:
30 Aug 2011 at 16:12 UTC
I need to be able to import data into Ubercart products, and the SKU (model) needs to be the unique ID. This patch makes it possible to assign an Ubercart base field as the unique ID.
I basically just copied and modified the approach this module takes for exposing CCK fields. I'm not sure this is the right way to do it, but at least it is consistent with existing code.
I've only tried it with SKU.
This patch is against 6.x-0.2, not the dev version. I'm not using the dev version on my site.
| Comment | File | Size | Author |
|---|---|---|---|
| node_import_update_ubercart.patch | 1.84 KB | smscotten |
Comments
Comment #1
smscotten commentedComment #2
fooby commentedcan this also be applied to the sub sku from product attributes?
Comment #3
smscotten commented@fooby I'm not even sure how that would work. Do you have multiple products with the same SKU but different product attribute SKUs? Trying to wrap my feeble mind around this but it's not really happening.
Comment #4
fooby commentedi manage a shop with about 60 different taxonomy terms for categories. all products have the attribute size
our sku's exists in 2 different variations
xxxxx-xxx-xxx
main-color-size
this variation is used for all products which have a size p.e. t-shirts, hoodies, etc...
xxxxx-xxx
main-color
this variation is used for products without attributes, like sunglasses, screwsets, etc...
for being able to import all in 1 big import we gave products at least 1 attribute, even if the product itself had no variations. products without variations get a subattribute, called "no attribute" which also holds the stock for the product.
only the last 3 digits of every sku are used to distinguish attributes from the main product
so the idea was to make a big import with all data and then later only update the stock by grabbing the sub sku.
our shop only gets new products every six months when season collections come out. being able to use unique sub-skus as identifier would really simplify the daily import.
edit: i know this approach isnt very good, but we have to crawl the manufacturers website. unfortunately the data we get is inconsistent and so we had to merge most product defining aspects to get a csv which is consistent and importable
Comment #5
grimbones commentedI tried the patch and it didn't work, so I modified two lines and got the nodes to update using the SKU number.
The original code in the patch is:
If you want it to read a SKU number you need to set $IMPORT_UNIQUE_ID_IS_UC to TRUE and switch "title" to "model". "model" is the name of the database column that stores the SKU number. Basically you can set it to track any field as long as you use the column name from the database.
Here is the new modified code with the two lines changed:
I don't really know how to make a patch file so if someone could help me that would be great.
Comment #6
smscotten commentedSorry, when I made the patch file, I made it so that using UC fields could be enabled. Yes, $IMPORT_UNIQUE_ID_IS_UC needs be set to TRUE but that's not how I'm guessing the module should be shipped if the patch were rolled in to the module.
'title' for example is in the module and the person configuring the module needs to fill in the correct values.
So the patch works, grimbones. And you did exactly the right configuration. You would have had to change $IMPORT_UNIQUE_ID_IS_CCK to true and change the value of $IMPORT_UNIQUE_NAME if you were configuring for some CCK field to be the unique ID. Everyone that uses node_import_update has to do basically the same editing you did, even without Ubercart fields or the patch applied.
Comment #7
coolestdude1 commentedImplemented along with settings page in dev version.