/** * Build metod name * * @param \XLite\Model\AEntity $entity Entity * @param string $pattern Pattern * * @return string */ protected function buildMetodName(\XLite\Model\AEntity $entity, $pattern) { return static::TYPE_DISCOUNTS == $entity->getId() ? sprintf($pattern, 'Discounts') : parent::buildMetodName($entity, $pattern); }
/** * Build metod name * * @param \XLite\Model\AEntity $entity Entity * @param string $pattern Pattern * * @return string */ protected function buildMetodName(\XLite\Model\AEntity $entity, $pattern) { return static::TYPE_COUPONS == $entity->getId() ? sprintf($pattern, 'Coupons') : parent::buildMetodName($entity, $pattern); }
/** * Check - specified card is default or not * * @param \XLite\Model\AEntity $entity Model OPTIONAL * * @return boolean */ public function isDefaultCard(\XLite\Model\AEntity $entity = null) { return $entity && $entity->getId() == $this->getCustomerProfile()->getDefaultCardId(); }
/** * Is default entity * * @param \XLite\Model\AEntity $entity Line * * @return boolean */ protected function isDefaultEntity(\XLite\Model\AEntity $entity) { return isset($this->requestData['defaultValue']) && $this->requestData['defaultValue'] == $entity->getId(); }
/** * Build metod name * * @param \XLite\Model\AEntity $entity Entity * @param string $pattern Pattern * * @return string */ protected function buildMetodName(\XLite\Model\AEntity $entity, $pattern) { switch ($entity->getId()) { case static::TYPE_PRODUCTS: $name = 'Products'; break; case static::TYPE_CATEGORIES: $name = 'Categories'; break; case static::TYPE_ORDERS: $name = 'Orders'; break; case static::TYPE_CUSTOMERS: $name = 'Customers'; break; default: } return $name ? sprintf($pattern, $name) : null; }
/** * Get edit link params string * * @param \XLite\Model\AEntity $entity Entity * @param array $column Column data * * @return string */ protected function getEditLinkAttributes(\XLite\Model\AEntity $entity, array $column) { $params = array(); $params[] = 'data-id=' . $entity->getId(); if ($entity->getProductClass()) { $params[] = 'data-class-id=' . $entity->getProductClass()->getId(); } return parent::getEditLinkAttributes($entity, $column) . implode(' ', $params); }