-
Notifications
You must be signed in to change notification settings - Fork 139
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Commerce Products field not mapping to Title or Slug on import #569
Comments
Do you have a database backup from before you switched away from Matrix? If so can you please send that and your |
Same issue here when specific product types are selected due to the UID criteria instead of integer for the product type ID. This is a hack but the quick fix for import was adding the following after line 52 in feed-me/src/fields/CommerceProducts.php. $typeIds = array_column(ProductType::findAll([
'uid' => $typeIds
]), 'id'); |
Can confirm when selecting a specific product type (Source) it doesn't work, but when the All checkbox is checked it imports fine. |
I noticed this too. I had my field set with certain product type. Had to change it to "All" then FeedMe setup the relations perfectly. |
Hello. It is not mapping using Craft 3.4.5 and Feed Me 4.2.0.1 I do not see an option "All" or a checkbox when selecting a product type [ https://www.screencast.com/t/9NIlY9JAX ] and if I leave this to "none" I get an error on the next page (with debug mode on) |
@moldedjelly Hello. Where did you change it to "all" - I cannot find it in Feed Me plugin. I need to migrate hundreds of products and so far I haven't found a way to map product to product relation :( |
@epapada hi. I'm not sure your case is the same as this thread. My understanding was this thread was about importing product slug/title data and matching it into a Commerce Products entries field within elements being imported by FeedMe. |
@moldedjelly Thanks for the quick reply! My scenario is trying to match Commerce products on other Commerce products (related products field) of the same type by ID (tried with title and slug but no lack). Feed me finds the product but it skips it saying "no content has changed". I tried it with the simplest csv file with direct ids but no lack. For example my csv is like this |
@epapada You can filter which Product Types are allowed for selection in a specific Commerce Products fields (in your case in the related product field, |
Following [leigeber's answer](craftcms#569 (comment)), this is a quick fix to work around craftcms#569.
Well, there is a PR already open: #522 |
I've got the same issue where if I limit the commerce field to the Sources product type that I want to select from my mapping doesn't work - but if I set the Sources to all product types it does work. But because some of my Commerce Product have the same title/slug in different product types it's sometimes selecting the wrong one. Product Type: Location Product Type: Use As a fix I've made my slug's unique, but I don't think I should have to do this :( |
I’ve tested this, and I’m unable to replicate the bug. I’ve tried the product field with All and specific product type sources; both were imported. It could be that this had been fixed on the latest Feed-me v4 version. |
I have mapped a XML import element to the field Commerce Product inside a matrix field. I have chosen Data Provided this Entry is: Slug AND I also tried Title.
The relationship is not imported.
Here is the FeedMe setting, also tried Title:
Here is the XML setup as referenced in the setting above. I added CDATA due to characters, but when using slug I did not add CDATA.
Here is the content block with no relationship, even though the other products exist (I did an import several times) and are in the feed:
If I switch the field to a Commerce Variant (because I can still see all the products in the list) it still does not work.
If I don't put the Related Field in a Matrix block, so its its own separate field, it also does not work.
FeedMe: v4.1.0
Craft CMS: Craft Solo 3.2.0-RC2
Update 1
When I do an import, this is the query array created in src/fields/CommerceProducts.php, but it does not return any matches. So is the query array correct?
The only other hunch is if I am relating to entries in my import, are perhaps all entries deleted first, and then when it imports the entry with those slugs dont exist? I can't imagine it woudl do this, I have chosen settings Add & Update.
Update 2
I believe the array is wrong and so the created SQL is wrong. The created SQL is as follows and includes WHERE (
commerce_products
.typeId
='b755d0ac-93fb-4de5-9b00-8ca3fa970af0') - but typeId is not a uid in commerce_products, and even then, the above ID is not a commerce_product uid anyway, but the commerce_producttypes uid.If I just delete that part, it returns the correct related products.
Note: in the field settings I chose a Type to relate products to. I have not tried doing it with All selected. Maybe its only apparent when a Type is chosen.
So commenting out this in the file, makes it work for me for the normal field, but it still does not import into the matrix field as I guess thats managed in the Matrix field file.
//$criteria['typeId'] = $typeIds;
I will change the way I am building this site to utilise its own related field and not in Matrix, but this obviously should be addressed anyway.
The text was updated successfully, but these errors were encountered: