Skip to content

Instantly share code, notes, and snippets.

View mahmoudissmail's full-sized avatar

Mahmoud ismail mahmoudissmail

View GitHub Profile
@tegansnyder
tegansnyder / Magento-order-sum-breakout-report.sql
Created January 31, 2014 15:41
Magento - Sum of All Orders by Month and Year Breakdown includes Discount Sums
SELECT sub_query.month_ordered,
sub_query.year_ordered,
SUM(sub_query.base_subtotal) AS sum_base_subtotal,
SUM(sub_query.discount_amount) AS sum_discount_amt,
SUM(sub_query.order_qty) AS sum_total_item_count,
COUNT(sub_query.entity_id) AS total_orders
FROM
(SELECT so.entity_id,
MONTH(so.created_at) AS month_ordered,
YEAR(so.created_at) AS year_ordered,
@hslatman
hslatman / magento_custom_index.php
Last active November 1, 2019 11:55
Custom Magento re-indexing script
<?php
/******************************************************************************************************************
* Source: http://www.emvee-solutions.com/blog/magento-custom-reindex-script/
*
* Custom Magento re-indexing script
******************************************************************************************************************/
//Place this file in your Magento root folder, or modify the require once to match your directory.
@vmasciotta
vmasciotta / ImageResize.php
Created August 22, 2019 14:06
Fix error catalog placeholder Magento 2.3 - https://github.com/magento/magento2/issues/19710
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);
namespace Magento\MediaStorage\Service;
use Magento\Catalog\Helper\Image as ImageHelper;
@nklatt
nklatt / create_attributes.php
Last active May 14, 2020 07:45
Programmatically add new product attribute with options to a Magento 2 store and add to Default attribute group
<?php
defined('STDIN') or die(_("Access Denied. CLI Only"));
// execute from the command line: php <path to magento root>/cli/create_attributes.php
require __DIR__.'/../app/bootstrap.php'; // assuming this file is in /cli under the root magento dir
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
$installer = $bootstrap->getObjectManager()->create('Magento\Catalog\Setup\CategorySetup');
$objectManager = $bootstrap->getObjectManager();
@tegansnyder
tegansnyder / CategoryTreePathExportMagento.php
Last active December 3, 2020 15:31
Export Category Tree and Paths for Magento
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$category = Mage::getModel ('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
@ianitsky
ianitsky / Data.php
Created August 9, 2018 19:06
Magento - Add textarea to admin system config tables
<?php
/**
* Use
*/
class Module_Adminhtml_Block_Config_Data extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
{
protected $_textareaRenderer;
public function __construct()
{
@godriccao
godriccao / create.php
Last active June 3, 2021 15:37 — forked from TheFrankman/create.php
Programatically create an order in Magento 2.1
<?php
/**
* @author Godric Cao
*/
namespace Vendor\Namespace\Model\Subscription\Order;
class Create
{
public function __construct(
\Magento\Framework\App\Helper\Context $context,
@ipascual
ipascual / jenkins - magento2 deployment script
Created March 8, 2018 20:07
jenkins - magento2 deployment script
#!/bin/bash
# ----------------------------------------------------
# v. 20180308
TARGET=/var/www/html
TMPTARGET=/var/www/codedeploy
BACKUP=/var/www/html-backup
USER=apache
GROUP=apache
# ----------------------------------------------------
@James-Bovis
James-Bovis / StickyFooter.html
Created September 12, 2019 18:42
Butternut Box - Sticky Footer
<div class="sticky-footer">
<a href="#" class="sticky-footer__item sticky-footer__item--active">
<img src="#" alt="Dashboard Icon">
Dashboard
</a>
<a href="#" class="sticky-footer__item">
<img src="#" alt="Dashboard Icon">
My Plan
</a>
<a href="#" class="sticky-footer__item">
@tomysmile
tomysmile / mac-php-composer-setup.md
Created July 11, 2016 10:45
Setup PHP Composer using Brew