Skip to content

Instantly share code, notes, and snippets.

@speedupmate
speedupmate / geoiptest.php
Created December 6, 2011 14:30
GeoIp test
<?php
/**
* PUT THE PATH TO GEOIP DATABASE HERE
*/
$database ='geoip/GeoLiteCity.dat';
try {
require_once('Net/GeoIP.php');
@speedupmate
speedupmate / gist:2005826
Created March 9, 2012 09:26
mod_rewrite mobile users to regular checkout
RewriteCond %{HTTP_USER_AGENT} ^.*(iPhone|iPod|BlackBerry|Palm|Googlebot\-Mobile|Mobile|mobile|mobi|Windows\ Mobile|Safari\ Mobile|Android|Opera\ Mini).*$ [NC]
RewriteCond %{REQUEST_URI} ^.*(onestepcheckout)
RewriteRule .* /checkout/onepage/ [R,L]
@speedupmate
speedupmate / gist:2168700
Created March 23, 2012 09:04
estimate shipping add data to billing address as well
/**
* Initialize billing and shipping information
*/
public function estimatePostAction()
{
$country = (string) $this->getRequest()->getParam('country_id');
$postcode = (string) $this->getRequest()->getParam('estimate_postcode');
$city = (string) $this->getRequest()->getParam('estimate_city');
$regionId = (string) $this->getRequest()->getParam('region_id');
$region = (string) $this->getRequest()->getParam('region');
@speedupmate
speedupmate / Total.php
Last active October 2, 2015 18:58
Phoenix_CashOnDelivery_Model_Quote_Total patch
<?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
@speedupmate
speedupmate / gist:4086468
Created November 16, 2012 11:07
rewrite regionupdater to make region/state required always
RegionUpdater.prototype.setMarkDisplay = RegionUpdater.prototype.setMarkDisplay.wrap(
function(parent, elem, display){
elem = $(elem);
var labelElement = elem.up(0).down('label > span.required') ||
elem.up(1).down('label > span.required') ||
elem.up(0).down('label.required > em') ||
elem.up(1).down('label.required > em');
if(labelElement) {
inputElement = labelElement.up().next('input');
if (display) {
@speedupmate
speedupmate / window.js
Created May 20, 2013 08:57
window.js ie10 fixes
/**
* @author Ryan Johnson <http://syntacticx.com/>
* @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
* @package LivePipe UI
* @license MIT
* @url http://livepipe.net/core
* @require prototype.js
*/
if(typeof(Control) == 'undefined')
@speedupmate
speedupmate / window.js
Created June 25, 2013 09:59
Livepipe.net js library issues with IE10
/**
* @author Ryan Johnson <http://syntacticx.com/>
* @copyright 2008 PersonalGrid Corporation <http://personalgrid.com/>
* @package LivePipe UI
* @license MIT
* @url http://livepipe.net/core
* @require prototype.js
*/
if(typeof(Control) == 'undefined')
@speedupmate
speedupmate / form.phtml
Created August 29, 2013 08:15
braintree payment method OneStepCheckout compatibility patch
<?php
$_form = $this;
$_code = $_form->getMethodCode();
$_method = $_form->getMethod();
$_model = Mage::getModel('braintree/paymentmethod');
$_loggedIn = Mage::app()->isInstalled() && Mage::getSingleton('customer/session')->isLoggedIn();
$_storedCards = $_model->currentCustomerStoredCards();
$_useVault = $_loggedIn && $_model->useVault() && count($_storedCards);
?>
@speedupmate
speedupmate / gist:7911608
Created December 11, 2013 14:46
Create e-mail matching validation field
<?php if(!$this->isCustomerLoggedIn()): ?>
<?php $billingFields['email'] = $billingFields['email'].'
<div class="input-box input-email'.((in_array('email', $formErrors)) ? ' input-error' : '').'">
<label for="billing:email">'.$this->__('Email Address').' <span class="required">*</span></label><br />
<input type="text" name="billing[email]" id="billing:email" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getEmail()).'" title="'.$this->__('Email Address') .'" class="validate-email required-entry input-text" />
</div>
<div class="input-box input-email-repeat'.((in_array('email', $formErrors)) ? ' input-error' : '').'">
<label for="billing:email-repeat">'.$this->__('Retype Email Address').' <span class="required">*</span></label><br />
<input type="text" name="billing[email-repeat]" id="billing:email-repeat" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getEmail()).'" title="'.$this->__(
/* Responsive styles created by Valentin Niklasson */
@media screen and (min-width : 954px) {
div.checkoutcontainer div.input-city { width: 45%!important; }
div.checkoutcontainer div.input-country select { width: 83%!important; }
div.checkoutcontainer div.input-city { width: 100%!important; }
div.checkoutcontainer div.input-region { width: 55.8%!important; }
div.checkoutcontainer div.input-address-short .input-text,
div.checkoutcontainer div.input-firstname .input-text,
div.checkoutcontainer div.input-lastname .input-text,
div.checkoutcontainer div.input-email .input-text,