Skip to content

Instantly share code, notes, and snippets.

View generalconsensus's full-sized avatar

Daniel McDermott generalconsensus

  • College Grove, TN
View GitHub Profile
@generalconsensus
generalconsensus / FeatureContext.php
Last active March 4, 2016 13:54
behat autoselect chosen.js
<?php
use Behat\Mink\Exception\ElementNotFoundException;
/**
* @Given /^I select "([^"]*)" from "([^"]*)" chosen\.js autoselect box$/
*/
public function iSelectFromChosenJAutoselectBox($option, $select) {
$select = $this->fixStepArgument($select);
$option = $this->fixStepArgument($option);
use Behat\Mink\Exception\ElementNotFoundException;
/**
* @Given /^I select "([^"]*)" from "([^"]*)" chosen\.js select box$/
*/
public function iSelectFromChosenJsSelectBox($option, $select) {
$select = $this->fixStepArgument($select);
$option = $this->fixStepArgument($option);
$page = $this->getSession()->getPage();
@generalconsensus
generalconsensus / gist:2929209
Created June 14, 2012 09:08
Commerce Order Wrapper
global $user;
$cart_order = commerce_cart_order_load($user->uid);
dpm($cart_order);
$order_wrapper = entity_metadata_wrapper('commerce_line_item', $cart_order);
I was just recently trying to figure this problem out and I realized that the issue might be that we need a different kind of action for applying a percentage coupon against an order total. Here is my rough code...
<?php
function hook_rules_action_info() {
$actions['commerce_coupon_pct_apply_to_total'] = array(
'label' => t('Apply a percentage coupon to the order total'),
'parameter' => array(
'coupon' => array(
'type' => 'commerce_coupon',
'label' => t('Coupon'),
@generalconsensus
generalconsensus / eu_country_codes.rb
Created June 1, 2012 08:31 — forked from henrik/eu_country_codes.rb
EU (European Union) country codes, ISO 3166-1 alpha-2.
# Note: VAT identification numbers for Greece use "EL", not "GR".
COUNTRY_CODES_EU = %w[
AT BE BG CY CZ DK EE FI FR DE GR HU IE IT
LV LT LU MT NL PL PT RO SK SI ES SE GB
]