Skip to content

Instantly share code, notes, and snippets.

View vikramacharya's full-sized avatar

Vikram Acharya vikramacharya

  • Craftsvilla, Plotch.ai
  • Mumbai,India
View GitHub Profile
@vikramacharya
vikramacharya / Install PHP Redis Client on ec2 aws
Created March 14, 2018 12:20
Install PHP Redis Client on ec2 aws
##### ec2-user #######
sudo yum update -y
sudo yum install -y httpd24
sudo yum install -y httpd24 php56 mysql55-server php56-mysqlnd
sudo service httpd start
sudo service httpd restart
sudo chkconfig httpd on
chkconfig --list httpd
sudo usermod -a -G apache ec2-user
groups
@vikramacharya
vikramacharya / order_country_name.php
Created August 4, 2017 12:01
Get Country Name From Order Address Magento Ver1
<?php
// For billing address
$order->getBillingAddress()->getCountryModel()->getName()
// For shipping address
$order->getShippingAddress()->getCountryModel()->getName()
?>
@vikramacharya
vikramacharya / customer_group_mass_update.php
Created August 4, 2017 11:59
Bulk update customer group in Magento ver1
<?php
$customerGroupId = SOME_CUSTOMER_GROUP_ID;
$table = Mage::getModel('customer/customer')->getResource()
->getWriteConnection()
->getTable('customer/entity');
$query = "UPDATE {$table} SET group_id = {$customerGroupId} WHERE group_id != {$customerGroupId}";
$conn->query($query);
?>
@vikramacharya
vikramacharya / create_coupon.php
Created August 4, 2017 11:58
Create Coupon Programmatically Magento ver1
<?php
//Initialize Mage Object
require_once 'app/Mage.php';
Mage::app();
//Code to create coupon
$couponCode='COUPONCODE'; //couponcode
$rule = Mage::getModel('salesrule/rule'); //initialize salesrule
$customer_groups = array(0,1); // Add customer group here
@vikramacharya
vikramacharya / create_cms_block.php
Created August 4, 2017 11:57
Create CMS Block in Magento programatically
<?php
$content = <<<EOD
Block Content line 1
Block Content line 2
EOD;
$cmsBlock = Mage::getModel('cms/block')->addData(
array(
'title' => 'Block Title',
'identifier' => 'block_identifier',
'stores' => array(0), // Available in all stores
@vikramacharya
vikramacharya / cache_warmer.sh
Created August 4, 2017 11:55
cache warmer based on sitemap.xml
#!/bin/bash
URL='www.domain.nd'
SITEMAP='sitemap.xml'
wget --quiet http://$URL/$SITEMAP --no-cache --output-document - | egrep -o "http://$URL[^<]+" | while read line; do
time curl -A 'Cache Warmer' -s -L $line > /dev/null 2>&1
echo $line
done
<?php
$fbconfig['appid' ] = "XXXXX"; //put your api key here
$fbconfig['secret'] = "XXXXXXXXXXXXXXXXXX"; // put your api secret key here
$fbconfig['baseurl'] = "http://myexample.com/index.php"; //put your host address here
if (isset($_GET['request_ids']))
{
}
$user = null;
try
$fbconfig['appid' ] = "XXXXXXXXX"; //put your app id here
$fbconfig['secret'] = "XXXXXXXXXXXXXXXXXXXXXX"; // put your api secret key here