You are here

class AlterProductEvent in Commerce Google Tag Manager 8.2

Same name and namespace in other branches
  1. 8 src/Event/AlterProductEvent.php \Drupal\commerce_google_tag_manager\Event\AlterProductEvent

Event to alter the Enhanced Ecommerce product.

Event to alter product mapped from a commerce product variation.

Hierarchy

  • class \Drupal\commerce_google_tag_manager\Event\AlterProductEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of AlterProductEvent

2 files declare their use of AlterProductEvent
AlterProductEventTest.php in tests/src/Kernel/AlterProductEventTest.php
EventTrackerService.php in src/EventTrackerService.php

File

src/Event/AlterProductEvent.php, line 14

Namespace

Drupal\commerce_google_tag_manager\Event
View source
class AlterProductEvent extends Event {

  /**
   * The Commerce GTM product class.
   *
   * @var \Drupal\commerce_google_tag_manager\Product
   */
  private $product;

  /**
   * The Commerce production variation.
   *
   * @var \Drupal\commerce_product\Entity\ProductVariationInterface
   */
  private $productVariation;

  /**
   * Constructs a AlterProductEvent object.
   *
   * @param \Drupal\commerce_google_tag_manager\Product $product
   *   The Commerce GTM product class.
   * @param \Drupal\commerce_product\Entity\ProductVariationInterface $product_variation
   *   The Commerce production variation.
   */
  public function __construct(Product $product, ProductVariationInterface $product_variation) {
    $this->product = $product;
    $this->productVariation = $product_variation;
  }

  /**
   * Get the product.
   *
   * @return \Drupal\commerce_google_tag_manager\Product
   *   The Commerce GTM product object.
   */
  public function getProduct() {
    return $this->product;
  }

  /**
   * Get the product variation.
   *
   * @return \Drupal\commerce_product\Entity\ProductVariationInterface
   *   The product variation object.
   */
  public function getProductVariation() {
    return $this->productVariation;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AlterProductEvent::$product private property The Commerce GTM product class.
AlterProductEvent::$productVariation private property The Commerce production variation.
AlterProductEvent::getProduct public function Get the product.
AlterProductEvent::getProductVariation public function Get the product variation.
AlterProductEvent::__construct public function Constructs a AlterProductEvent object.