Skip to content

Instantly share code, notes, and snippets.

View magefast's full-sized avatar
🥶

Alex S magefast

🥶
View GitHub Profile
@magefast
magefast / update-name-for-store.php
Created November 29, 2022 10:52
Magento1: Set Name (from Global value) for Store if empty value for Name.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once './app/Mage.php';
Mage::app();
$productsCollection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect(['sku', 'name']);
$storeIdCheck = 2;
$ids = [];
@magefast
magefast / no-name-report.php
Last active November 29, 2022 10:48
Magento1: Get product with empty Name for Store
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once './app/Mage.php';
Mage::app();
$productsCollection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('sku');
$storeId = 2;
$name = [];
@magefast
magefast / Magento1: Set products without Categories & Stock 0 - to ARCHIVE visibility
Created September 27, 2022 09:36
Magento1: Set products without Categories & Stock 0 - to ARCHIVE visibility
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('max_execution_time', 1000);
require_once dirname(__FILE__) . './../app/Mage.php';
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$arrayProductIds = [];
@magefast
magefast / Magento1: Products with incorrect image files
Created August 26, 2022 07:34
Magento1: Products with incorrect image files
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('time_limit', 180);
set_time_limit(180);
require_once dirname(__FILE__) . './../app/Mage.php';
$app = Mage::app('admin');
umask(0);
$dirMedia = Mage::getBaseDir('media');
@magefast
magefast / Magento1: Products without images
Created August 26, 2022 07:33
Magento1: Products without images
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
ini_set('time_limit', 180);
set_time_limit(180);
require_once dirname(__FILE__) . './../app/Mage.php';
$app = Mage::app('admin');
umask(0);
$dirMedia = Mage::getBaseDir('media');
@magefast
magefast / Magento2, export all products stock-state data
Created April 14, 2022 09:57
Magento2, export all products stock-state data
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
require_once __DIR__ . '/../app/bootstrap.php';
use Magento\Catalog\Model\Product\Visibility;
use Magento\Framework\App\Bootstrap;
use Strekoza\ArchiveVisibility\Model\Product\ArchiveVisibility;
@magefast
magefast / php-docker-ext
Created February 18, 2022 11:25 — forked from hoandang/php-docker-ext
Complete list of php docker ext
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
<?php
/**
* A simple fix for a shell execution on preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);
* The only edit that was done is that shell_exec('mysql -V') was changed to mysql_get_server_info() because not all
* systems have shell access. XAMPP, WAMP, or any Windows system might not have this type of access. mysql_get_server_info()
* is easier to use because it pulls the MySQL version from phpinfo() and is compatible with all Operating Systems.
* @link http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento
* @author Magento Inc.
*/
@magefast
magefast / Add attribute to attribute set
Created January 19, 2022 17:35
Add attribute to attribute set
<?php
$locale = 'en_US';
Mage::getSingleton('core/session')->setMyLang($langCode);
$locale = Mage::getSingleton('core/session')->getMyLang();
Mage::getSingleton('core/translate')->setLocale($locale)->init('frontend', true);
$defaultStore = Mage::app()->getStore()->getCode();
@magefast
magefast / Get count order & count sum of orders total (more than 4999) for Sales Rule Coupon Id
Created January 19, 2022 17:16
Get count order & count sum of orders total (more than 4999) for Sales Rule Coupon Id
<pre>
<?php
require_once dirname(__FILE__) . '/app/Mage.php';
Mage::app();
$salesCartRuleId = 348;
$min = 4999;
$array = array();
$coupons = array();
$coupon = Mage::getModel('salesrule/coupon')->getCollection()->addFieldToFilter('rule_id',$salesCartRuleId);