The list of commerce product attributes needs to display the machine names for each product attribute entity in the list (see illustration images), as is provided on the other admin UI commerce entity list pages.

All the various lists need to display the entity label/title and the entity machine name consistently. Most do currently but not all, such as the product attribute list page, where they are missing. This is particularly important for product attributes since a product catalog might include dozens/hundreds of "color" attribute lists for different products, where each product has a unique list of available colors. Similarly a product catalog might have dozens/hundreds of "size" attribute lists, clothing: s,m,l shoes: american shoe sizes, European shoe sizes, mens clothing sizes "misses" clothing sizes, "juniors" clothing sizes, tech devices with unique size lists, and on and on, which are all unique lists. Each of these requires a unique attribute list that needs individual theming as well.

no machine names

Most of the other commerce entity lists show the machine names of the entities in the lists (see illustration images below), correctly. This probably needs thoroughly review across all admin GUI pages to check for consistency.

(product type list - shows machine names)
product type list has machine names

(product variation type list - shows machine names)
product type list has machine names

Please check that entity machine names are displayed in all admin GUI list pages.

Comments

DrupalWebsiteBuilder created an issue. See original summary.

mglaman’s picture

Category: Bug report » Feature request
Issue tags: -product attributes, -machine names, -dc2x +Novice

This is more of a "feature" request than bug report (improves usability, but there is nothing broken.)

mglaman’s picture

Title: admin ui product attribute list page needs to display machine names » Product attribute list page should display machine names
websiteworkspace’s picture

IMO, the lack of product attribute machine names is something that is very "broken"/missing, and therefore a bug.

Consequently, this thread truly is a bug report about something missed during development, that seems intended by the existence of this essential feature elsewhere in the admin GUI.

The moment one has a large quantity of product attribute sets, all called "Color", or all called "Size", with no way to distinguish between them on the - {site}/admin/commerce/product-attributes - list except by clicking "edit" on each of them in turn to discover which is which, it is clear that this omission is a bug, and a problem of a bug, even if not a bug that causes a code crash.

--

Commerce 2.x needs details like this implemented in order to be a hoped for first class tool.

websiteworkspace’s picture

Based on the existing code, it seems like it would only require changing a few lines of code to include machines names in the product attribute list builder code to be similar to lists like product type list builder (see code below):

modules\commerce\modules\product\src\ProductAttributeListBuilder.php


<?php

namespace Drupal\commerce_product;

use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
 * Defines the list builder for product attributes.
 */
class ProductAttributeListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['label'] = $this->t('Attribute name');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['label'] = $entity->label();
    return $row + parent::buildRow($entity);
  }

}


modules\commerce\modules\product\src\ProductTypeListBuilder.php


<?php

namespace Drupal\commerce_product;

use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
use Drupal\Core\Entity\EntityInterface;

/**
 * Defines the list builder for product types.
 */
class ProductTypeListBuilder extends ConfigEntityListBuilder {

  /**
   * {@inheritdoc}
   */
  public function buildHeader() {
    $header['name'] = $this->t('Product type');
    $header['type'] = $this->t('Machine name');
    return $header + parent::buildHeader();
  }

  /**
   * {@inheritdoc}
   */
  public function buildRow(EntityInterface $entity) {
    $row['name'] = $entity->label();
    $row['type'] = $entity->id();
    return $row + parent::buildRow($entity);
  }

}


icurk’s picture

Status: Active » Needs review
StatusFileSize
new821 bytes

Wrote a patch which adds attribute machine name on Product attribute list page.

sorabh.v6’s picture

Assigned: Unassigned » sorabh.v6
sorabh.v6’s picture

Assigned: sorabh.v6 » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new107.14 KB

I can confirm that the product attribute page shows machine name also, therefore setting it to RTBC. Attaching screenshot on my site -

Thanks for the patch.

drugan’s picture

Just FYI:

Absolutely the same changes were suggested by @b_sharpe on Jan 30:

https://github.com/drupalcommerce/commerce/pull/621/files#diff-5645bf553...

But later it was decided by @boyanz to continue here:

#2842961: Add a customer-facing label to ProductAttribute

If you've noticed that is exactly the same issue marked as related on the #2 comment.

  • mglaman committed a961209 on 8.x-2.x authored by icurk
    Issue #2912910 by icurk, DrupalSiteBuilder, sorabh.v6: Product attribute...
mglaman’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new89.86 KB

Thanks, now added.

  • bojanz committed 75c40df on 8.x-2.x
    Revert "Issue #2912910 by icurk, DrupalSiteBuilder, sorabh.v6: Product...
bojanz’s picture

Status: Fixed » Needs work

Reverted the commit.
1) Why would the array key be "type" for an ID column.
2) "Machine name" seems commonly used in the UI, but I'd like us to firmly decide on "ID" vs "Machine name", cause my initial assumption was that we'd use "ID" everywhere.

icurk’s picture

Status: Needs work » Needs review
StatusFileSize
new804 bytes

Updated the patch and replaced "type" with "id" and "Machine name" with "ID".

Status: Needs review » Needs work
rpayanm’s picture

Status: Needs work » Needs review
StatusFileSize
new809 bytes

rerolled

drugan’s picture

This feature is now included into Commerce Extended Attributes module.

Please, do the module review if you find it as a useful one.

lukasss’s picture

+1 for that, but already 2.21 ... and 3 years have passed. But this is an elementary thing that is 100% required

lukasss’s picture

Status: Needs review » Reviewed & tested by the community

#working for me

  • jsacksick committed eeb1ef1 on 8.x-2.x authored by rpayanm
    Issue #2912910 by icurk, rpayanm, websiteworkspace, mglaman, sorabh.v6,...
jsacksick’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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