Git: Reset to older commit / Undo changes & Push

This article shows how you can reset your git state to any older/previous commit and then push to your origin repository. Reset to older commit git reset –hard <commit-hash> Example: git reset –hard 39fdf70 Force push to origin repository git push origin –force # OR git push –force If you only want to reset in … Read more

Git: HEAD, Detached HEAD & Reset HEAD

What is Git HEAD? “HEAD” is an alias for your current working commit. It’s the latest commit of your currently checked out branch. If you checkout a another branch then HEAD will be the latest commit in that particular branch. Check Git HEAD status The following shows that the working directory is the tip of … Read more

jQuery: Uncaught TypeError: url.indexOf is not a function

I got the “url.indexOf and e.indexOf is not a function” errors on my website. I got this error after my upgrade to my Magento webshop, but this error can happen on any website with a jQuery version upgrade. Error: Uncaught TypeError: e.indexOf is not a function at w.fn.load (jquery-3.3.1.min.js:2:82468) at caribbean-montego-mntgo-shell:1483:19 at Object.execCb (require.js:1696:33) at … Read more

Magento 2: Clean Fastly or Varnish Cache by Cache Tag Programmatically

This article shows how you can clean Fastly Cache or Varnish Cache by cache tags in Magento. Fastly has an observer that listens to the event clean_cache_by_tags. vendor/fastly/magento2/etc/events.xml (github) <event name="clean_cache_by_tags"> <observer name="flush_fastly_cdn" instance="Fastly\Cdn\Observer\InvalidateVarnishObserver"/> </event> The \Fastly\Cdn\Observer\InvalidateVarnishObserver class further calls the \Fastly\Cdn\Model\PurgeCache::sendPurgeRequest($pattern) method which finally cleans the Fastly Cache utilizing \Fastly\Cdn\Model\Api. Magento’s Cache_Invalidate module has … Read more

Magento 2: Clean Cache by Cache Tags Programmatically

This article shows how you can clean cache by cache tags in Magento. use Magento\Framework\App\CacheInterface; class YourClassName { /** * @var CacheInterface */ protected $cache; /** … * @param CacheInterface $cache */ public function __construct( … CacheInterface $cache ) { … $this->cache = $cache; } /** * Clean Cache by Cache Tag * * @param … Read more

Magento 2: Enable/Disable Cache Programmatically

This article shows how you can enable or disable Magento Cache Programmatically. For this purpose, we will be using \Magento\Framework\App\Cache\Manager class. use Magento\Framework\App\Cache\Manager as CacheManager; class YourClassName { /** * @var CacheManager */ protected $cacheManager; /** … * @param CacheManager $cacheManager */ public function __construct( … CacheManager $cacheManager ) { … $this->cacheManager = $cacheManager; } … Read more

Magento 2: Get, Clean and Flush Cache Programmatically

This article shows how you can get the list of all Cache Types in Magento and how you can clean and flush those Cache Types in Magento. Cache Types in Magento Magento has the following cache types: Configuration (config) Commerce collects configuration from all modules, merges it, and saves the merged result to the cache. … Read more

Magento 2: Search Repository using SearchCriteriaBuilder, Filter & FilterGroup

This article shows how we can search Magento Repositories using SearchCriteriaBuilder that implements SearchCriteriaInterface. An example is provided of how we can perform search on Product repository in Magento. Similarly, we can search for other entities like Category, Customer, Order, Invoice, CMS Page, CMS Block, etc. We can add different conditions to build custom search … Read more