commerce – How can you manage your total stock levels with stock_commerce on Drupal 8?

Actually a shop where you can order lessons and in which each time maximum seats are available. In trying to use commerce_stock for D8, I was able to set a stock field and an initial stock balance, but it seems there is no way or place to see all of your stock. Worse, it does not seem to decrease when I place a test order.

After trying Commerce Inventory and resolving my shop twice, I ran out of options.

Replacing Ajax fails with the Form ID mismatch warning, even if the event is not executed the second time in Drupal 8

Enter image description here

Above the field is the paragraph field with two separate selection fields. Note : Business Rules Engine does not work with it.
Both field options are loaded from entity reference views.

Trying to create a dependent selection box with Drupal 8 Ajax Replace.

The replacement fails the second time, and the log displays the match with the form ID as a warning.

I tried a different approach by using HtmlCommand instead of ReplaceCommand and set the static ID for the child form element. By default, Drupal provides a dynamic ID for each form element. Also, if I try to change the item ID, it will not work by giving a Form ID mismatch warning.

  1. I tried to replace the entire form element by packing the wrapper with ReplaceCommand.
    / **
    * Implemented hook_field_widget_WIDGET_TYPE_form_alter ().
    * /
    function module_name_field_widget_entity_reference_paragraphs_form_alter (& $ element, & $ form_state, $ context) {

                    $ element['subform']['field_course']['widget']['#ajax']    = [
                  'callback' => 'get_competency',
                  'event' => 'change',
                  'method' => 'replace',
                  'wrapper' => '#edit-competency-'.$uuid_value,
                ];
    
    }
    
    
    
    Function get_competency (Array & $ element, FormStateInterface $ form_state, $ context) {
    
    
    $ triggeringElement = $ form_state-> getTriggeringElement ();
    $ value = $ triggeringElement['#value'];
    
    $ gt =  Drupal :: service (& # 39; generic_templates.utility & # 39;);
    $ options = $ gt-> getCompetency ($ value);
    $ options = ["_none" => "- Select a value -"] + $ options;
    $ wrapper_id = $ triggeringElement["#ajax"]["wrapper"];
    unset ($ triggeringElement["#value"]);
    unset ($ triggeringElement["#ajax"]);
    $ triggeringElement['#title'] = "Competence";
    $ triggeringElement['#prefix'] = & # 39;
    & # 39 ;; $ triggeringElement['#suffix'] = & # 39;
    & # 39 ;; $ triggeringElement['#options'] = $ options; $ triggeringElement['#default_value'] = NULL; $ triggeringElement['#field_name'] = "Field competence"; $ triggeringElement['#parents'] = [ "field_configurations", 0, "subform", "field_configuration", 0, "subform", "field_score", 0, "subform", "field_competency", ]; $ triggeringElement["#array_parents"] = [ "field_configurations", "widget", 0, "subform", "field_configuration", "widget", 0, "subform", "field_score", "widget", 0, "subform", "field_competency", "widget", ]; $ triggeringElement["#attributes"]["data-drupal-selector"] = str_replace ("course", "competence", $ triggeringElement["#attributes"]["data-drupal-selector"]); $ triggeringElement["#name"] = str_replace ("course", "competence", $ triggeringElement["#name"]); $ id = explode (& # 39; - & # 39 ;, $ triggeringElement["#id"])[0]; $ triggeringElement["#id"] = str_replace ("course", "competence", $ id); return $ triggeringElement; }
  2. I changed the ID of the element as a wrapper ID so that the form element itself now acts as a wrapper, and I used HtmlCommand. The idea is to replace only the entire Drupal-generated selection field (1st method).

use Drupal Core Ajax AjaxResponse;
use Drupal Core Ajax HtmlCommand;

                / **
* Implemented hook_field_widget_WIDGET_TYPE_form_alter ().
* /
function module_name_field_widget_entity_reference_paragraphs_form_alter (& $ element, & $ form_state, $ context) {

$ element['subform']['field_course']['widget']['#ajax']    = [
                  'callback' => 'get_competency',
                  'event' => 'change',
                  'method' => 'html',
                  'wrapper' => 'edit-competency-'.$uuid_value,
                ];

$ element['subform']['field_competency']['widget']['#attributes']['id']= & # 39; processing competence - & # 39 ;. $ uuid_value;

}



Function get_competency (Array & $ element, FormStateInterface $ form_state, $ context) {

$ triggeringElement = $ form_state-> getTriggeringElement ();
$ value = $ triggeringElement['#value'];

$ gt =  Drupal :: service (& # 39; generic_templates.utility & # 39;);
$ options = $ gt-> getCompetency ($ value);
$ options = ["_none" => "- Select a value -"] + $ options;
$ wrapper_id = $ triggeringElement["#ajax"]["wrapper"];

$ gt =  Drupal :: service (& # 39; generic_templates.utility & # 39;);
$ options = $ gt-> getCompetency ($ value);
$ options = ["_none" => "- Select a value -"] + $ options;
$ renderingField = & # 39; & # 39 ;;

foreach ($ options as $ key => $ value) {
$ renderingField. = "";
}

$ response = new AjaxResponse ();
$ response-> addCommand (new HtmlCommand (# #; # $ wrapper_id, $ renderingField));
return $ response;
}

What is required to display a View menu item as a link on the Drupal 7 Administration page?

I'll create several views to use as reports. Since they all have a common theme, I group the views under a subpath of admin / reports (E.g. admin / reports / data / needs_correction and admin / reports / data / status).

Most admin sections in Drupal usually have a landing page that lists the entire sub-content of the section. To ensure this, I have implemented hook_menu () in the function that contains the exported report views, as follows:

/ **
* Implemented hook_menu ().
* /
Function MY_menu () {
$ items = array ();

$ items['admin/reports/data'] = array (
& # 39; title & # 39; => & # 39; Data Reports & # 39 ;,
& # 39; description & # 39; => & # 39; Various reports on the status of the data in the system. & # 39 ;,
& # 39; & # 39 position; => & # 39; left & # 39 ;,
& # 39; page callback & # 39; => & # 39; system_admin_menu_block_page & # 39 ;,
& # 39; access arguments & # 39; => array (& # 39; access to administration pages & # 39;),
& # 39; file & # 39; => & # 39; system.admin.inc & # 39 ;,
& # 39; file path & # 39; => drupal_get_path (module # 39; system # 39),
);

return $ items;
}

The only problem is that I navigate after deleting a cache admin / reports / dataI only get the message "You have no administrative elements."

views – "The following CGIs are not protected by a random token" scan error for Drupal 7 site

A scan run on my Dev Drupal 7 website displays the following error:

The following CGIs are not protected by a random token:
/ contact-ocr
/ Citizens Coordinators

The content of these 2 URLs is generated by a view, which content is changed via its associated tpl.php files.

How can I ensure that a random token is generated for these pages?

How can I confirm the generation of a random token while displaying the page source after a random token is generated?

acquia dev desktop – Local clone of the live Drupal 7 site for the D8 upgrade process

In Acquia Dev Desktop (version 2, stack version: e13d3f0), a new, empty local D8 development site was created. Now I want to clone a manufacturing facility that is currently in D7 to do both a migration to D8 and a redesign.

The existing D7 code and the last database dump (via the Backup & Migrate module) were copied to the local computer. I tried to add this in Dev Desktop to the list containing the empty D8 site described above. (I expected that both the old D7 site and the new D8 site could be executed by Dev Desktop.) So I load the D7 site codebase and import the database file. But every time I try, Dev Desktop tells me that the file type ".mysql" is not recognized. So I go to phpMyAdmin and import the file there into the specified and from Dev desktop linked empty database.

When I go to the site URL displayed in Dev Desktop, I never get the D7 site – I only get the new, empty D8 site. Why does this happen and how is it corrected?

Installation – Problems occur when Drupal runs the evaluation demo on Windows 10

I installed xampp and started Apache and mysql, which started without errors (I did not change any ports etc., so that's all standard).

If I use the & # 39; PHP kernel / scripts / Drupal quickstart demo_umami & # 39; starting from the XAMPP shell, everything works fine and gets installed. When the browser (Chrome) exits and starts, I get a virus detection message from my antivirus program (AVG):

& # 39; # 39 & .ht.router.php; contains the virus & # 39; IDP.Generic & # 39; – I scanned the Drupal Zip file without any problem and checked the anti-virus website for more information. Be careful if this is not what you normally use.

I have repeated the installation in a sandbox, and if I apply an exception for the virus message, Drupal will start in my browser, but it will run very slowly and still report "unresponsive" messages. When I try to use Drupal in the XAMPP shell with the shortcut CTRL-C, nothing happens. So I can not close Drupal and it looks like it crashed.

Any idea what's going on here? – I got both Drupal and XAMPP from the Drupal website, so I think the virus report may be false positive, but that does not explain the problem of slow running and crash of Drupal.

Any help would be appreciated.