You are here

public function XquantityOrderItem::quantityPriceApplies in Commerce Extended Quantity 8

2 calls to XquantityOrderItem::quantityPriceApplies()
XquantityOrderItem::getQuantityPrice in src/Entity/XquantityOrderItem.php
XquantityOrderItem::setQuantityPrices in src/Entity/XquantityOrderItem.php

File

src/Entity/XquantityOrderItem.php, line 231

Class

XquantityOrderItem
Overrides the order item entity class.

Namespace

Drupal\commerce_xquantity\Entity

Code

public function quantityPriceApplies(array $qty_price, array $data) {
  $list = $week_days = $time_start = $time_end = $date_start = $date_end = $variation_ids = $product_ids = $variation_types = $product_types = $stores = $roles = NULL;
  extract($qty_price + $data);
  $current = time();
  if ($list && !$list_price || $week_days && !in_array(date('l'), array_map('trim', explode(PHP_EOL, $week_days))) || $time_start && strtotime($time_start) > $current || $time_end && strtotime($time_end) < $current || $date_start && strtotime($date_start) > $current || $date_end && strtotime($date_end) < $current || $variation_ids && !in_array($variation_id, array_map('trim', explode(PHP_EOL, $variation_ids))) || $product_ids && !in_array($product_id, array_map('trim', explode(PHP_EOL, $product_ids))) || $variation_types && !in_array($variation_type, array_map('trim', explode(PHP_EOL, $variation_types))) || $product_types && !in_array($product_type, array_map('trim', explode(PHP_EOL, $product_types))) || $stores && !array_intersect($product_stores, array_map('trim', explode(PHP_EOL, $stores))) || $roles && !array_intersect($current_roles, array_map('trim', explode(PHP_EOL, $roles)))) {
    return FALSE;
  }
  return TRUE;
}