Comments

zvse created an issue. See original summary.

imyaro’s picture

Status: Active » Needs review
StatusFileSize
new1.77 KB

Please review my patch - I think that it might be helpful for many rabbit hole and commerce module users.

I don't know if we should add Commerce Orders support, because usually it not needed for orders.
Other commerce entities does not have it own page and don't think that we will need to add it.

Thanks

imyaro’s picture

StatusFileSize
new1.77 KB

Updated patch.
Changed plugin name from hr_commerce_product to rh_commerce product.

0sarah0al’s picture

The patch works..
Awesome..

Thanks alot

kala4ek’s picture

Status: Needs review » Reviewed & tested by the community

Works like a charm in production.

steveoriol’s picture

+1, the patch works on 1.x-dev, permissions OK...

abramm’s picture

RTBC.
I'm using this patch on production for almost a year.

hitchshock’s picture

RTBC.
Patch works good.

rollins’s picture

Great work zvse!
Thank you.

markdc’s picture

Status: Reviewed & tested by the community » Needs work

The option to override Rabbit Hole settings per product entity does not work. I see the Rabbit Hole Settings form on the commerce product form. But choosing another option has no effect on the form, nor does saving a different value.

Steps to reproduce:

  1. Enabled the option to override Rabbit Hole settings for a product type
  2. Edit a product
  3. Open the Rabbit Hole Settings pane in the sidebar
  4. Change Rabbit Hole Settings to "Page not found" or something other than "Global product behavior"
  5. Save
  6. Edit product again and no change to form was made
daniel korte’s picture

Title: Support for the commerce entities. » Support for commerce products
StatusFileSize
new1.74 KB
new1.69 KB

I cleaned up the patch in #3 so this new module matches the other sub modules in RH more closely.

Also, I can confirm the issue in #10 exists, but not sure why.

leendertdb’s picture

StatusFileSize
new1.9 KB
new508 bytes

I tested the patch in #11 and it works perfectly for the commerce_product entity. I also took the time to debug the issue noticed in #10. I found out that one of the commerce_product form parent elements has a form API parameter '#tree' => TRUE. This causes all child fieldsets (of which the rabbit_hole form is one) to be posted in a hierarchical format as well.

However the rabbit_hole module itself expects all properties to be available in the top level $form_state values array, here an example:

    if ($form_state->getValue('rh_is_bundle')) {

I added a new patch based on #11 which adds a '#tree' => FALSE property to the main rabbit_hole form element in src/FormManglerService.php. With this extra line the override per commerce_product works as expected.

Updated patch and interdiff attached.

leendertdb’s picture

Status: Needs work » Needs review
leendertdb’s picture

StatusFileSize
new2.23 KB

Rerolling patch of #12 (made a mistake while generating the diff, it did not apply). Changes are exactly the same.

daniel korte’s picture

Status: Needs review » Reviewed & tested by the community

Nice work @leendertdb! I am surprised this wasn’t caught until now. That fix does the trick. Patch looks good to me.

loze’s picture

Patch works as advertised. Thanks!
+1

stefdewa’s picture

+1 for RTBC!

k.skarlatos’s picture

This breaks multilingual sites. When i enable rabbit hole for a product type with a Page not found behavior, i get page not found for every language.

  • Matroskeen committed 5ba262c on 8.x-1.x authored by leendertdb
    Issue #2900548 by leendertdb, zvse, Daniel Korte, markdc: Support for...
matroskeen’s picture

Status: Reviewed & tested by the community » Fixed

I'm happy to announce that the latest patch was committed to 8.x-1.x branch and will be available in the next release.
It was proved by many people and our test coverage (#3177826: Add behavior invocation test coverage for rh_commerce module, #3177818: Add form additions test coverage for rh_commerce module).

@ k.skarlatos, if there are any issues with the multilingual setup, feel free to create a new issue (I believe it's not commerce-specific).

Thank you all for your contribution!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.