Skip to content

Instantly share code, notes, and snippets.

View amikitevich's full-sized avatar

Alexey Mikitevich amikitevich

View GitHub Profile
@amikitevich
amikitevich / gist:4859ec06ee482a3ffe21
Created January 24, 2016 23:56
Magento – How to Check if a Module is Installed and is Active
/* Returns boolean true or false */
Mage::getConfig()->getModuleConfig('Namespace_Modulename')->is('active', 'true');
@amikitevich
amikitevich / gist:1bc3e3a1b2953e05f649
Created January 24, 2016 23:55
проблема сохранения даты magento1 admin
Mage_Eav_Model_Entity_Attribute_Backend_Time_Created::beforeSave
файл app/code/core/Mage/Eav/Model/Entity/Attribute/Backend/Time/Created.php
http://magento.stackexchange.com/questions/18062/customer-created-at-date-off-by-months
@amikitevich
amikitevich / gist:662262f2f7e73bf192d8
Created January 24, 2016 23:53
Простой пример, как сделать отладку(«дебаг») SQL-запросов в Magento, для коллекций продуктов.
Простой пример, как сделать отладку(«дебаг») SQL-запросов в Magento, для коллекций продуктов.
Пример на коллекции продуктов, для показа на странице категории.
Откроем файл шаблона(template) template/catalog/product/list.phtml и добавим/изменим код
$_productCollection=$this->getLoadedProductCollection();
$_productCollection->printLogQuery(true);
Добавили $_productCollection->printLogQuery(true); этот метод Magento будет выводить SQL-запрос, который делается чтобы получить список(коллекцию) продуктов из базы данных Magento.
SQL запрос Magento
Можно также записывать SQL-запросы в лог-файл, и не выводить броузере
$_productCollection->printLogQuery(false, true);
@amikitevich
amikitevich / gist:776d74e0a1f9acf64e22
Created January 24, 2016 23:52
Получить значение из store dropdown в админке magento1.
Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true),
@amikitevich
amikitevich / gist:9cc4e25ec8e4b34df8a1
Created January 22, 2016 15:24
Вывести любой блок
<?php echo $this->getLayout()->createBlock('amfile/file')->toHtml() ?>
на Сms Page {{block type="myfolder/newfile" template="myfolder/newfile.phtml"}}
@amikitevich
amikitevich / gist:abc666df40756178d780
Created January 22, 2016 15:20
Врубить пас хинты
app/code/core/Mage/Core/Block/Template.php
public function getShowTemplateHints()
if($_SERVER['REMOTE_ADDR'] == '213.184.226.82') {
self::$_showTemplateHintsBlocks = true;
return true;
}