Skip to content

In this collection This BEst seller give me error it’s not working, unable to sort by best seller ASC, DESC not working in this condition

public function getProductCollection() { $objectManager = MagentoFrameworkAppObjectManager::getInstance(); $filterableAttributes = $objectManager->create(MagentoCatalogModelLayerCategoryFilterableAttributeList::class); $attributes = $filterableAttributes->getList(); $price=$this->getRequest()->getParam(‘price’); $cat=$this->getRequest()->getParam(‘cat’); $sortby=$this->getRequest()->getParam(‘product_list_order’); if (empty($sortby)) { $sortby=’position’; } $listdesc=$this->getRequest()->getParam(‘product_list_dir’); $page=($this->getRequest()->getParam(‘p’))? $this->getRequest()->getParam(‘p’) : 1; //get values of current limit $pageSize=($this->getRequest()->getParam(‘limit’))? $this->getRequest()->getParam(‘limit’) : 3; $collection = $this->_productCollectionFactory->create(); $collection->addAttributeToSelect(‘*’); $collection->setOrder(‘title’,’ASC’);… Read More »In this collection This BEst seller give me error it’s not working, unable to sort by best seller ASC, DESC not working in this condition

Country Dropdown For Custom Product Attribute does not work

I am trying to create a country dropdown for a custom product attribute. This is the error message: Error: Call to undefined method MagentoDirectoryModelConfigSourceCountry::setAttribute() in /var/www/html/vendor/magento/module-eav/Model/Entity/Attribute/AbstractAttribute.php:652 This is my install: $eavSetup->addAttribute( MagentoCatalogModelProduct::ENTITY, ‘countries’, [ ‘group’ => ‘Countries’, ‘type’ => ‘text’,… Read More »Country Dropdown For Custom Product Attribute does not work

How to add category select in admin block page without UI component?

I am trying to add category selector in my block page without UI component. This is my block file. <?php namespace UedakanamonoBannerSliderBlockAdminhtmlBannerEditTab; use MagentoBackendBlockTemplateContext; use MagentoBackendBlockWidgetButton; use MagentoBackendBlockWidgetFormElementDependence; use MagentoBackendBlockWidgetFormGeneric; use MagentoBackendBlockWidgetTabTabInterface; use MagentoCmsModelWysiwygConfig as WysiwygConfig; use MagentoConfigModelConfigSourceEnabledisable; use MagentoConfigModelConfigStructureElementDependencyFieldFactory;… Read More »How to add category select in admin block page without UI component?