Drupal 7: Programatically update Rules status

Rules is a custom module in Drupal. Used to trigger some actions when any operations or condition satisfies. The Actions like send email, Node creates, Node update, Redirect writing logs, etc, Each rule has its own configuration and settings. We can programmatically update rules by its machine names. The below is the sample code and syntax for updating rules status.

Drupal 7: Ubercart load, access and update order details with example

The Ubercart is the E-Commerce management concept in Drupal. The contributed module Ubercart help us to achieve commerce-related features. The below example helps to load, Access and Update the Ubercart order information. The function uc_order_load() help to achieve this features.

Drupal 8: Load all term Id of vocabulary

In Drupal, we group the multiple taxonomy terms into vocabularies. The taxonomy terms are the mainly used for the group the node contents. The Drupal 8 is basically based on the Object Oriented concepts. The core class Term will help to load the taxonomy term information. With the help of entity query, we load the taxonomy term information from the vocabulary machine name. The below syntax and example of loading the taxonomy terms by vocabulary.

Symfony: Get current Class name(with Drupal 8)

The Symfony is the PHP framework and also one of the most popular and powerful frameworks on nowadays. In Symfony, we completely using the OOPs concept to achieve our features. The below example will demonstrate how to get the Current executing call name. The core "ReflectionClass" class help to get the details of the current class information.

Drupal Commerce: Get order Id from the coupon Id[Sample Code]

In Drupal 7 Commerce, we have the contributed module Discount that helps to alter the Product base price based on some conditions. The coupons is another module which redeems the discount by using the coupon codes. If the coupon is added to the order, an additional property called "commerce_coupon" is added to order. The coupon module has its own table called "commerce_coupon", which holds the coupon details. In a commerce_coupon table, each coupon has their own unique id.

Drupal Commerce: Get order quantity from order_id with sample code

In Drupal, commerce order contains multiple products. These products are attached to the line item to the orders. The line item table holds the information about the quantities and other information. The below is the simplest code to get the quantity of the order with different products.