Commerce: Specific Products

Created on 6 October 2024, 6 months ago

When adding Commerce: Specific Products as a condition we get the following error.

TypeError: array_column(): Argument #1 ($array) must be of type array, string given in array_column() (line 67 of /home/dhub/dhub/web/modules/contrib/commerce/modules/product/src/Plugin/Commerce/Condition/ProductTrait.php).

I tried the patch from https://www.drupal.org/project/eca_commerce/issues/3420468 🐛 "Field xxx is required" error even when a value is provided Postponed: needs info to see if that would fix the issue, but it doesn't.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom garethb_uk

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @garethb_uk
  • 🇮🇳India sayan_k_dutta

    Working on it.

  • 🇮🇳India sayan_k_dutta

    sayan_k_dutta changed the visibility of the branch 3478960-commerce-specific-products to hidden.

  • 🇮🇳India sayan_k_dutta

    sayan_k_dutta changed the visibility of the branch 2.0.x to hidden.

  • 🇮🇳India sayan_k_dutta

    sayan_k_dutta changed the visibility of the branch 2.0.x to active.

  • Pipeline finished with Failed
    6 months ago
    #302928
  • 🇩🇪Germany jurgenhaas Gottmadingen

    jurgenhaas changed the visibility of the branch 2.0.x to hidden.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    jurgenhaas changed the visibility of the branch 2.1.x to hidden.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Here is what's happening: when commerce conditions use a commerce_entity_select or a entity_autocomplete field type in a configuration form, ECA changes that to a text field which accepts a comma separated list of product IDs.

    The commerce product trait, however, contains a form submit handler that expects an array with each item containing the key target_id with the product IDs. From those IDs, they lookup the UUIDs of each product and store that as configuration.

    We can't have that configuration as such because ECA needs to store the comma separated ID list as this is required again next time the ECA model is being edited.

    However, we need to adjust the plugin configuration right before execution/evaluation in the same way to provide the UUIDs instead of IDs.

    This is certainly a bigger task and then also needs someone for testing. Not sure, if I can get to it soon.

  • 🇺🇸United States nicxvan

    @sayan using the issue queue for questions is better.

    No problem opening am issue fork, if you don't add to it someone else will!

  • Status changed to Needs work 2 months ago
  • 🇺🇸United States nicxvan
  • 🇳🇴Norway zaporylie

    The scope here is slightly bigger than what's described in the issue title and summary, as suggested in #9. In short, commerce condition plugins are not correctly handled due to form decoration at the eca deriver level. I am bumping the severity to Major as reusing commerce Condition Plugins is one of the biggest potential value of using ECA with Commerce.

    Backstory: I am working on recipes and want to react to the add-to-cart event (that part works fine) but only if a certain condition is met - order type is X (doesn't work). The issue is that bundles are stored as an array, but the eca_commerce_commerce plugin expects them to be string

Production build 0.71.5 2024