Fully implement, adjust and review the "commerce-product-availability-product-availability-default" twig template

Created on 17 June 2024, 3 months ago
Updated 11 September 2024, 17 days ago

Problem/Motivation

As the title says.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Fixed

Version

1.0

Component

Code (commerce_product_availability)

Created by

πŸ‡©πŸ‡ͺGermany Grevil

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

Merge Requests

Comments & Activities

  • Issue created by @Grevil
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @thomas.frobieter any plans before we tag the new stable release?

  • thomas.frobieter β†’ made their first commit to this issue’s fork.

  • Assigned to Anybody
  • Status changed to Needs review 19 days ago
  • Assigned to thomas.frobieter
  • Status changed to Needs work 19 days ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @thomas.frobieter: Great! Just one thing: availability_indicator is missing now!

  • Status changed to Postponed 19 days ago
  • Okay, so it turns out heres alot of work todo, so we need to postpone this.

  • Status changed to Needs work 19 days ago
  • Assigned to Anybody
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    The logic is ready, it just needs to be added similar to the logic before, then it's done.

    I'll prepare it, then we can change the values, if you want them not to use color names.

  • Issue was unassigned.
  • Status changed to RTBC 19 days ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    RTBC from my side. Uses the setting now and preserves the logic in PHP as expected.

  • Status changed to Needs work 19 days ago
  • Multiple things to solve:
    1) Using colors as classnames is bad practice. Thats why Bootstrap & Co. are using "success", "warning" and "danger", instead "green", "yellow" and "red". And because of this availability_status is much more appropriate here.
    2) The whole naming about "availability_indicator" is not clear - at least not clear to me. And because in my world its conflicting with availability_status is have no better name for this, because I would'nt solve it this way at all.
    3) What is the difference of the availability_indicator and the availability_status (for the frontend side). Why not simply set the availability_status to "not_available", instead sperading a second variable? In theory there might be a case where the product ist in stock but not buyable. If we need to cover this case, we better have a boolean variable in the template, that tells us if the product ist buyable or not.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Using colors as classnames is bad practice. Thats why Bootstrap & Co. are
    using "success", "warning" and "danger", instead "green", "yellow" and "red".
    And because of this availability_status is much more appropriate here.

    We could name it

    • available
    • limited
    • unavailable

    for example if that's better?

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    What is the difference of the availability_indicator and the availability_status (for the frontend side). Why not simply set the availability_status to "not_available", instead seperating a second variable? In theory there might be a case where the product is in stock but not buyable. If we need to cover this case, we better have a boolean variable in the template, that tells us if the product ist buyable or not.

    We already have these two separate settings. But the icon combines both and adds the option to show / hide the icon. And the logic to do so shouldn't be in theme.

    If we had more time, we could discuss a better name for availability_indicator indeed (something like "the real result of buyable and availability to show as icon", but I think it will cost a lot of time and make things even more complicated for little benefit.

  • Assigned to thomas.frobieter
  • Status changed to Needs review 19 days ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Replaced the colors by constants

  • Status changed to RTBC 19 days ago
  • Okay, so regardless of naming - which, as is often the case, can be argued about for a long time - the availability_indicator now contains all the necessary status to set appropriate classes. That works for me, thank you.

  • Pipeline finished with Skipped
    19 days ago
    #278275
  • Status changed to Fixed 19 days ago
  • πŸ‡©πŸ‡ͺGermany Grevil

    Changing "getAvailabilityIndicatorColor" to "getAvailabilityIndicator" without a BC record is not a good idea!

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

Production build 0.71.5 2024