This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
LANGUAGES="en_US pt_BR" | |
# production or developer | |
ENVIRONMENT="production" | |
COMPOSER=$(which composer) | |
PHP=$(which php) | |
ROOT=$(pwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function findDuplicate($arr) | |
{ | |
// Initialise variables | |
$tortoise = $arr[0]; | |
$hare = $arr[0]; | |
// Loop till we find the |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$arr = [ 2, 6, 4, 1 , 1, 3, 1, 5, 2 ]; | |
$dups = []; | |
foreach(array_count_values($arr) as $val => $c) { | |
if($c > 1) { | |
$dups[] = ['value' => $val, 'dup_times' => $c]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Optimized my.cnf configuration for MySQL/MariaSQL | |
# | |
# by Fotis Evangelou, developer of Engintron (engintron.com) | |
# | |
# ~ Updated January 2020 ~ | |
# | |
# | |
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores. | |
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Vendor\Module\Setup; | |
use Magento\Framework\Setup\UpgradeDataInterface; | |
use Magento\Framework\Setup\ModuleContextInterface; | |
use Magento\Framework\Setup\ModuleDataSetupInterface; | |
use Magento\Sales\Setup\SalesSetupFactory; | |
use Magento\Quote\Setup\QuoteSetupFactory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Vendor\Module\Setup; | |
use Magento\Framework\Setup; | |
use Magento\Eav\Setup\EavSetup; | |
use Magento\Eav\Setup\EavSetupFactory; | |
use Magento\Catalog\Model\Product\Type; | |
use Magento\Framework\Setup\ModuleContextInterface; | |
use Magento\Framework\Setup\ModuleDataSetupInterface; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 2b154f47cac22b48238714aaff57d86fff6ea3ac Mon Sep 17 00:00:00 2001 | |
From: tuyennn <thinghost76@gmail.com> | |
Date: Wed, 14 Nov 2018 17:03:14 +0700 | |
Subject: [PATCH] MAGETWO-57153: [Backport] - [Github] Custom options not | |
displayed correctly on a store view level #2908 #5885 #5612 | |
--- | |
.../Product/Initialization/Helper.php | 91 +++++++++++++++---- | |
.../Model/Product/Option/Repository.php | 37 +++++++- | |
.../Model/Product/Option/SaveHandler.php | 20 +++- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getTopRateProducts($limit = 12) | |
{ | |
$collection = $this->_productReportCollectionFactory->create(); | |
$collection->addAttributeToSelect('*'); | |
$collection->addAttributeToFilter('visibility', \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH); | |
$collection->addAttributeToFilter('status', \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED); | |
$collection->joinField( | |
'rating_summary', | |
'review_entity_summary', | |
'rating_summary', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* @var $installer Mage_Customer_Model_Resource_Setup */ | |
$installer = Mage::getResourceModel('customer/setup','customer_setup'); | |
$installer->startSetup(); | |
if (!$installer->getAttributeId('customer', 'attribute_name')) { | |
$installer->addAttribute('customer', 'attribute_name', array( // TABLE.COLUMN: DESCRIPTION: | |
/** Standard values defined @see Mage_Eav_Model_Entity_Setup::_prepareValues() */ | |
'label' => 'Label', // eav_attribute.frontend_label admin input label | |
'backend' => 'module/class_name', // eav_attribute.backend_model backend class (module/class_name format) | |
'type' => 'varchar', // eav_attribute.backend_type backend storage typ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Vendor\Module\Block\Adminhtml\Widget; | |
class ImageChooser extends \Magento\Backend\Block\Template | |
{ | |
/** | |
* @var \Magento\Framework\Data\Form\Element\Factory | |
*/ | |
protected $_elementFactory; |
NewerOlder