magento2 – How to display custom message according to selection of configurable product variation in sales order view?

enter image description hereenter image description here//My code in .phtml file

$item = $block->getItem();

$_product = $item->getProduct();

$_children = $_product->getTypeInstance()->getUsedProducts($_product);

foreach ($_children as $child){

    $chil()=$child->getData();

    $chsku()=$child->getSku();

    $chpid()=$child->getId();

    $childmsg()=$child->getCustomMsg();

}


$skuch=implode(" ",$chsku);

$msg=implode(" ",$childmsg);

if($skuch){

echo $msg;

}

//Please help me how to get sigle value according to select variation.

What is the name for those UX paradigms: “multi-selection → action” vs “action toggle on/off → selection”?

Supposing desktop application where multiple elements can be selected, and operations can be applied to them:

  • Text editor: several characters can be selected, and bold/italic/underline applied.
  • Drawing editor: Areas of different shapes can be selected, and drawing operations applied.
  • Vectorial drawing: Several elements can be selected, and operations (change properties, move, delete) applied.
  • 3D editor: several triangles can be selected, they can then be moved, deleted, etc..

There seems to be 2 paradigms:

  1. Select, then apply an operation to the current selection: you have as many tools as required to produce the complex selection. Then you apply the operation to all. Example:

    • Select a text in a text editor and then apply bold.
    • On a calculator, this would be the “Reverse Polish notation”: “2”, “4”, “+”
  2. Toggle the operation, and then apply it to as many elements as required: Example:

    • Toggle Chamfer on a CAD software and click one by one each edge.
    • On a drawing editor, toggle a brush, and then apply to the drawing (where the selection are those pixels below the cursor)

A third paradigm would be some kind of “infix” of a calculator, but I believe this is not common among desktop software.

What is the name (if any) for those two paradigms?

8 – Why do I get “An invalid selection has been identified.” from the form my code creates?

I am using the following code for a form.

public function buildForm(array $form, FormStateInterface $form_state) {
  $region_options = static::getFirstDropdownOptions();
  $form('vvv_region') = (
    '#type' => 'select',
    '#title' => $this->t('region select field'),
    '#options' => $region_options,
    '#empty_option' => t('- Select region -'),
    '#ajax' => (
      'callback' => '::myAjaxCallback',
      'disable-refocus' => FALSE,
      'event' => 'change',
      'wrapper' => 'edit-output',
      'progress' => (
        'type' => 'throbber',
        'message' => $this->t('Verifying entry...'),
      ),
    )
  );
    
  $region_selected = $form_state->getValue('vvv_region');
  $city_options = static::getSecondDropdownOptions($region_selected);
    
  $form('output') = (
    '#type' => 'select',
    '#title' => $this->t('city select field'),
    '#options' => $city_options,     
    '#prefix' => '<div id="edit-output">',
    '#suffix' => '</div>',
    '#empty_option' => t('- Select city -'),
    '#default_value' => '',
    '#ajax' => (
      'callback' => '::cityAjaxCallback',
      'disable-refocus' => FALSE,
      'event' => 'change',
      'wrapper' => 'edit-city',
      'progress' => (
        'type' => 'throbber',
        'message' => $this->t('Verifying entry...'),
      ),
    )
  );
    
  $city_select = $form_state->getValue('output');
  $suburb_options = static::getSuburbDropdownOptions($city_select);
        
  $form('sur') = (
    '#type' => 'select',
    '#options' => $suburb_options,     
    '#prefix' => '<div id="edit-city">',
    '#suffix' => '</div>',
    '#empty_option' => t('- Select sururb -'),
    '#default_value' => array(''),
  );
  return $form;
}

public function myAjaxCallback(array &$form, FormStateInterface $form_state) {
  $region_selected = $form_state->getValue('vvv_region');
  $city_options = static::getSecondDropdownOptions($region_selected);

  if ($form_state->getErrors()) {
    Drupal::messenger()->addError($region_selected);
    $form_state->setRebuild();
  }
  
  $form('outpout')('#options') = $city_options;
          
  return $form('output'); 
}
    
public function cityAjaxCallback(array &$form, FormStateInterface $form_state) {
  $city_select = $form_state->getValue('output');
  $sur_data = static::getSuburbDropdownOptions($city_select);

  if ($form_state->getErrors()) {
    Drupal::messenger()->addError($city_select);
    $form_state->setRebuild();
  }

  $form('sur')('#options') = $sur_data;

  return $form('sur'); 
}

When the form is submitted, I get the following error.

An invalid selection has been identified. Please contact the site administrator.

What’s wrong with the code I am using?

usability – Best practice for multi selection of card

I’ve a web page with a lot of elements represented by cards. The cards have some actions: add to, show detail, add to archive, delete.
The card can be made up of only text, text and image or image only.
The text can be plain text or links.

