Skip to content

Instantly share code, notes, and snippets.

View mklooss's full-sized avatar

Mathis Klooß mklooss

View GitHub Profile
@mklooss
mklooss / clean-log.sh
Created December 19, 2012 16:44
Disable Reports in Magento
php shell/log.php clean
@mklooss
mklooss / Observer.php
Created January 2, 2013 15:14
Magento do not merge Customer Quote, if current quote is not empty
<?php
class Observer {
public function load_customer_quote_before($observer)
{
$checkout_session = $observer->getEvent()->getCheckoutSession();
if($checkout_session->getQuote()->getItemsCount() < 1) // check if current quote has items
{
return $this;
}
@mklooss
mklooss / SampleController.php
Last active December 10, 2015 23:39
Magento - controller->loadlayout() without Default
class SampleController
extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$this->loadLayout($this->getFullActionName());
$this->renderLayout();
}
}
@mklooss
mklooss / Product.php
Last active December 11, 2015 00:29
Magento Product Cache Loading by Johann Reinke, added "isAdmin" http://www.johannreinke.com/en/2012/04/13/magento-how-to-cache-product-loading/
<?php
/**
* @see http://www.johannreinke.com/en/2012/04/13/magento-how-to-cache-product-loading/
*/
class Namespace_Catalog_Model_Product
extends Mage_Catalog_Model_Product
{
public function load($id, $field = null)
@mklooss
mklooss / gist:4528773
Last active March 12, 2019 19:46
Magento - Delete in Collection in one request
<?php
class Something_Asdf_Model_Resource_Halma_Collection
extends Mage_Core_Model_Resource_Db_Collection_Abstract
{
/**
* delete all the entities in the collection
*
* @return $this
*/
public function delete()
@mklooss
mklooss / cron.d
Created January 30, 2013 14:33
ez-ipupdate DynDNS Updater, without Spamming DynDNS
*/5 * * * * root /usr/local/bin/dyndns.sh > /dev/null
curl --silent http://example.com/sitemap.xml | xpath -q -e "/urlset/url/loc/text()" > tmp.urls && siege -v -c 1 -r `cat tmp.urls | wc -l` -f tmp.urls
@mklooss
mklooss / move.php
Last active December 14, 2015 23:49
Magento: Change URL
<?php
// BOF: Config
// Syntax have to be "http(s)://something.com/"
// Slash at the End is required
$http = "http://www.example.com/";
$https = "https://www.example.com/";
// EOF: Config
/* Magento Move Shop */
@mklooss
mklooss / etc-lighttpd-cleanurl.lua
Created September 11, 2013 11:47
nginx+lighttpd redmine config
-- little helper function
function file_exists(path, ftype)
local attr = lighty.stat(path)
return (attr and attr[ftype])
end
function check_path(path)
local rv = path
if (not file_exists(path, "is_file")) then
rv = nil
@mklooss
mklooss / nginx.conf
Last active August 22, 2024 16:57
nginx magento configuration for API Calls
location /api {
rewrite ^/api/rest /api.php?type=rest last;
rewrite ^/api/v2_soap /api.php?type=v2_soap last;
rewrite ^/api/soap /api.php?type=soap last;
}