Skip to content

Instantly share code, notes, and snippets.

View satishgumudavelli's full-sized avatar
🏠
Working from home

Satish Gumudavelly satishgumudavelli

🏠
Working from home
View GitHub Profile
@satishgumudavelli
satishgumudavelli / Magento 2 cookie.php
Last active December 17, 2018 05:46
How to create cookie in Magento 2
<?php
/* create class */
class Record {
/* record information will be held in here */
private $info;
/* constructor */
function Record($record_array) {
$this->info = $record_array;
<?php
function __backup_mysql_database($params)
{
$mtables = array(); $contents = "-- Database: `".$params['db_to_backup']."` --\n";
$mysqli = new mysqli($params['db_host'], $params['db_uname'], $params['db_password'], $params['db_to_backup']);
if ($mysqli->connect_error) {
die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}
<?php
function &backup_tables($host, $user, $pass, $name, $tables = '*'){
$data = "\n/*---------------------------------------------------------------".
"\n SQL DB BACKUP ".date("d.m.Y H:i")." ".
"\n HOST: {$host}".
"\n DATABASE: {$name}".
"\n TABLES: {$tables}".
"\n ---------------------------------------------------------------*/\n";
$link = mysql_connect($host,$user,$pass);
mysql_select_db($name,$link);
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$entity_type_id = Mage::getModel('catalog/product')->getResource()->getTypeId();
prepareCollection($entity_type_id);
function prepareCollection($ent_type_id){
$resource = Mage::getSingleton('core/resource');
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once 'app/Mage.php';
Mage::app();
// $fileName = MAGENTO . '/var/import/importAttrib.csv';
$fileName = 'importAttrib.csv';
// getCsv($fileName);
getAttributeCsv($fileName);
function getAttributeCsv($fileName){
<?php
error_reporting(E_ALL);
@ini_set('display_errors', 1);
@ini_set('memory_limit','-1');
set_time_limit(0);
if( ! ini_get('date.timezone') ) date_default_timezone_set('GMT');
?>
<!DOCTYPE unspecified PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
https://github.com/magento/magento2/issues/13131
<?php
@ini_set('max_execution_time', -1);
@ini_set('memory_limit', '-1');
/**
* PHP File Manager v1.2
* https://github.com/alexantr/filemanager
<?php
@ini_set('max_execution_time', -1);
@ini_set('memory_limit', '-1');
/**
* PHP File Manager v1.2
* https://github.com/alexantr/filemanager