At this moment the user can do one action at a time. The buttons are in the top right angle and appear at the hover.

I want to introduce multiple selection because the number of the card is always very high and at this time interacting one card at a time is too onerous in terms of time.

As I imagined interaction click on cards to select them and a menu in neutral position with multiple actions: delete, add to, add to the archive.
My fear is the action that can only be performed on single card: the detail view. I don’t want this action to be accessible in two clicks, but I would prefer to remain in one.
The interaction I have described can fit? Do you have any suggestion about the detail?

Kendo Grid Filter Menus and Angular Material Selects – Closes Whenever You Make a Selection

I’m trying to make a custom filter menu using mat-select elements. By default, Kendo Grid Filter Menus close when another element outside of the menu is focused. This functionally prevents you from using mat-selects inside the filter menu. When you select an option of the mat-select, it closes the filter menu. I created a stackblitz demonstrating this.

https://stackblitz.com/edit/angular-ivy-nd2kdv?file=src/index.html

Can anyone think of a workaround?

plugin development – Add default value from selection

working on my first plugin where a user can select an option from a dropdown and this selection gets saved in a code that gets written into the footer. That works, but the problem is, my default selection (as in the HTML) gets ignored.

The selection

<select id="location_select" name="location_select">
 <option selected value="ch" <?php selected(get_option('location_select'), 'ch'); ?>><?php _e('CH', 'pluginName') ; ?></option>
 <option value="de" <?php selected(get_option('location_select'), 'de'); ?>><?php _e('DE', 'pluginName') ; ?></option>
</select>

The code

public function print_code(){
        $location   =   get_option('location_select');
        $url        =   'https://' . esc_html($location) . '.domain.com/js/script.js';
        wp_enqueue_script('myID', $url, array('jquery'), null, true);

     }

     public function additional_attrs($tag, $handle, $src){
        if ($handle === 'myID'){
            $tag = '<script data-host="https://domain.com" data-dnt="false" src="https://wordpress.stackexchange.com/" . esc_url( $src ) . "http://wordpress.stackexchange.com/" id="myID" async defer></script>';
        }
        return $tag;
     }

How is it possible to have the first selection <option selected ... as a default selection in the code? Because right now, if a user does not save his selection, nothing gets written in the output code.

Thanks for any help!

gui design – What is the term for varying types of selection, and why are most apps either one/the other with no setting

This might be asked before, but I’m trying to create a feature for my design app that supports both methods of selection in this way. One mode should select all items that the bounding box even touches a little bit of the item in question, it selects it. Example here (bounding box is black, green is selected, red is omitted):
enter image description here

The other type of selection is more strict, and only selects ones that are completely within the box.
enter image description here

Additionally, most apps that I found are usually one or the other (either that or I haven’t found the setting because I don’t know how to look for it). For instance, Illustrator defaults as the first option, but some apps like Solidworks in 2D mode default as the 2nd option. Despite this being a really simple feature, it can severely improve or otherwise hamper some simple tasks; like if the objects are really close to one another, the 2nd option is better for precision. Apologies if this is actually a duplicate, I have no idea how to explain this to Google. Thanks y’all!

mysql – Fill remaining LIMIT rows selection if conditions met are less than LIMIT number

I have a MySQL database with data in it. They all have locations (London, Liverpool, etc), I want a query to select 10 random rows with a location (for example London), and if there aren’t enough to satisfy the LIMIT request then fill the remaining rows with random other ones, so, for example, 10 random rows requested from London, but I only have 7 with London as the location, so it’ll get the 7 from London and 3 from any other location.

The query is simple:

SELECT * FROM users WHERE active = 'yes' ORDER BY RAND() LIMIT 10

This brings them randomly, and if I put “AND location = ‘$location'” then it gets from the specified location (calling using PHP where $location is a variable stating the priority location), but if there’s less than 10, it’ll only bring those rows, nothing more. I have no idea how to add extra random filler rows if it doesn’t reach 10 at the priority location

selection – Select a lot of items (checkboxes)

Initially I asked my question on stackoverflow but I was told that it was offtopic and this is a better place to ask the question (https://stackoverflow.com/questions/68305296/html-show-large-amount-of-checkboxes).

Basically I’m working on a game where users are able to have a lot of items (50-100k). The items are stored in a database, they are all unique because they have metadata (achieved time etc..).
The issue now is, we would like to allow the users to have a decent overview and select items (for example to trade, gift or whatever). Rendering 50k items is undoable.

I could also remove the uniqueness of items and have a count column which stores duplicates (note I wouldnt be able to store metadata here). This way users still can have 50k items but if there are only 500 unique items I can safely render 500 since that is still doable.

Does anyone have an idea how I could realize this?