Skip to content

Instantly share code, notes, and snippets.

Jose Ruzafa jruzafa

Block or report user

Report or block jruzafa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jruzafa
jruzafa / magento2-truncate.sql
Created Jun 12, 2019 — forked from rafaelstz/magento2-truncate.sql
Magento 2 truncate customers, products, reviews and orders table
View magento2-truncate.sql
SET FOREIGN_KEY_CHECKS = 0;
-- Truncate order tables
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`;
View google_spreadsheet_double_quotes_formula.txt
Export spreadsheet as csv.
=ArrayFormula(""""&Sheet1!A:B&"""")
Open with sublime;
1.Replace """" with ""
2.Replace """ with "
source: http://stackoverflow.com/questions/3315636/how-to-enclose-every-cell-with-double-quotes-in-google-docs-spreadsheet
View debugging.md

Debugging (Resource) Model Instantiation

Follow each step manually and any bugs during (resource) model instantiation will become obvious.

Since many people find model and resource model instantiation to be one of the more challenging things in Magento 1, these are all the steps Magento does to resolve the factory name to the real PHP class name.

To debug, simply follow each step manually until you find a non-match. This works really well in my experience.
Less guessing, more and faster results.

In the examples I use a factory name of "example/thing".

@jruzafa
jruzafa / php_snippets.php
Last active Mar 13, 2019
Php snippets #php #snippets
View php_snippets.php
<?php
$csv = array_map('str_getcsv', file($file));
array_walk($csv, function(&$a) use ($csv) {
$a = array_combine($csv[0], $a);
});
array_shift($csv); # remove column header
// Format price
//
You can’t perform that action at this time.