Skip to content

Instantly share code, notes, and snippets.

View IbrahimS2's full-sized avatar
💭
I may be slow to respond.

Ibrahim Saleh IbrahimS2

💭
I may be slow to respond.
View GitHub Profile
@IbrahimS2
IbrahimS2 / clear_cfg_special_price.php
Last active May 24, 2025 09:39
Below is a laser-focused ad-hoc CLI script that does one thing only: If (and only if) a product is configurable and it has a non-NULL special_price, set that value to NULL.
#!/usr/bin/env php
<?php
/**
* clear_cfg_special_price.php
* ---------------------------
* Removes special-price data from every CONFIGURABLE product.
*
* USAGE
* php clear_cfg_special_price.php [--dry-run] [--store=<code|id>] [--batch=<n>] [--debug]
*/
@IbrahimS2
IbrahimS2 / rector.php
Created January 31, 2024 08:48 — forked from Tjitse-E/rector.php
Add missing dynamic properties using RectorPHP
<?php
use Rector\CodeQuality\Rector\Class_\CompleteDynamicPropertiesRector;
use Rector\Config\RectorConfig;
return static function (RectorConfig $rectorConfig): void {
$rectorConfig->rule(CompleteDynamicPropertiesRector::class);
// Define directories to check
$directories = [
@IbrahimS2
IbrahimS2 / WritingMagentoModules.md
Created August 30, 2022 01:18 — forked from leek/WritingMagentoModules.md
Writing Modules for Magento 1.x

Writing Magento Modules

All custom modules should have a Namespace and Module Name. These are used below as {Namespace} and {Module}.

Caution: The Magento autoloader is known to have problems with CamelCase namespaces and/or modules between Windows and *nix systems. If your module requires more than one word for either of these, it is best to just concatenate them to avoid any issues (Example: {Namespace}_{Examplemodule}).

Index

@IbrahimS2
IbrahimS2 / Anatomy of Magento 2: Layered Navigation.md
Created July 4, 2022 09:29 — forked from ProcessEight/Anatomy of Magento 2: Layered Navigation.md
In-depth exploration of how layered navigation is implemented in Magento 2

Anatomy of Magento 2: Layered Navigation

Points for investigation

  • Generate high-level overview of all the main components
  • How are the total item counts for each option generated?
  • How is the catalog updated to display the matching products?
  • How are options rendered?
  • What are the customisation points?
  • What events are dispatched?
# Set @database, @old_prefix and @new_prefix (if you want a different prefix instead of removing)
# Execute the Generated SQL Query this generates to rename all tables found with prefix.
SET SESSION group_concat_max_len = 999999999;
SET @database = "databasename";
SET @old_prefix = "mgn_";
SET @new_prefix = "";
SELECT GROUP_CONCAT("RENAME TABLE ", TABLE_NAME, " TO ", replace(TABLE_NAME, @old_prefix, @new_prefix),'; ' separator '')
FROM information_schema.TABLES WHERE TABLE_SCHEMA = @database AND TABLE_NAME LIKE CONCAT(@old_prefix, '%');
http {
upstream backend_uat {
server <server 1 ip> max_fails=1 fail_timeout=5s;
server <server 2 ip>;
}
server {
listen <nginx public ip>:443 ssl default_server;
server_name *.test.com www.*.test.com
@IbrahimS2
IbrahimS2 / change.js
Created February 26, 2020 11:59 — forked from DmitriyRF/change.js
Remove or don't redirect “thank you” page Mailchimp
/* To use this example:
1. Download this html file
2. Replace the form action url with your own from the MailChimp supplied embed code
3. Within the action url, replace "subscribe/post" with "subscribe/post-json"
4. Be sure the action url starts with http://. If it doesn't, the form will hang when testing the html as a local file in your browser.
5. Open this file in a browser on your local machine
*/
@IbrahimS2
IbrahimS2 / Index.php
Created February 5, 2020 22:32 — forked from Hailong/Index.php
Fix ShipStation plugin for Magento 2.3
<?php
namespace Auctane\Api\Controller\Auctane;
use Exception;
use Magento\Framework\App\CsrfAwareActionInterface;
use Magento\Framework\App\Request\InvalidRequestException;
use Magento\Framework\App\RequestInterface;
class Index extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface
{