Exemple #1
0
 /**
  * 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);
 }
Exemple #2
0
 /**
  * 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);
 }
Exemple #3
0
 /**
  * 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();
 }
Exemple #4
0
 /**
  * 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();
 }
Exemple #5
0
 /**
  * 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;
 }
Exemple #6
0
 /**
  * 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);
 }