예제 #1
0
 /**
  * Constructor
  *
  * @param array $data Entity properties OPTIONAL
  */
 public function __construct(array $data = array())
 {
     parent::__construct();
     if (!empty($data)) {
         $this->map($data);
     }
 }
예제 #2
0
 /**
  * Get products list
  *
  * @param integer $productId  Current product ID
  * @param array   $productIds Product ID which must be excluded from the search result
  * @param integer $maxCount   Maximum number of products
  *
  * @return array
  */
 public function getSourceRelatedProducts($productId, $productIds, $maxCount)
 {
     $result = array();
     $cnd = new \XLite\Core\CommonCell();
     if ($productIds) {
         $cnd->{\XLite\Module\XC\Upselling\Model\Repo\UpsellingProduct::SEARCH_EXCL_PRODUCT_ID} = $productIds;
     }
     $cnd->{\XLite\Module\XC\Upselling\Model\Repo\UpsellingProduct::SEARCH_PARENT_PRODUCT_ID} = $productId;
     $cnd->{\XLite\Module\XC\Upselling\Model\Repo\UpsellingProduct::SEARCH_DATE} = \XLite\Core\Converter::getDayEnd(\XLite\Base\SuperClass::getUserTime());
     $cnd->{\XLite\Module\XC\Upselling\Model\Repo\UpsellingProduct::SEARCH_LIMIT} = array(0, $maxCount + 1);
     $products = \XLite\Core\Database::getRepo('XLite\\Module\\XC\\Upselling\\Model\\UpsellingProduct')->search($cnd, false);
     foreach ($products as $product) {
         $result[] = $product->getProduct();
     }
     return $result;
 }
예제 #3
0
 /**
  * Adds additional condition to the query for checking if product is up-to-date
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder object
  * @param string                     $alias        Entity alias OPTIONAL
  *
  * @return void
  */
 protected function addDateCondition(\Doctrine\ORM\QueryBuilder $queryBuilder, $alias = null)
 {
     if (!\XLite::isAdminZone()) {
         $alias = $alias ?: $queryBuilder->getRootAlias();
         $queryBuilder->andWhere($alias . '.arrivalDate < :now')->setParameter('now', \XLite\Core\Converter::getDayEnd(\XLite\Base\SuperClass::getUserTime()));
     }
 }
예제 #4
0
     * It's not possible to instantiate a derived class (using the "new" operator)
     * until that child class is not implemented public constructor
     *
     * @return void
     */
    protected function __construct()
    {
    }
    /**
     * Stop script execution
     *
     * :FIXME: - must be static
     *
     * @param string $message Text to display
     *
     * @return void
     */
    protected function doDie($message)
    {
        if (!$this instanceof \XLite\Logger) {
            \XLite\Logger::getInstance()->log($message, LOG_ERR);
        }
        if ($this instanceof XLite || \XLite::getInstance()->getOptions(array('log_details', 'suppress_errors'))) {
            $message = 'Internal error. Contact the site administrator.';
        }
        die($message);
    }
}
// Call static constructor
\XLite\Base\SuperClass::__constructStatic();
예제 #5
0
 /**
  * Public class constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct();
 }
예제 #6
0
 /**
  * Prepare certain search condition
  *
  * @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare
  * @param string                     $value        Condition data
  *
  * @return void
  */
 protected function prepareCndInStock(\Doctrine\ORM\QueryBuilder $queryBuilder, $value)
 {
     if ($value) {
         $queryBuilder->innerJoinInventory()->andWhere('i.amount > :zero OR i.enabled = 0')->setParameter('zero', 0)->andWhere('p.arrivalDate < :now')->setParameter('now', \XLite\Core\Converter::getDayEnd(\XLite\Base\SuperClass::getUserTime()));
     }
 }
예제 #7
0
 /**
  * Return params list to use for search
  *
  * @param \XLite\Core\CommonCell $cnd Initial search conditions
  *
  * @return \XLite\Core\CommonCell
  */
 protected function getSearchConditions(\XLite\Core\CommonCell $cnd)
 {
     $currentDate = \XLite\Core\Converter::getDayEnd(\XLite\Base\SuperClass::getUserTime());
     $cnd->{\XLite\Module\CDev\ProductAdvisor\Model\Repo\Product::P_ARRIVAL_DATE} = array($currentDate, null);
     $cnd->{\XLite\Model\Repo\Product::P_ORDER_BY} = array('p.arrivalDate', 'ASC');
     return $cnd;
 }