Skip to main content

Posts

Magento 2 Search Programatically

public function getSearchedProductIds($searchTerm){ //$searchTerm = "UKF8001"; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $searchCriteriaBuilder = $objectManager->create('Magento\Framework\Api\Search\SearchCriteriaFactory'); $filterBuilder = $objectManager->create('Magento\Framework\Api\FilterBuilder'); $filterGroupBuilder = $objectManager->create('Magento\Framework\Api\Search\FilterGroupBuilder'); $searchInterface = $objectManager->create('Magento\Framework\Api\Search\SearchInterface'); $sortOrder = $objectManager->create('Magento\Framework\Api\SortOrder'); $search_criteria = $searchCriteriaBuilder->create(); $search_criteria->setRequestName("quick_search_container"); $filter = $filterBuilder->setField('search_term') ->setValue($searchTerm) ->setConditionType("like") ->create(); $filterGroup = $filterGroupB...

Dynamic System Config in Magento

Like Below System.xml <delivery_shipping> <label>Select Delivery Days</label> <frontend_model>exportorder/options</frontend_model> <backend_model>adminhtml/system_config_backend_serialized_array</backend_model> <sort_order>1</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <comment>Set delivery delay in days respective of shipping method</comment> </delivery_shipping>

Custom Tier Price Block In Magento

<?php echo $this->getLayout()->createBlock('catalog/product_price') ->setTemplate('catalog/product/view/tierprices1.phtml') ->setProduct($_product) ->setName('tier_' . $_product->getId()) ->setInGrouped($_product->isGrouped()) ->setParent(null) ->callParentToHtml(); ?>

Find Duplicate Url In Magento

Find Duplicate Product Url SELECT Count(*),value FROM catalog_product_entity_varchar v WHERE EXISTS (SELECT * FROM eav_attribute a WHERE attribute_code = "url_key" AND v.attribute_id = a.attribute_id AND EXISTS (SELECT * FROM eav_entity_type e WHERE entity_type_code = "catalog_product" AND a.entity_type_id = e.entity_type_id )) AND store_id = 0 GROUP BY v.value HAVING Count(*) > 1 Find Duplicate Category Url SELECT Count(*),value FROM catalog_category_entity_varchar v WHERE EXISTS (SELECT * FROM eav_attribute a WHERE attribute_code = "url_key" AND v.attribute_id = a.attribute_id AND EXISTS (SELECT * FROM eav_entity_type e WHERE entity_type_code = "catalog_cate...

Custom Layered Navigation in Magento

for category page <? php $_filters = Mage :: getSingleton ( 'catalog/layer' )-> getState ()-> getFilters (); foreach ( $_filters as $_filter ):?> <? php echo $this -> stripTags ( $_filter -> getLabel ()) ?> <a href=” <? php echo $_filter -> getRemoveUrl () ?> ” title=” <? php echo $this -> __ ( 'Remove This Item' ) ?> ”> <? php echo $this -> __ ( 'Remove This Item' ) ?> </a> <? php endforeach ; ?> for search page <? php $_filters = Mage :: getSingleton ( 'catalogsearch/layer' )-> getState ()-> getFilters (); foreach ( $_filters as $_filter ):?> <? php echo $this -> stripTags ( $_filter -> getLabel ()) ?> <a href=” <? php echo $_filter -> getRemoveUrl () ?> ” title=” <? php echo $this -> __ ( 'Remove This Item' ) ?> ”> <? php echo $this -> __ ( 'Remove This Item' ) ?> </a> ...