Skip to content

Instantly share code, notes, and snippets.

@manojiksula
manojiksula / Magento-order-sum-breakout-report.sql
Created March 13, 2018 09:32 — forked from tegansnyder/Magento-order-sum-breakout-report.sql
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,
@manojiksula
manojiksula / LoginController.php
Created July 16, 2017 15:22 — forked from SaeedPrez/LoginController.php
Laravel 5.4 Additional Login Conditions - Add custom error message.
<?php
// This is code to return custom error message
// for Youtube tutorial: Laravel 5.4 Additional Login Conditions
// https://www.youtube.com/watch?v=Z8s6uhhD1Pk
namespace App\Http\Controllers\Auth;
<?php
$customer_email = "customer@example.com";
$customer = Mage::getModel("customer/customer");
$customer->setWebsiteId(Mage::app()->getWebsite()->getId());
$customer->loadByEmail($customer_email); //load customer by email id
//use
echo $customer->getId();
echo $customer->getFirstName();
//print_r($customer->getData()); to find all the available elements.
?>
$deleteCatByName = function($catname) {
$category = Mage::getModel('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
$ids = $tree->getCollection()->getAllIds();
if ($ids){
foreach ($ids as $id){
$cat = Mage::getModel('catalog/category');
$cat->load($id);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE codetemplates PUBLIC "-//NetBeans//DTD Editor Code Templates settings 1.0//EN" "http://www.netbeans.org/dtds/EditorCodeTemplates-1_0.dtd">
<codetemplates>
<codetemplate abbreviation="gsc" xml:space="preserve">
<code><![CDATA[Mage::getStoreConfig('${cursor}')]]></code>
</codetemplate>
<codetemplate abbreviation="model" xml:space="preserve">
<code><![CDATA[Mage::getModel('${cursor}')]]></code>
</codetemplate>
<codetemplate abbreviation="single" xml:space="preserve">
@manojiksula
manojiksula / nginx-magento
Created July 26, 2016 16:42 — forked from fstrube/nginx-magento
nginx-magento
server {
listen 80;
root /var/www/magento;
index index.php index.html index.htm;
server_name magento.local;
# Place PHP error logs in the Magento log folder
@manojiksula
manojiksula / send_email
Created June 24, 2016 06:48 — forked from damiann/send_email
Send Magento template email with attachment.
<?
// using model magento\app\code\core\Mage\Core\Model\Email\Template.php
public function send_error_email($error = NULL) {
$mailTemplate = Mage::getModel('core/email_template');
$mailTemplate->setSenderName('Insert Sender Name'); // use general Mage::getStoreConfig('trans_email/ident_general/name');
$mailTemplate->setSenderEmail('insert@sender.email'); // use general Mage::getStoreConfig('trans_email/ident_general/email')
$mailTemplate->setTemplateSubject('Insert Subject Title');
$mailTemplate->setTemplateText('Insert Body Text');
@manojiksula
manojiksula / magento_database_move.sql
Created March 3, 2016 07:31 — forked from eristoddle/magento_database_move.sql
Database Queries for moving a Magento database from insecure local to secure host.
UPDATE `magento`.`core_config_data` SET `value` = 'http://yoursite.com' WHERE `core_config_data`.`path` ='web/unsecure/base_url';
UPDATE `magento`.`core_config_data` SET `value` = 'https://yoursite.com' WHERE `core_config_data`.`path` ='web/secure/base_url';
UPDATE `magento`.`core_config_data` SET `value` = 1 WHERE `core_config_data`.`path` ='web/secure/use_in_frontend';
UPDATE `magento`.`core_config_data` SET `value` = 1 WHERE `core_config_data`.`path` ='web/secure/use_in_adminhtml';
@manojiksula
manojiksula / 0001-BUGIFX-Magento-Zend-Framework-1-PHP5.6.patch
Created January 21, 2016 05:49 — forked from renttek/0001-BUGIFX-Magento-Zend-Framework-1-PHP5.6.patch
Bugfix for Zend Framework 1 in Magento (>= 1.7.*.*) + PHP 5.6
From 473846959772d8160b34b92ae3bcecddf24b972f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20Nu=C3=9F?= <julian.nuss@outlook.com>
Date: Tue, 23 Sep 2014 21:07:29 +0200
Subject: [PATCH 1/1] [BUGIFX] Zend Framework 1 + PHP5.6
---
lib/Zend/Locale/Format.php | 22 +++++++++++-----------
lib/Zend/Service/Audioscrobbler.php | 6 +++---
lib/Zend/Service/Technorati.php | 6 +++---
lib/Zend/Validate/Hostname.php | 4 ++--
@manojiksula
manojiksula / es.sh
Created January 13, 2016 09:05 — forked from hasantayyar/es.sh
cd ~
sudo apt-get update
sudo apt-get install openjdk-7-jre-headless -y
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
# NEW WAY / EASY WAY
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.9.deb
sudo dpkg -i elasticsearch-0.90.9.deb