#StackBounty: #8 #entities #commerce Allow some products to be sold only in bundles (groups) with some other products

Bounty: 50

I’m making commerce site with Drupal 8 and Drupal commerce and I have not so common request. Some of the products should be available to buy only in groups (bundles) with some other products. I.e. if you want to buy product A in quantity 100 you must also buy product B, product C and/or product D and sum of them (B+C+D) must also be 100. Other way it shouldn’t be possible to buy any of them separately.

I saw that there are some Bundle modules (not even sure if they could fulfill this request), but they exist only for Drupal 7.

So is there some module for D8 which will allow grouping products like this. If not what would be the best way to achieve this feature?


Get this bounty!!!

#StackBounty: #7 #entities #tokens After saving entity bundle, entity_get_info('node') missing 'token type' property

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!

#StackBounty: #7 #entities #tokens After saving entity bundle, entity_get_info('node') missing 'token type' property

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!

#StackBounty: #7 #entities #tokens After saving entity bundle, entity_get_info('node') missing 'token type' property

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!

#StackBounty: #7 #entities #nodes #tokens After saving entity bundle, entity_get_info('node') missing 'token type' prop…

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!

#StackBounty: #7 #entities #nodes #tokens After saving entity bundle, entity_get_info('node') missing 'token type' prop…

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!

#StackBounty: #7 #entities #nodes #tokens After saving entity bundle, entity_get_info('node') missing 'token type' prop…

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!

#StackBounty: #7 #entities #nodes #tokens After saving entity bundle, entity_get_info('node') missing 'token type' prop…

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!

#StackBounty: #7 #entities #nodes #tokens After saving entity bundle, entity_get_info('node') missing 'token type' prop…

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!

#StackBounty: #7 #entities #nodes #tokens After saving entity bundle, entity_get_info('node') missing 'token type' prop…

Bounty: 50

After saving any entity bundle, e.g. node type on admin/structure/types/manage/node-type page, node ‘token type’ is gone:

$info = entity_get_info('node');
// isset($info['token type'])) == FALSE

After I change common.inc to regenerate entity info like this

if (FALSE && $cache = cache_get("entity_info:$langcode")) {
  $entity_info = $cache->data;
}

it started to work as expected.

Only ‘node’ entity type is affected.

In order to fix this I had to patch entity_get_info:

   $entity_info = &$drupal_static_fast['entity_info'];

+  if (!empty($entity_info) && !isset($entity_info['node']['token type'])) {
+    $entity_info = NULL;
+  }
+
   // hook_entity_info() includes translated strings, so each language is cached
   // separately.
   $langcode = $language->language;
@@ -7857,7 +7861,7 @@ function entity_get_info($entity_type = NULL) {
     if ($cache = cache_get("entity_info:$langcode")) {
       $entity_info = $cache->data;
     }
-    else {
+    if (empty($entity_info) || !isset($entity_info['node']['token type'])) {
       $entity_info = module_invoke_all('entity_info');

What can be the root cause of this issue and how can it be fixed?

I searched for an answer and found several similar questions on Drupal.org, but the only recommended thing is to clear cache several times (which does not even help in my case).


Get this bounty!!!