Skip to content

Instantly share code, notes, and snippets.

View osrecio's full-sized avatar

Oscar Recio osrecio

View GitHub Profile
@peterjaap
peterjaap / swatch_attribute_options.php
Created November 28, 2017 13:03
Helper functions for product import in Magento 2 to create swatch attribute options
<?php
/**
* @param $attributeCode
* @param $newOptionValues
* @internal param $attributeData
*/
public function addSwatchValuesToSwatchAttribute($attributeCode, $newOptionValues)
{
$this->eavConfig->clear();
@jalogut
jalogut / magento2-config-dump-skip-system.xml
Last active September 27, 2018 15:37
Magento 2 skip dumping the whole core_config_data when using app:config:dump
<!-- module.xml -->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
<module name="VendorName_ModuleName" setup_version="0.0.1" >
<sequence>
<module name="Magento_Config"/>
</sequence>
</module>
</config>
<!-- di.xml -->
@adrian-martinez-interactiv4
adrian-martinez-interactiv4 / adminhtml_get_url_test_app.php
Created October 16, 2017 00:04
Adminhtml get url test, place in Magento root folder and execute it
<?php
use Magento\Framework\App\Area;
require __DIR__ . '/app/bootstrap.php';
class AdminhtmlGetUrlTestApp extends \Magento\Framework\App\Http implements \Magento\Framework\AppInterface
{
public function launch()
{
$this->_state->setAreaCode(Area::AREA_ADMINHTML);
@derak-kilgo
derak-kilgo / order-uncancel.php
Created October 7, 2016 17:09
One-off tool to uncancel an order in magento 1.x
<?php
if(php_sapi_name()!=="cli"){
echo "Must be run from the commend line.";
};
/**
* Setup a magento instance so we can run this export from the command line.
*/
require_once('app/Mage.php');
umask(0);
if (!Mage::isInstalled()) {
<?php
function get_tls_version($sslversion = null)
{
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "https://www.howsmyssl.com/a/check");
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
if ($sslversion !== null) {
curl_setopt($c, CURLOPT_SSLVERSION, $sslversion);
}
@peterjaap
peterjaap / installm2db.sh
Last active March 2, 2016 14:36
Install M2 database
bin/magento setup:install \
--base-url=http://mage2a.dev/ \
--db-host=localhost \
--db-name=mage2a \
--db-user=user \
--db-password=password \ # or leave this line out for dev
--admin-firstname=firstname \
--admin-lastname=lastname \
--admin-email=email@example.com \
--admin-user=username \
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;
@carlosasin
carlosasin / Custom.css
Last active December 14, 2015 11:19
A cobalt theme for Chrome Developer Tools inspired by Sublime Text 2 cobalt theme. Modifies the source code and other smaller tweaks.
/*
Cobalt theme by Carlos Asín
************************************
A cobalt theme for Chrome Developer Tools inspired by Sublime Text 2 cobalt theme.
Modifies the source code and other smaller tweaks.
@davidalexander
davidalexander / gist:1086455
Last active September 7, 2023 07:42
Magento Snippets

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex