/**
  * @return mixed
  */
 public function actionHlxml()
 {
     Yii::$app->response->format = Response::FORMAT_RAW;
     $headers = Yii::$app->response->headers;
     $headers->add('Content-Type', 'text/xml; charset=UTF-8');
     return $this->renderPartial('hlxml', ['categories' => Category::find()->all(), 'products' => Product::findAll(['export' => true]), 'date' => ProductTranslation::find()->orderBy(['update_time' => SORT_DESC])->one()->update_time]);
 }
Example #2
0
<?php

include_once 'tools.php';
//$query = "SELECT * FROM product";
//$prodList = array();
//if ($result = $connect->query($query)) {
//  while ($row = $result->fetch_object()) {
//    $prodList[] = $row;
//}
$product = new Product();
$prodList = $product->findAll($connect);
//$connect->close();
if (!empty($prodList)) {
    echo '<ul class="product-list">';
    $index = 1;
    foreach ($prodList as $product) {
        $itemClass = $index % 2 === 0 ? 'item-even' : 'item-odd';
        ?>
        <li class="item <?php 
        echo $itemClass;
        ?>
">
            <div class="index">
                <?php 
        echo $index++;
        ?>
  
            </div>
            <div class="title">
                <?php 
        echo $product->title;
 public function getParamsMaxBounds($refresh = false)
 {
     if ($this->_paramsMaxBounds == null || $refresh) {
         $bounds = array();
         $model = new Product();
         $criteria = $this->_getSearchCriteria(true);
         //$model->attachEavSet(1);
         /*
                     $criteria = $this->_searchCriteria !== null
            ? $this->_searchCriteria
            : new CDbCriteria();
         *
         */
         $criteria->select = 't.id';
         $a = $model->findAll($criteria);
         var_dump($a);
         $productsIds = CHtml::listData($a, 'id', 'id');
         foreach ($this->getEavAttributesList() as $name => $attr) {
             if ($attr->data_type == EavAttribute::DATA_TYPE_NUMERIC) {
                 $c = new CDbCriteria();
                 $c->select = 'MAX(`value`) as `maxValue`';
                 if (is_array($productsIds) && !empty($productsIds)) {
                     $c->addInCondition('entity_id', $productsIds);
                 }
                 $c->addCondition('eav_attribute_id = :eav_attribute_id');
                 $c->params[':eav_attribute_id'] = $attr->id;
                 $max = NumericDataType::model()->find($c);
                 $bounds[$name] = $max->maxValue;
             }
         }
         $this->_paramsMaxBounds = $bounds;
     }
     return $this->_paramsMaxBounds;
 }
 public function products_all()
 {
     $page = isset($_GET['page']) ? $_GET['page'] : 1;
     $per_page = 16;
     $products_total = Product::findAll();
     $products = Product::findAll(array('limit' => $per_page, 'offset' => ($page - 1) * $per_page));
     return $this->_product_grid($products, $products_total, $page, $per_page);
 }