How to force add product B to add product A in Drupal 7?

I’m looking for an easy way to connect two products to each other when placing an order, while at the same time forcing the user to create an association if it does not already exist. In principle, the user can through hosting, but to complete the verification, they also need a domain name. I have classes for each, but I'm trying to come up with ways to solve two problems:

  • In test mode, display that the two products are connected
  • Force user to create association

Any ideas on what I can use for this?

UPDATE

What I've done:

  • Two separate products created
  • If you add it, it will check if this item has been associated with another product.
  • If not, you will be taken to a user page, forcing you to add and assign another product.

It works, but it is not very elegant. Any best offers would be highly appreciated.

+4
source share
1 answer

Use the rules to display messages to the user. Use the "add to basket" event, check the type of product, then check if the related product has been added to the basket, if there is no message that you also need to add the hosting package and automatically redirect it there. Then, when checking, check if one of these products exists, does the other exist in the basket? Throw the same message and automatically redirect them to the missing one.

, . , .

0

Source: https://habr.com/ru/post/1570301/


All Articles