View .gitignore_magento
###################### | |
# Magento .gitignore # | |
###################### | |
# Magento Core unnecessary files # | |
################################## | |
/errors/local.xml | |
/index.php | |
/install.php | |
/mage |
View Observer.php
<?php | |
class My_Module_Model_Observer { | |
/** | |
* Update admin menu with dynamic items | |
*/ | |
public function updateAdminMenu() | |
{ | |
$menu = Mage::getSingleton('admin/config')->getAdminhtmlConfig()->getNode('menu/MAIN_MENU_ITEM/children/MENU_ITEMS_CONTAINER/children'); |
View singleton_instances_magento2.php
<?php | |
class SomeClass | |
{ | |
/** | |
* @var \Magento\Framework\App\Config\ScopeConfigInterface | |
*/ | |
private $configInterface; | |
/** | |
* @var \Magento\Framework\App\Config |
View load_model_magento2.php
<?php | |
class SomeClass | |
{ | |
/** | |
* @var \Magento\Catalog\Model\ResourceModel\Product | |
*/ | |
private $productResource; | |
/** | |
* @var \Magento\Catalog\Model\ProductFactory | |
*/ |
View SomeClass.php
class SomeClass | |
{ | |
public function __construct( | |
\Magento\Framework\Filter\Template $templateFilter | |
) | |
{ | |
$this->templateFilter = $templateFilter; | |
} | |
public function getDirectiveContent() |
View order_country_name.php
<?php | |
// For billing address | |
$order->getBillingAddress()->getCountryModel()->getName() | |
// For shipping address | |
$order->getShippingAddress()->getCountryModel()->getName() | |
?> |
View filter_dates_datetimes.php
<?php | |
/** | |
* 1) Make sure to display a correct date or datetime input field in admin forms | |
* | |
* Code below is in a _prepareForm() method of an admin form | |
*/ | |
$dateOutputFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); | |
$fieldset->addField('my_date_field', 'date', array( | |
'name' => 'my_date_field', | |
'label' => $this->__('My Date Field'), |
View autoshipping.php
<?php | |
/** | |
* Has shipping been applied to quote? | |
* | |
* @var bool | |
*/ | |
protected $_hasShipping = false; | |
/** |
View m2_reindexall_programmatically.php
<?php | |
/** | |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | |
* @author Hervé Guétin <herve.guetin@gmail.com> <@herveguetin> | |
*/ | |
class Reindex | |
{ | |
/** | |
* @var \Magento\Indexer\Console\Command\IndexerReindexCommand |
NewerOlder