Skip to content

Instantly share code, notes, and snippets.

View DavaGordon's full-sized avatar
🤪

Dava Gordon DavaGordon

🤪
View GitHub Profile
@DavaGordon
DavaGordon / DeleteAllImages.php
Created November 23, 2016 21:01
Delete All Product Images In Magento 1.x
<?php
require_once 'app/Mage.php';
Mage::app();
Mage::app()->getStore()->setId(Mage_Core_Model_App::ADMIN_STORE_ID);
$products = Mage::getModel('catalog/product')->getCollection();
//->addAttributeToFilter('entity_id', array('gt' => 14000));
$mediaApi = Mage::getModel("catalog/product_attribute_media_api");
@DavaGordon
DavaGordon / magneto-v1-cleanup.txt
Last active December 4, 2016 00:33
Clear Magento Logs In PhpMyAdmin
SET foreign_key_checks = 0;
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
@DavaGordon
DavaGordon / run.sql
Created May 25, 2017 13:27
Magento 2 - Delete All Test Orders
SET FOREIGN_KEY_CHECKS=0;
# Clean order history
TRUNCATE TABLE `sales_bestsellers_aggregated_daily`;
TRUNCATE TABLE `sales_bestsellers_aggregated_monthly`;
TRUNCATE TABLE `sales_bestsellers_aggregated_yearly`;
# Clean order infos
TRUNCATE TABLE `sales_creditmemo`;
TRUNCATE TABLE `sales_creditmemo_comment`;
@DavaGordon
DavaGordon / customopimport.php
Created September 28, 2017 15:31
Upload Custom Options By CSV - Magento 1 - Programmatically
<?php
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app('admin');
Mage::register('isSecureArea', 1);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
@DavaGordon
DavaGordon / robots.txt
Created September 30, 2019 10:00
Magento 1 Robots.txt - Seo Focused
# Website Sitemap
Sitemap: www.yoursite.co.uk/sitemap.xml
User-agent: Googlebot-Image
Disallow: /
Allow: /media/catalog/product/
# Crawlers Setup
User-agent: *
@DavaGordon
DavaGordon / M2alias.txt
Created October 23, 2019 13:12
Magneto 2 Bash Alias
#Command
alias mcf="php bin/magento c:f" && alias mcd="php bin/magento c:d" && alias mce="php bin/magento c:e" && alias mce="php bin/magento c:c" &&alias msup="php bin/magento s:up" && alias mssd="php bin/magento s:s:d" && alias msdc="php bin/magento s:d:c" && alias msvc="php bin/magento v:c" && alias msun="php bin/magento s:un" && alias mscr="php bin/magento s:c:r" && alias mmod="php bin/magento mo:d" && alias mmoe="php bin/magento mo:e" && alias mmos="php bin/magento mo:s" && alias mmou="php bin/magento mo:u" && alias mmae="php bin/magento ma:e" && alias mmae="php bin/magento ma:d" && alias mii="php bin/magento i:i" && alias mrei="php bin/magento i:rei" && alias mres="php bin/magento i:res" && alias mst="php bin/magento i:st"
#Reference
alias mcf="php bin/magento c:f" //Flush Cache
alias mcd="php bin/magento c:d" //Disable Cache
alias mce="php bin/magento c:e" //Enable Cache
alias mce="php bin/magento c:c" //Clean Cache
alias msup="php bin/magento s:up" //Setup Upgrade
alias mssd="php bin/magento s:s:d" //
@DavaGordon
DavaGordon / index.php
Last active November 19, 2019 15:07
Magento 2 Multi Store
<?php
/**
* Application entry point
*
* Example - run a particular store or website:
* --------------------------------------------
* require __DIR__ . '/app/bootstrap.php';
* $params = $_SERVER;
* $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2';
* $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';