Skip to content

Instantly share code, notes, and snippets.

View firewizard's full-sized avatar

Cristian Nicolescu firewizard

View GitHub Profile
diff --git a/magento/app/code/core/Mage/Cms/Block/Block.php b/magento/app/code/core/Mage/Cms/Block/Block.php
index 75aab46..3693349 100644
--- a/magento/app/code/core/Mage/Cms/Block/Block.php
+++ b/magento/app/code/core/Mage/Cms/Block/Block.php
@@ -72,4 +72,19 @@ class Mage_Cms_Block_Block extends Mage_Core_Block_Abstract
}
return $html;
}
+
+ /**
@danielmcclure
danielmcclure / facebook-wca-standard-events.html
Last active January 14, 2024 14:54
Sample Facebook Standard Events for New Facebook WCA (Website Custom Audience) Pixel
<!-- Facebook Custom Audience Pixel Code - Placed on Every Page of Site -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','//connect.facebook.net/en_US/fbevents.js');
fbq('init', '{{facebook pixel}}');
fbq('track', 'PageView');
</script>
@rafaelstz
rafaelstz / Install-Magento-1.md
Last active May 1, 2024 20:22
Install Magento 1.9 (With Sample Data)
  
  ## Magento 1 + SampleData
  
  sudo apt-get update && \
  sudo apt-get install -y git wget unzip
  
  git clone https://github.com/OpenMage/magento-mirror.git ./ ;

  wget https://raw.githubusercontent.com/Vinai/compressed-magento-sample-data/1.9.1.0/compressed-magento-sample-data-1.9.1.0.tgz ;
@jonathanstark
jonathanstark / verify-google-recaptcha-with-php
Last active March 8, 2024 18:24
Verify Google reCAPTCHA with PHP
#
# Verify captcha
$post_data = http_build_query(
array(
'secret' => CAPTCHA_SECRET,
'response' => $_POST['g-recaptcha-response'],
'remoteip' => $_SERVER['REMOTE_ADDR']
)
);
$opts = array('http' =>
@aleron75
aleron75 / shell_delete_unused_images
Last active October 24, 2023 19:59
Delete no more used Product Images on Magento 1
<?php
require_once 'abstract.php';
class Mage_Shell_CheckImages extends Mage_Shell_Abstract
{
const CATALOG_PRODUCT = '/catalog/product';
const CACHE = '/cache/';
protected function _glob_recursive($pattern, $flags = 0)
@colinmollenhour
colinmollenhour / Config.php
Last active April 22, 2020 09:45
Stampede-resistant Config Cache
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@rodrigowebjump
rodrigowebjump / magento-format-number.php
Created September 16, 2014 13:39
Magento format number locale Magento formatar número respeitando a localização
<?php echo Zend_Locale_Format::toNumber($_interest, array('locale' => new Zend_Locale(Mage::app()->getLocale()->getLocale()))); ?>
@SchumacherFM
SchumacherFM / README.md
Last active September 21, 2018 10:05
Avoiding database deadlocks in Magento 1.7

After having many deadlocks due to a high order volumne I've applied the these fixes to the core. Some can be found in a Magento forum. Before the fixes we could only process 1 order every 5-10 secs. Updating to Magento 1.8 is currently not an option but in 1-2 months.

1st Deadlock

Mage_Sales_Model_Abstract::_afterSave must be removed and replaced with afterCommitCallback. This is important to move the grid update (of sales_flat_order_grid) out of the transaction.

2nd Deadlock

Rewrite the method of the Mage_CatalogInventory_Model_Observer::reindexQuoteInventory() to remove the price reindexing from the transaction. That index process will also be fired in event sales_model_service_quote_submit_success.

@bramus
bramus / myservice
Created November 11, 2013 11:23
Running a PHP script as a service/daemon using `start-stop-daemon`
#! /bin/sh
# Installation
# - Move this to /etc/init.d/myservice
# - chmod +x this
#
# Starting and stopping
# - Start: `service myservice start` or `/etc/init.d/myservice start`
# - Stop: `service myservice stop` or `/etc/init.d/myservice stop`
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;