Skip to content

Instantly share code, notes, and snippets.

View sagarppanchal's full-sized avatar
👨‍💻
Success is just a matter of Attitude

SagarPPanchal sagarppanchal

👨‍💻
Success is just a matter of Attitude
View GitHub Profile
@sagarppanchal
sagarppanchal / Magento2-API-OAuth-based_authentication.php
Created November 16, 2018 11:56 — forked from rafaelstz/Magento2-API-OAuth-based_authentication.php
Sample files to use Magento 2 REST and SOAP API. Using Token-based authentication and OAuth-based authentication method.
<?php
function sign($method, $url, $data, $consumerSecret, $tokenSecret)
{
$url = urlEncodeAsZend($url);
$data = urlEncodeAsZend(http_build_query($data, '', '&'));
$data = implode('&', [$method, $url, $data]);
$secret = implode('&', [$consumerSecret, $tokenSecret]);
@sagarppanchal
sagarppanchal / magento1-rest.php
Created August 16, 2018 16:16 — forked from rafaelstz/magento1-rest.php
Sample PHP to connect API REST at Magento 1
<?php
// Created by Rafael Corrêa Gomes
// Reference http://devdocs.magento.com/guides/m1x/api/rest/introduction.html#RESTAPIIntroduction-RESTResources
// Custom Resource
$apiResources = "products?limit=2";
// Custom Values
$isAdminUser = true;
$adminUrl = "admin";
SET FOREIGN_KEY_CHECKS = 0; //important
TRUNCATE TABLE `gift_message`;
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
TRUNCATE TABLE `quote_item_option`;
TRUNCATE TABLE `quote_payment`;
@sagarppanchal
sagarppanchal / attrs.sql
Created April 12, 2018 12:48 — forked from amon-ra/attrs.sql
Clean magento database, maybe must revision categories and attributes default ids
DELETE eav_attribute_option_value FROM eav_attribute_option,eav_attribute_option_value WHERE eav_attribute_option.attribute_id > 133 and eav_attribute_option.option_id = eav_attribute_option_value.option_id;
DELETE FROM eav_attribute WHERE attribute_id > 133;
DELETE FROM eav_attribute_label WHERE attribute_id > 133;
DELETE FROM eav_attribute_option WHERE attribute_id > 133;
DELETE FROM eav_attribute_group WHERE attribute_set_id > 25;
ssh :
upload file :
scp [source file] [username]@[destination server]:.
import sql :
ssh remote_user@remote_server mysql -p testpass -u username testdb < c:\folder\test.sql
@sagarppanchal
sagarppanchal / commonuse.php
Created January 27, 2018 17:46
Search Value from multidimensional array
class commonuse
{
/* common class for multiple uses */
/* search_multidemsional @sagar : 20072016 */
/*
$value="abc";
$array=array("car"=>array("modules"=>array("engine"=>array("power"=>"40hpwrs"))));