Skip to content

Instantly share code, notes, and snippets.

(function(b){b.fn.equalHeightColumns=function(a){var c,d,a=b.extend({},b.equalHeightColumns.defaults,a);c=a.height;d=b(this);b(this).each(function(){a.children&&(d=b(this).children(a.children));a.height||(a.children?d.each(function(){b(this).height()>c&&(c=b(this).height())}):b(this).height()>c&&(c=b(this).height()))});a.minHeight&&c<a.minHeight&&(c=a.minHeight);a.maxHeight&&c>a.maxHeight&&(c=a.maxHeight);d.animate({height:c},a.speed);return b(this)};b.equalHeightColumns={version:1,defaults:{children:!1, height:0,minHeight:0,maxHeight:0,speed:0}}})(jQuery);
// example use:
// $('.sub-menu > li').equalHeightColumns();
@ryaan-anthony
ryaan-anthony / imgmv.sh
Last active December 25, 2015 19:09
1. Put this script in your /shell/ directory (from within magento root).2. Running the script will move all images to their respective directories, will create directories that do not exists.example:original: /media/catalog/product/ABC.jpg gets moved to: /media/catalog/product/A/B/ABC.jpg
#!/bin/bash
cd ~/public_html/media/catalog/product
find . -maxdepth 1 -type f $1 | while read x; do
filename=$(basename "$x")
first=${filename:0:1};
second=${filename:1:1};
mkdir -p "$first/$second";
mv -f "$x" "$first/$second/$filename";
done
Options All -Indexes
<IfModule mod_php5.c>
php_flag engine 0
</IfModule>
AddHandler cgi-script .php .pl .py .jsp .asp .htm .shtml .sh .cgi
Options -ExecCGI
<IfModule mod_rewrite.c>
<?php
$installer = $this;
$installer->startSetup();
$installer->getConnection()
->addColumn($installer->getTable('sales/quote'), 'ready_date', 'varchar(50)');
$installer->getConnection()
->addColumn($installer->getTable('sales/quote'), 'ready_time', 'varchar(50)');
$installer->getConnection()
->addColumn($installer->getTable('sales/order'), 'delivery_datetime', 'int(20)');
$installer->endSetup();
<?xml version="1.0"?>
<config>
<modules>
<AW_Relatedproducts>
<version>1.4.1</version><platform>ce</platform>
</AW_Relatedproducts>
</modules>
<global>
<blocks>
<relatedproducts>
$options = Mage::getModel('sales/quote_item_option')
->setItemId($item->getId())
->getCollection()
->getOptionsByItem($item);
foreach($options as $option){
if($option->getCode() == "info_buyRequest" && $buy_request = $option->getValue()){
$buy_request = unserialize($buy_request);
if(isset($buy_request['custom_options']['cake'])){
//cake is found in the custom_options of a buyRequest
server {
listen 80;
#listen 443 ssl;
#ssl_certificate tls/magento_local.pem;
#ssl_certificate_key tls/magento_local.key;
#ssl_session_timeout 7m;
## Specify your SSL options here
#ssl_protocols SSLv2 SSLv3 TLSv1;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
@ryaan-anthony
ryaan-anthony / Block Class
Created December 4, 2013 20:52
Hide all payment methods if none needed.
<?php
class Your_Custom_Block_Rewrite extends Mage_Checkout_Block_Onepage_Payment_Methods
{
protected function _canUseMethod($method)
{
$total = $this->getQuote()->getShippingAddress()->getBaseGrandTotal();
if((float)$total > 0){return parent::_canUseMethod($method);}
@ryaan-anthony
ryaan-anthony / gist:8289750
Created January 6, 2014 21:00
create the following procedure, then to call it: type "call sort_categories;" in mysql.
delimiter ;;
drop procedure if exists sort_categories;;
create procedure sort_categories()
begin
DECLARE cur_id BIGINT UNSIGNED;
DECLARE cur_eof INT DEFAULT FALSE;
DECLARE cur CURSOR FOR
SELECT entity_id
FROM catalog_category_entity_varchar
WHERE attribute_id = (
<?php
$installer = $this;
$installer->startSetup();
$installer->getConnection()
->addColumn($installer->getTable('sales/quote'), 'surcharge', 'decimal(12,4)');
$installer->getConnection()
->addColumn($installer->getTable('sales/order'), 'surcharge', 'decimal(12,4)');
$installer->endSetup();