Skip to content

Instantly share code, notes, and snippets.

@nhp
nhp / gist:3456902
Created August 24, 2012 23:03 — forked from fbrnc/gist:3418992
Magento Cache Warming
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
@nhp
nhp / gist:3618629
Created September 4, 2012 08:42 — forked from Vinai/gist:1205913
Bug with store cookie handling in Magento up to 1.6 if specifying a non-default store MAGE_RUN_CODE
--- a/app/code/core/Mage/Core/Model/App.php
+++ b/app/code/core/Mage/Core/Model/App.php
@@ -511,11 +511,7 @@ class Mage_Core_Model_App
if ($this->_currentStore == $store) {
$store = $this->getStore($store);
- if ($store->getWebsite()->getDefaultStore()->getId() == $store->getId()) {
- $this->getCookie()->delete(Mage_Core_Model_Store::COOKIE_NAME);
- } else {
- $this->getCookie()->set(Mage_Core_Model_Store::COOKIE_NAME, $this->_currentStore, true);
@nhp
nhp / aoestatic.xml
Created December 4, 2012 14:38
aoestatic.xml
<layout version="0.1.0">
<default>
<reference name="head">
<!--<action method="addJs"><script>aoestatic/jquery-1.6.1.min.js</script></action>-->
<action method="addJs"><script>aoestatic/jquery-1.6.1.js</script></action>
<action method="addJs"><script>aoestatic/jquery.cookie.js</script></action>
<action method="addJs"><script>aoestatic/common.js</script></action>
</reference>
<reference name="before_body_end">
/**
* Send ajax request to the Magento store in order to insert dynamic content into the
* static page delivered from Varnish
*
* @author Fabrizio Branca
*/
$.noConflict();
jQuery(document).ready(function($) {
var data = {
@nhp
nhp / import.php
Created April 2, 2013 06:51
Script for usage of avs_fastsimpleimport and configurable products
<?php
/**
* Created by JetBrains PhpStorm.
* User: npreuss
* Date: 3/25/13
* Time: 12:53 PM
* To change this template use File | Settings | File Templates.
*/
require_once 'app/Mage.php';
umask( 0 );
<?php
/**
* Created by JetBrains PhpStorm.
* User: npreuss
* Date: 4/8/13
* Time: 12:19 PM
* To change this template use File | Settings | File Templates.
*/
class Spl_Navigation_Model_Observer {
public function topmenuGethtmlBefore (Varien_Event_Observer $observer) {
<global>
<helpers>
<crconnect>
<class>CleverReach_CrConnect_Helper</class>
</crconnect>
</helpers>
$this->db_access->write("DB_NAME", "UPDATE `cataloginventory_stock_item` SET `qty` = '".$qty."', `is_in_stock` = '".$is_in_stock."' WHERE `product_id` = '".$product_id."'");
$this->db_access->write("DB_NAME", "UPDATE `cataloginventory_stock_status` SET `qty` = '".$qty."',`stock_status` = '".$is_in_stock."' WHERE `product_id` = '".$product_id."'");
get_id_by_sku: $id = $this->db_access->read("DB_NAME", "SELECT `entity_id` FROM `catalog_product_entity` WHERE
`sku` = '".$sku."' LIMIT 1");
@nhp
nhp / install-0.0.1.php
Created April 23, 2013 07:30
adding image attribute
<?php
$installer = $this;
$installer->startSetup();
$this->addAttribute(
'catalog_product',
'back_image',
array (
'group' => 'Images',
'type' => 'varchar',
'frontend' => 'catalog/product_attribute_frontend_image',
{
{I have|I've} been {surfing|browsing} online more than {three|3|2|4} hours today, yet I never found any interesting article like yours. {It's|It
is} pretty worth enough for me. {In my opinion|Personally|In my view}, if all {webmasters|site owners|website owners|web owners} and bloggers made good content as
you did, the {internet|net|web} will be {much more|a lot more}
useful than ever before.|
I {couldn't|could not} {resist|refrain from} commenting. {Very well|Perfectly|Well|Exceptionally well} written!|
{I will|I'll} {right away|immediately} {take hold of|grab|clutch|grasp|seize|snatch}
your {rss|rss feed} as I {can not|can't} {in finding|find|to find} your {email|e-mail} subscription {link|hyperlink} or {newsletter|e-newsletter} service. Do {you have|you've} any?
{Please|Kindly} {allow|permit|let} me {realize|recognize|understand|recognise|know} {so that|in order that} I {may just|may|could} subscribe.
Thanks.|