Skip to content

Instantly share code, notes, and snippets.

View harshvardhanmalpani's full-sized avatar
💯
life is a party!!

Harshvardhan Malpani harshvardhanmalpani

💯
life is a party!!
View GitHub Profile
@harshvardhanmalpani
harshvardhanmalpani / convertProductImages2Jpg.php
Last active January 5, 2017 18:13
Converts all magento images from PNG to JPG
<?php
$halfPath='./media/catalog/product';
$user="username"; //username for SOAPv2 api
$pass="password"; //password for above user
$products = array(20,21,22); //array of product IDs to be converted
ini_set('display_errors',E_ALL);
error_reporting(E_ALL);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
@harshvardhanmalpani
harshvardhanmalpani / Magento-Product-CustomOptions-Duplicate-Remover.php
Created April 24, 2017 22:50
This code removes duplicate custom options for all products. Use toggle for test and debug.
<?php
$debug=0;
$test=0;
/*
Code by Harshvardhan Malpani - https://harshmalpani.in
Tested for Magento CE 1.9.x
Date: 25/04/2017
Use $debug and $test toggles to display messages.
This script will remove all duplicate custom options in each product (duplicate logic = same title for multiple custom options)
*/
@harshvardhanmalpani
harshvardhanmalpani / createCat.php
Created October 27, 2017 08:02
How to create Magento 2 category programmatically
<?php
//creating categories in magento 2
//last verified Magento 2.2.0 27 Oct 2017
use \Magento\Framework\App\Bootstrap;
echo 'code by harshvardhanmalpani';
include('./app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
function createCategory($a='',$b=2,$c=true,$d='',$e='',$f='',$g='') {
global $objectManager;
@harshvardhanmalpani
harshvardhanmalpani / update-product-attribute-options.js
Created November 22, 2017 09:55
Manage Magento 2 product attribute options - values using JS console
$jq=new jQuery.noConflict();
var mimim=["Abalone",
"Titanium Druzy",
"Tourmaline",
"Turquoise",
"Yellow Zircon",
"Light Blue Druzy"];
var trans=[];var o=0;
$jq('#manage-options-panel tbody tr td:nth-child(3) input').each(
function(a,b){
@harshvardhanmalpani
harshvardhanmalpani / letsencrypt-ca-bundle-new.crt
Last active March 12, 2018 20:58
Let's Encrypt Root CA Bundle
-----BEGIN CERTIFICATE-----
MIIEkjCCA3qgAwIBAgIQCgFBQgAAAVOFc2oLheynCDANBgkqhkiG9w0BAQsFADA/MSQwIgYDVQQK
ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
DTE2MDMxNzE2NDA0NloXDTIxMDMxNzE2NDA0NlowSjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUxl
dCdzIEVuY3J5cHQxIzAhBgNVBAMTGkxldCdzIEVuY3J5cHQgQXV0aG9yaXR5IFgzMIIBIjANBgkq
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnNMM8FrlLke3cl03g7NoYzDq1zUmGSXhvb418XCSL7e4
S0EFq6meNQhY7LEqxGiHC6PjdeTm86dicbp5gWAf15Gan/PQeGdxyGkOlZHP/uaZ6WA8SMx+yk13
EiSdRxta67nsHjcAHJyse6cF6s5K671B5TaYucv9bTyWaN8jKkKQDIZ0Z8h/pZq4UmEUEz9l6YKH
y9v6Dlb2honzhT+Xhq+w3Brvaw2VFn3EK6BlspkENnWAa6xK8xuQSXgvopZPKiAlKQTGdMDQMc2P
MTiVFrqoM7hD8bEfwzB/onkxEz0tNvjj/PIzark5McWvxI0NHWQWM6r6hCm21AvA2H3DkwIDAQAB
@harshvardhanmalpani
harshvardhanmalpani / 0-step.js
Last active June 8, 2018 19:51
EMail addresses in my spam filter list
/* insert the following code in console jQuery v3.3.1 */
!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.protot
@harshvardhanmalpani
harshvardhanmalpani / FixerIo.php
Created July 19, 2018 08:45
fixer.io replacement
<?php
#/vendor/magento/module-directory/Model/Currency/Import/FixerIo.php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Directory\Model\Currency\Import;
/**
* Currency rate import model (From http://fixer.io/)
@harshvardhanmalpani
harshvardhanmalpani / flushdb.sql
Created October 30, 2018 23:05
Remove all tables
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT('`', table_name, '`') INTO @tables
FROM information_schema.tables
WHERE table_schema = (SELECT DATABASE());
SELECT IFNULL(@tables,'dummy') INTO @tables;
SET @tables = CONCAT('DROP TABLE IF EXISTS ', @tables);
PREPARE stmt FROM @tables;
@harshvardhanmalpani
harshvardhanmalpani / magento latest 7.1.json
Last active January 3, 2019 13:00
EasyApache4 Magento2x Profile with PHP 7.1 and 7.1
{
"desc" : "Magento Latest 7.1",
"pkgs" : [
"ea-apache24",
"ea-apache24-config",
"ea-apache24-config-runtime",
"ea-apache24-devel",
"ea-apache24-mod_brotli",
"ea-apache24-mod_bwlimited",
"ea-apache24-mod_cache",
@harshvardhanmalpani
harshvardhanmalpani / fman.php
Created December 23, 2018 17:00
php file manager
<?php
//{"lang":"","auth_pass":"d41d8cd98f00b204e9800998ecf8427e","error_reporting":"1"}
/*--------------------------------------------------
| PHP FILE MANAGER
+--------------------------------------------------
| phpFileManager 1.6
| By Fabricio Seger Kolling
| Copyright (c) 2004-2018 Fabrício Seger Kolling
| E-mail: [email protected]
| URL: http://phpfm.sf.net