Skip to content

Instantly share code, notes, and snippets.

View manojchowrasiya's full-sized avatar

manojchowrasiya

View GitHub Profile
@manojchowrasiya
manojchowrasiya / magento.md
Last active April 27, 2018 18:57 — forked from manojiksula/magento.md
Magento 1x Code Snippet

Data to CSV

 public function exportOrders($orders) 
    {
        $fileName = 'order_export_'.date("Ymd_His").'.csv';
        $fp = fopen(Mage::getBaseDir('export').'/'.$fileName, 'w');

        $this->writeHeadRow($fp);
        foreach ($orders as $order) {
 $this->writeOrder($order, $fp);
@manojchowrasiya
manojchowrasiya / gitworkflow.txt
Created October 13, 2017 07:41 — forked from seamusjr/gitworkflow.txt
Simple git workflow
# Git workflow example.
# Inspired by http://nakedstartup.com/2010/04/simple-daily-git-workflow
# Create a local working branch
# You only need to do when you want to create
# a local working branch for your project
#
# I use the convention feat_project_name so it can be feat_puma
git checkout -b branch_name_here

Make Controller with default functions

php artisan make:controller PhotoController --resource

Make Model

php artisan make:model User

php artisan make:model User --migration

@manojchowrasiya
manojchowrasiya / config.json
Created April 13, 2017 09:58 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@manojchowrasiya
manojchowrasiya / Proposal.md
Created April 6, 2017 13:59 — forked from IvanChepurnyi/Proposal.md
Architectural Proposal for Magento 2 Inventory and Prices Mechanism

Problem

There are too tight relations of stock and prices to store views and websites in Magento that results in high complexity of implementation of b2b and drop shipping solutions in Magento.

The issue was very visible with the price index structure for Magento 1, and now Magento 2 stock index follows the same idea of having an index entry per website.

This strict relation to a website makes unnecessary data duplications in case if you have global stock. Although it makes over complicated multi-warehouse delivery, as you will be required to create a separate website for each warehouse, that duplicates other product data in the flat index structure and price index.

Solution

Create a separate scope entity for Price and Inventory, for using them as scope fields for respective data structures.

get Last query executed

echo $this->db->last_query();

storing session in ci

Simple :
@manojchowrasiya
manojchowrasiya / gist:463924a075e5fb4ac4b909d7db7fafbb
Created March 20, 2017 10:07 — forked from ThomasBurleson/gist:2432692
AngularJS - RESTful CRUD with Services and $http
//
// CRUD API for RESTful services with URLs similar 'http://services.mysite.com/classes/Book'.
//
// e.g. parse.get(
// "Book",
// 123,
// function(response){ console.log(response.toString());}
// );
//
services.factory('parse', function($rootScope, $http) {

Ionic - How to remove header title?

http://stackoverflow.com/questions/25178029/ionic-how-to-remove-header-title
<ion-view hide-nav-bar="true" hide-back-button="true" view-title="welcome">

check if column already exits in table

IF NOT EXISTS( SELECT NULL
            FROM INFORMATION_SCHEMA.COLUMNS
           WHERE table_name = 'tablename'
             AND table_schema = 'db_name'
             AND column_name = 'columnname')  THEN
  ALTER TABLE `TableName` ADD `ColumnName` int(1) NOT NULL default '0';
END IF;
$url  = '10.155.33.67:8081/ws-common/service/attachment/download?attachmentType=BL&customerId=0000001418&deliveryId=1804095213&fileExt=pdf&signature=MmI1NTg5MTIxMzhlY2U0ZDI1MTI3ZjZhODkwZWU2OTllNjBmYjU1Yg==';
$path = "css/1234567.pdf";

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
if(file_exists($path)){
 echo "already exits";