Skip to content

Instantly share code, notes, and snippets.

View vkathirvel's full-sized avatar

(Sid) Kathirvel Vijayavel vkathirvel

View GitHub Profile
@vkathirvel
vkathirvel / addcategoryattributes.php
Created October 20, 2017 11:21
Magento Add Category Attributes
<?php
require_once('app/Mage.php'); //Path to Magento
umask(0);
Mage::app();
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->startSetup();
$setup->addAttribute(Mage_Catalog_Model_Category::ENTITY, 'secondary_heading',
array(
@vkathirvel
vkathirvel / .htaccess
Created December 16, 2015 15:02
htaccess Non-WWW WWW Redirects
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^content\.(.*)$ [NC]
RewriteCond %{HTTP_HOST} !^themes\.(.*)$ [NC]
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
@vkathirvel
vkathirvel / gist:43b7b46b2f06ad6ebfb3
Created September 12, 2015 09:49
Magento remove SID=U from GetURL
$categoryLink = Mage::getModel("catalog/category")->load(10)->getUrl();
$pos = strpos($categoryLink, '?');
$categoryLink = ($pos>0) ? substr($categoryLink, 0, $pos) : $categoryLink;
@vkathirvel
vkathirvel / MagentoImagesDelete.php
Created August 28, 2015 15:58
Magento Delete Unused Images
<?php
/*
If your products have been deleted but not your media gallery images you
can use the following SQL statement to remove these dormant records.
Please make sure you backup your installation and database before running this
SQL statement. It has been used on Mage 1.8.1 system:
@vkathirvel
vkathirvel / Magento-Customer-Export.php
Created August 27, 2015 14:34
Saves a CSV file containing all customers' data
<?php
require_once('app/Mage.php');
umask(0);
Mage::app();
$customers = Mage::getModel('customer/customer')->getCollection();
$customers->addAttributeToSelect('*');
$customersArray[0] = array(
@vkathirvel
vkathirvel / robots.txt
Created March 13, 2015 11:26
Magento Robots.txt
########################################################################################
# Kathir 'Sid' Vel's robots.txt file for Magento websites
########################################################################################
User-agent: *
Allow: /
#Disallow: /
########################################################################################
# Do not crawl development files and folders

Setup a blog extension with Cartalyst Platform 2

Download Platform

git clone https://github.com/cartalyst/platform.git blog

Install Dependencies

Navigate into the downloaded folder and run

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name