Skip to content

Instantly share code, notes, and snippets.

View webdawe's full-sized avatar
🏢
I may be slow to respond.

Anil Paul webdawe

🏢
I may be slow to respond.
View GitHub Profile
@webdawe
webdawe / webdawe-tabs.js
Created July 15, 2016 06:03
Webdawe Tabs
jQuery(document).ready(
function($)
{
$('.webdawe-tabs-link').click(
function()
{
//console.log($(this).attr('data-link'));
$('.webdawe-content-wrap').find('section' + '#' + $(this).attr('data-link')).addClass('content-current');
$('.webdawe-content-wrap').find('section' + '#' + $(this).attr('data-link')).siblings().removeClass('content-current');
$(this).parent().addClass('tab-current');
@webdawe
webdawe / webdawe-tabs.css
Last active July 15, 2016 06:08
Webdawe Tabs Css
@import url(https://fonts.googleapis.com/css?family=Raleway);
.webdawe-tabs {
position: relative;
margin: 0 auto;
width: 100%;
font-weight: 300;
font-size: 1.25em;
margin-top:20px;
font-family: 'Raleway', sans-serif;
/*box-shadow: 0px 0px 5px #f5f5f5;*/
@webdawe
webdawe / webdawe-spread-nav.js
Created July 15, 2016 06:09
Spread Navigation
jQuery(document).ready(
function($)
{
//calculate the container width
var containerWidth = $('ul#nav').outerWidth() - $('li.homelink').outerWidth() - $('li.last-child').outerWidth();
var liWidthTotal = 0;
var liCount = 0;
//retrieve total li width
$('ul#nav li.level0').each(
@webdawe
webdawe / start-reading-script.js
Created July 15, 2016 06:29
Script for Start Reading
jQuery(document).ready(
function($)
{
var isRandomize = 0;
var randomize;
var retrievedData = localStorage.getItem("sr_extraitems");
var extraItems = JSON.parse(retrievedData);
if (extraItems == undefined)
@webdawe
webdawe / getTranslateCsv.php
Created August 26, 2016 04:29
Get All the Strings to get Translated
<?php
/**
* Author : Anil Paul
* Date: 25/08/16
* Time: 5:19 PM
*/
$sourcePath = 'Module Path';
$csvFile = 'Namespace_Module.csv';
$searchExtensions = array('php', 'phtml');
@webdawe
webdawe / magento_category.sql
Last active September 8, 2016 00:55
Magento Get Active Category List
#Retrieve Entity Type Ids
SET @categoryEntityTypeId := (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category');
SET @nameAttributeId := (select attribute_id FROM eav_attribute where attribute_code = 'name' and entity_type_id = @categoryEntityTypeId);
SET @descriptionAttributeId := (select attribute_id FROM eav_attribute where attribute_code = 'description' and entity_type_id = @categoryEntityTypeId);
SET @metaTitleAttributeId := (select attribute_id FROM eav_attribute where attribute_code = 'meta_title' and entity_type_id = @categoryEntityTypeId);
SET @metaDescriptionAttributeId := (select attribute_id FROM eav_attribute where attribute_code = 'meta_description' and entity_type_id = @categoryEntityTypeId);
SET @isActiveAttributeId := (select attribute_id FROM eav_attribute where attribute_code = 'is_active' and entity_type_id = @categoryEntityTypeId);
SELECT DISTINCT c.entity_id as `Category_Id`,
name.value as `Name`,
@webdawe
webdawe / imagickResize.php
Created September 20, 2016 04:55
Imagick Resize
function imagickResize($uploadDir, $fileFrom, $fileTo, $newWidth, $newHeight)
{
$thumb = new Imagick();
$thumb->readImage($uploadDir. $fileFrom);
$dimensions = $thumb->getImageGeometry();
$orginalWidth = $dimensions['width'];
$orginalHeight = $dimensions['height'];
@webdawe
webdawe / gdResize.php
Created September 20, 2016 04:56
GD Library Resize PHP
function gdResize($uploadDir, $filename,$ext, $newWidth, $newHeight)
{
list($orginalWidth, $orginalHeight) = getimagesize($uploadDir. $filename . '.' . $ext);
$ratio = $orginalWidth/$orginalHeight;
if ($orginalWidth < $newWidth || $orginalHeight < $newHeight)
{
return '';
}
@webdawe
webdawe / category_sales_report.sql
Created September 27, 2016 05:19
Magento Category Sales Report Query
SET @categoryEntityTypeId := (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category');
SET @nameAttributeId := (select attribute_id FROM eav_attribute where attribute_code = 'name' and entity_type_id = @categoryEntityTypeId);
SET @storeId = 1;
select w.name as website_name, name.value as category_name, SUM(oi.base_row_invoiced) as total,SUM(qty_invoiced) FROM catalog_category_product cp
INNER JOIN sales_flat_order_item oi ON oi.product_id = cp.product_id
INNER JOIN catalog_category_entity_varchar name ON name.entity_id = cp.category_id AND name.store_id = 0
INNER JOIN core_store s ON s.store_id = oi.store_id
INNER JOIN core_website w ON w.website_id = s.website_id
WHERE name.attribute_id = @nameAttributeId
AND cp.category_id IN ({commaseperatedcategoryids})
@webdawe
webdawe / category_products_sales_report.sql
Created September 28, 2016 03:01
Category Product Sales Report
#category_products_sales_report
SET @categoryEntityTypeId := (SELECT entity_type_id FROM eav_entity_type WHERE entity_type_code = 'catalog_category');
SET @nameAttributeId := (select attribute_id FROM eav_attribute where attribute_code = 'name' and entity_type_id = @categoryEntityTypeId);
SET @categoryId = 1;
select w.name as website_name, oi.name, SUM(oi.base_row_invoiced) as total,SUM(qty_invoiced) FROM catalog_category_product cp
INNER JOIN sales_flat_order_item oi ON oi.product_id = cp.product_id
INNER JOIN core_store s ON s.store_id = oi.store_id
INNER JOIN core_website w ON w.website_id = s.website_id
WHERE cp.category_id = @categoryId