Get most purchased category.

@return string
181162
public function getMostPurCategory()
    {
        $categories = '';
        $productId = $this->model->getProductIdForMostSoldProduct();
        //sales data found for customer with product id
        if ($productId) {
            $product = $this->getProduct($productId);
            //product found
            if ($product->getId()) {
                $categoryIds = $product->getCategoryIds();
                if (count($categoryIds)) {
                    $categories = $this->getCategoryNames($categoryIds);
                }
            }
        }

        return $categories;
    }
816007
public function getCategory() : ?string 
    {
        if ( ! $this->hasCategory()) {
            $this->setCategory($this->getDefaultCategory());
        }
        return $this->category;
    }
972390
public function getDisplayType()
    {
        $mode = $this->context->getRequest()->getActionName();

        $type = '';

        switch ($mode) {
            case 'related':
                $type = $this->getRelatedProductsType();
                break;
            case 'upsell':
                $type = $this->getUpsellProductsType();
                break;
            case 'crosssell':
                $type = $this->getCrosssellProductsType();
                break;
            case 'bestsellers':
                $type = $this->getBestSellerProductsType();
                break;
            case 'mostviewed':
                $type = $this->getMostViewedProductsType();
                break;
            case 'recentlyviewed':
                $type = $this->getRecentlyviewedProductsType();
                break;
            case 'push':
                $type = $this->getProductpushProductsType();
        }

        return $type;
    }
26463
protected function getListCategoryGroup()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            return $this->category_group->getList(array('limit' => $this->getLimit()));
        }

        if ($this->getParam('type')) {
            return $this->category_group->getList(array('type' => $id, 'limit' => $this->getLimit()));
        }

        if (!is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        if ($this->getParam('store')) {
            return $this->category_group->getList(array('store_id' => $id, 'limit' => $this->getLimit()));
        }

        $result = $this->category_group->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
250028
public function getPurchasedAt() : ?int 
    {
        if ( ! $this->hasPurchasedAt()) {
            $this->setPurchasedAt($this->getDefaultPurchasedAt());
        }
        return $this->purchasedAt;
    }
475412
public function getVatPercent()
    {
        return \OxidEsales\Eshop\Core\Registry::getLang()->formatVat($this->getPrice()->getVat());
    }
1327852
public function getCmsCategories()
    {
        $categories = array('' => 'No category');

        $results = $this->getEventManager()
            ->trigger(__FUNCTION__, $this, array(
            'categories' => $categories
            ))
            ->last();

        if ($results) {
            $categories = $results;
        }

        return $categories;
    }
995728
protected function _getProductLinkType()
    {
        $categoryType = OXARTICLE_LINKTYPE_CATEGORY;
        if (($category = $this->getActiveCategory()) && $category->isPriceCategory()) {
            $categoryType = OXARTICLE_LINKTYPE_PRICECATEGORY;
        }

        return $categoryType;
    }
1274535
public function getActCategory()
    {
        $oCat = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);

        return ($oCat->load($this->getActCatId())) ? $oCat : null;
    }
769706
static function fetchProductCountByCategory( $categoryID )
    {
        $ini = eZINI::instance( 'shop.ini' );
        if ( !$ini->hasVariable( 'VATSettings', 'ProductCategoryAttribute' ) ||
             !$categoryAttrName = $ini->variable( 'VATSettings', 'ProductCategoryAttribute' ) )
            return 0;

        $db = eZDB::instance();
        $categoryID =(int) $categoryID;
        $categoryAttrName = $db->escapeString( $categoryAttrName );
        $query = "SELECT COUNT(*) AS count " .
                 " FROM ezcontentobject_attribute coa, ezcontentclass_attribute cca, ezcontentobject co " .
                 "WHERE " .
                 " cca.id=coa.contentclassattribute_id " .
                 " AND coa.contentobject_id=co.id " .
                 " AND cca.data_type_string='ezproductcategory' " .
                 " AND cca.identifier='$categoryAttrName' " .
                 " AND coa.version=co.current_version " .
                 " AND coa.data_int=$categoryID";
        $rows = $db->arrayQuery( $query );
        return $rows[0]['count'];
    }
439170
public function getDispSelList()
    {
        if ($this->_aDispSelList === null) {
            if (\OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadSelectLists') && \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('bl_perfLoadSelectListsInAList')) {
                $this->_aDispSelList = $this->getSelectLists();
            }
        }

        return $this->_aDispSelList;
    }
1062735
public function get_parent_category() {
        if ($this->is_category_item() or $this->is_course_item()) {
            return $this->get_item_category();

        } else {
            return grade_category::fetch(array('id'=>$this->categoryid));
        }
    }
1064281
protected function getListProduct()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            return $this->product->getList(array('limit' => $this->getLimit()));
        }

        if (!is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        if ($this->getParam('user')) {
            return $this->product->getList(array('user_id' => $id, 'limit' => $this->getLimit()));
        }

        if ($this->getParam('category')) {
            return $this->product->getList(array('category_id' => $id, 'limit' => $this->getLimit()));
        }

        if ($this->getParam('brand')) {
            return $this->product->getList(array('brand_category_id' => $id, 'limit' => $this->getLimit()));
        }

        if ($this->getParam('class')) {
            return $this->product->getList(array('product_class_id' => $id, 'limit' => $this->getLimit()));
        }

        if ($this->getParam('store')) {
            return $this->product->getList(array('store_id' => $id, 'limit' => $this->getLimit()));
        }

        $result = $this->product->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
1206806
protected function getListCategory()
    {
        $id = $this->getParam(0);

        if (!isset($id)) {
            return $this->category->getList(array('limit' => $this->getLimit()));
        }

        if (!is_numeric($id)) {
            $this->errorAndExit($this->text('Invalid argument'));
        }

        if ($this->getParam('group')) {
            return $this->category->getList(array('category_group_id' => $id, 'limit' => $this->getLimit()));
        }

        if ($this->getParam('parent')) {
            return $this->category->getList(array('parent_id' => $id, 'limit' => $this->getLimit()));
        }

        $result = $this->category->get($id);

        if (empty($result)) {
            $this->errorAndExit($this->text('Unexpected result'));
        }

        return array($result);
    }
588465
public function getFirstCategoryPur()
    {
        $firstOrderId = $this->model->getFirstOrderId();
        $order = $this->orderFactory->create();
        $this->orderResource->load($order, $firstOrderId);
        $categoryIds = $this->getCategoriesFromOrderItems($order->getAllItems());

        return $this->getCategoryNames($categoryIds);
    }
752712
public function getActiveCategory()
    {
        if ($this->_oActCategory === null) {
            $this->_oActCategory = false;
            $category = oxNew(\OxidEsales\Eshop\Application\Model\Category::class);
            if ($category->load($this->getCategoryId())) {
                $this->_oActCategory = $category;
            }
        }

        return $this->_oActCategory;
    }
23449
public function getBidding()
    {
        $items = Item::typeAuction()->active()->whereHas('bids', function ($query) {
            return $query->where('user_id', Auth::user()->userId);
        });

        $items = Item::typeAuction()->active()->leftJoin('bids')->where(
            'bids.user_id',
            Auth::user()->userId
        )->addSelect(
            DB::raw('max(`bids`.`amount`) as `max_bid`')
        )->addSelect(
            DB::raw('count(`bids`.`bid_id`) as `bid_count`')
        )->groupBy('items.item_id');

        $table = new InventoryBidding($items);

        return view('mustard::inventory.bidding', [
            'table' => $table,
            'items' => $table->paginate(),
        ]);
    }