Needs review
Project:
Commerce Backoffice
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Apr 2013 at 18:29 UTC
Updated:
24 Feb 2016 at 12:53 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ath.galanis commentedComment #2
rszrama commentedNot sure, but you're using Commerce Kickstart 2.x - moved this to the correct queue.
Comment #3
ath.galanis commentedThank you for your instant reply.
No, I have a fresh installation (not an Upadate) of Drupal Commerce 7.x-1.6 (including the patch from "Version Notes"), and of course all the other modules that it depents on, plus Commerce Backoffice modude. (All of them are installed on April 28, in their latest version).
Comment #4
rszrama commentedOk, then it must be Commerce Backoffice. Commerce by itself only ever lists product entities in the Store > Products View.
Comment #5
ath.galanis commentedComment #6
bojanz commentedCan you provide screenshots?
Comment #7
vasikeindeed, this issue exists.
I could reproduce it in a custom Drupal Commerce with a custom Product reference Field - field_xxx (where xxx != product - the default product reference Field)
So what actually happens is that the view is broken as the View Relationship it's broken - it doesn't exist.
I think we need at least some documentation about this on:
- http://drupal.org/project/commerce_backoffice
- http://www.drupalcommerce.org/commerce-kickstart-2/product-management-ov...
What about having a more generic Relationship as "Taxonomy terms on node" Relationship handler?
Comment #8
ath.galanis commentedHi,
I give you 2 screenshots.
1. "ProductList" screenshot, the only products in my store are the first three lines, all the others are nodes that belong to content types that are not product displays.
2. "ClickOnQuickEdit" screenshot, as you can see when I clik on any Quick edit button on any line, the view provides me lines from other nodes.
Comment #9
bojanz commentedHaving a relationship handler that can guess the field name for you would be great.
I don't know if it's possible or how much work it would be.
Changing to feature request.
Comment #10
vasikehere is patch that build such a Relationship Handler (inspired by "Taxonomy terms on node")
the patch also changes the "Commerce Backoffice: Products" View - uses the new Handler.
Comment #11
fmb commentedvasike, I applied your patch, to no avail. I still cannot add the relevant relationship in the view (I reverted the view to its default state and cleared all caches). Unfortunately this means the "quick edit" functionality will not work properly at all... Is there some workaround in the meantime?
I would gladly help with the patch, if only I were knowledgeable enough about views handlers...
Comment #12
rob c commentedThe missing relation handler also affects the commerce_backoffice_product_variations view, this is the view used to render the quick edit.
Comment #13
discipolo commentedwith the patch from #10 commerce_backoffice_products has the generic relationship. i just needed to edit the new relationship and check the checkbox for the product reference field that i used.
i still had to add the new relationship and contextual filter to the view used by quickedit commerce_backoffice_product_variations but now it seems to work as expected.
Comment #14
discipolo commentedhere are the exports of the adapted views:
Comment #15
vasikeindeed. the previous patch was far for complete. thank you all.
there is a new patch that should covers also the the quick edit View.
It seems there was also something wrong with the "All taxonomy terms" associated with a product - won't work within relationship - with this patch it should be fixed.
Comment #16
discipolo commentedi tested this new patch and still had to edit the new relationship and select the correct field in both views manually.
sadly this time, even though the correct products show up in quickedit, the status and price fields arent working.
Comment #17
discipolo commentedinterestingly the quickedit works when i use this implementation: https://github.com/rosenstrauch/commerce_backoffice_quickedit_ui that gives us all fields available there optionally.
Comment #18
vasike@discipolo : thank you Sir.
indeed there was an issue getting the product variations entities for the quick edit form Views field - the relationship wasn't used.
there is a new patch that should solve this.
Comment #19
vasikeforgot the patch.
Comment #20
mglamanI've got to mark this as needs work. I still have to enable the proper field on the relationship. We should be able to find this in code, so when the view import it dynamically chooses first (as it should be safe to assume first product reference field == proper one.)
Comment #21
mglamanHere is re-rolled patch. Key difference is that if
$this->options['product_reference']is not set, it'll use the first key in the $options array. It also marks this field as required, since it is - otherwise you don't see products in the View.Otherwise kudos on that handler, vasike.
Comment #22
mglaman:) Forgot the patch
Comment #23
discipolo commentedexcitedly testing this
Comment #24
vasike@mglaman : thank for your help.
But i won't agree with your addition, this means back to a NOT generic relationship handler for products.
So with this option required will restrict the usage to the specific product reference fields and this relationship portability.
Without having a product reference field all the product reference fields found for the content types should be used for the relationship.
So maybe there should be somthing to be done - for multiple fields defined.
Comment #25
discipolo commentedhow about selecting any reference field by default and not marking them as required
Comment #26
mglamanBut, vasike, without selecting a product reference field no products displayed - at all. Or, maybe it was because I don't have field_product as the product reference field? See #2298111: Backoffice assumes product reference field is "field_product"
Comment #27
vasike@discipolo, @mglaman: thank you for your support.
now i know exactly what it's needed. soon i'll post a new patch that should work for any existing product reference field.
Comment #28
vasikeand there is a new patch that should solve the problems with the custom product reference fields.
So using this relationship with no product reference field selected will use all the product reference fields it finds.
Comment #29
mglamanvasike, awesome! I will test this out later today
Only thing I'd say is have lines 56/57 replaced by creating the $product_references variable via array_filter, and line 58 would be if(!product_references)
Comment #30
jimmynash commentedApplied this patch to Commerce Backoffice 7.x-1.4 and it does the trick for me.
I had added some custom product reference fields to a product display and was not seeing those in the Backoffice Product listing view .
This patch made those missing products show up.
Comment #31
discipolo commentedthe patch from #28 doesnt add the new file for me (error: includes/views/handlers/commerce_backoffice_handler_relationship_node_product_data.inc: No such file or directory) so i recreated it.
didnt attempt the improvements from #29 yet
Comment #32
leendertdb commentedThe project I'm working on also has a product reference field with a different name so the quick edit functionality broke. I can confirm the patch from #28 works as intended, everythink works OK now.
I have re-rolled the patch and included the proposed changes from #29.
Can we get this reviewed and committed to 7.x-1.x ASAP? I think a lot of (new) non-kickstart sites can have a lot of trouble with the product backoffice management page with this problem.
Comment #33
leendertdb commentedWhoops, seems the re-rolled patch didn't contain everything. This one (#33) should work.
Comment #34
mglamanGoing to be *that* guy, but white spaces
Comment #35
leendertdb commented@mglaman, seems I have (or well, Notepad++ has) done it wrong all my life. Thanks for the tip!
See attached the updated patch.
Comment #36
discipolo commentedmissing parenthesis
Comment #37
rossb89 commentedThanks for the patch, I had some issues applying the patch with the latest dev (or 1.5).
There was just one issue with the product info file as there is now a files[] entry for a test file.
Re-rolled the patch against latest dev.
Comment #38
rossb89 commentedOops, didn't include the actual class file, my bad!
Re-rolled with the missing file.
Comment #39
rossb89 commented