Skip to content

Instantly share code, notes, and snippets.

View tobias-forkel's full-sized avatar

Tobias Forkel tobias-forkel

View GitHub Profile
@tobias-forkel
tobias-forkel / fmpif.php
Created October 15, 2016 01:29
Find missing or not readable product image files in Magento1.
<?php
/**
* Find missing or not readable product image files in Magento1.
* Run this file via command line ( php fmpif.php ) or open it in your web browser.
*
* @copyright Copyright (c) 2016 Tobias Forkel (http://www.tobiasforkel.de)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
require_once 'app/Mage.php';
@tobias-forkel
tobias-forkel / Namespace_Module_Block_Adminhtml_Edit_Tab_XXXX.php
Last active January 15, 2016 21:08 — forked from SchumacherFM/Namespace_Module_Block_Adminhtml_Edit_Tab_XXXX.php
Magento backend admin: Edit form with a multiselect field with product categories
<?php
/* Set up: */
class Namespace_Module_Block_Adminhtml_News_Edit_Tab_Linking {
protected function _prepareForm(){
...
$fieldSet->addField('product_categories', 'multiselect',
@tobias-forkel
tobias-forkel / Namespace_ModuleName_AjaxController.php
Last active July 6, 2021 05:25
Protect your AJAX controller action from malicious calls. #Magento #Security #AJAX
<?php
/**
* Namespace ModuleName
*
* @category Namespace
* @package Namespace_ModuleName
* @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
class Namespace_ModuleName_Adminhtml_Namespace_ModuleName_AjaxController extends Mage_Adminhtml_Controller_Action
@tobias-forkel
tobias-forkel / navigation.html.twig
Last active January 10, 2016 20:26
Count subpages and display a simple navigation
/**
* GRAV
*
* @tags Grav, Flatfile, CMS, Theme, Snippet, Navigation, Dropdown, Variable, Count, Subpages, Loop, Twig
* @url https://getgrav.org
*/
<div class="container">
{% set childs = page.children.visible|length %}
@tobias-forkel
tobias-forkel / app_code_local_[Namespace]_[ModuleName]_Helper_Data.php
Last active December 14, 2015 03:10
Cut the text after a specific number of characters. If the max length is not reached, just output the text without modifications.
<?php
/**
* Namespace ModuleName
*
* @category Namespace
* @package Namespace_ModuleName
* @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/
<?php
/**
* Namespace ModuleName
*
* @category Namespace
* @package Namespace_ModuleName
* @copyright Copyright (c) 2015 Tobias Forkel (http://www.tobiasforkel.de)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
*/