Example #1
0
 function createBread($whatCatSearch)
 {
     global $createBreadArray;
     $catArray = \common\models\EbayCategory::find()->where(['category_id' => $whatCatSearch])->asArray()->all();
     if (isset($catArray[0]['category_id'])) {
         $createBreadArray[] = ['label' => $catArray[0]['category_name'], 'category_id' => $catArray[0]['category_id']];
         createBread($catArray[0]['category_parent_id']);
         return $createBreadArray;
     }
 }
Example #2
0
 private function addCatsToDB($cats, $rootParent)
 {
     foreach ($cats['CategoryArray']['Category'] as $row) {
         $ebay_cat = EbayCategory::findOne(['category_id' => $row['CategoryID']]);
         if (!empty($ebay_cat->category_id)) {
             continue;
         }
         $ebaycategory = new EbayCategory();
         $ebaycategory->category_id = $row['CategoryID'];
         $ebaycategory->category_parent_id = $row['CategoryParentID'][0];
         $ebaycategory->category_level = $row['CategoryLevel'];
         $ebaycategory->category_name = $row['CategoryName'];
         $ebaycategory->category_root_parent = $rootParent;
         $ebaycategory->save();
     }
 }
Example #3
0
use yii\helpers\Url;
$this->title = 'BayEbay - Каталог';
$this->params['myMod'][] = $model;
?>
<div class="row">
    <?php 
if ($result !== false) {
    foreach ($result as $value1) {
        if (!isset($value1['galleryURL'])) {
            $value1['galleryURL'] = "imgs/image-not-found.jpg";
        }
        echo "\n                  <div class=\"col-md-4\" style=\"height:400px;\">\n                      <div class=\"panel panel-default item_box\">\n                          <table class=\"table table-striped\">\n                              <tr>\n                                  <td class=\"item_title\" style=\"height:80px;\"><h5 class=\"\"><a href=\"" . Url::to(['site/single', 'ebayitemid' => $value1['ebay_item_id']]) . "\" >" . $value1['title'] . "</a></h5></td>\n                              </tr>\n                              <tr>\n                                  <td class=\"item_img\" align=\"center\"><img src=\"" . $value1['galleryURL'] . "\" class=\"img-responsive\" style=\"height:220px; width:100%;\" alt=\"" . $value1['title'] . "\"></td>\n                              </tr>\n                              <tr class=\"\">\n                                  <td class=\"\">\n\n                      <span class=\"glyphicon glyphicon-rub btn-sm\"></span><span class=\"item_price\">" . $value1['price_shipping_sum'] . "</span>\n                      <button class=\"btn btn-default btn-sm pull-right addToCart\" data-id=\"" . $value1['ebay_item_id'] . "\">Купить сейчас <span class=\"glyphicon glyphicon-shopping-cart\" aria-hidden=\"true\"></span>\n                    </td>\n                              </tr>\n                          </table>\n                      </div>\n                  </div>\n        ";
    }
} elseif (isset($model->emptyResponse)) {
    if ($model->emptyResponse) {
        $ebay_cat = EbayCategory::findOne(['category_id' => $model->queryCategory]);
        echo '<div class="col-md-4">К сожалению, по вашему запросу <b>"' . $model->queryText . '"</b> в категории <b>"' . $ebay_cat->category_name . '"</b> ничего не найдено... Попробуйте изменить параметры поиска.</div>';
    }
}
?>
</div>

<?php 
if (!$model == false) {
    $modelPageCount = $model->pageCount;
    $pageOut = "";
    $pageActive = "";
    $pageStart = (int) $model->queryPage - 5;
    if ($pageStart <= 0) {
        $pageStart = 1;
    }