This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Demo module, Basic Ajax form submit (Ajax framework). | |
*/ | |
/** | |
* Implements hook_menu(). | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$product_array = array(); | |
foreach ($vars['field_product'] as $product) { | |
$product_array[] = $product['product_id']; | |
} | |
$products = commerce_product_load_multiple( | |
$product_array, | |
array("status"=>1) | |
); | |
// testing... | |
echo "<pre>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($node->field_product['und'] as $key => $product_array) { | |
if ( !empty($product_array) ) { | |
$product = commerce_product_load($product_array['product_id']); | |
$largeimg = image_style_url('large', $product->field_image['und'][0]['uri']); | |
echo $largeimg; | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Standalone PHP script to migrate users from Drupal 6 to Drupal 7 programatically. | |
*/ | |
// set HTTP_HOST or drupal will refuse to bootstrap | |
$_SERVER['HTTP_HOST'] = 'SITENAME'; | |
$_SERVER['REMOTE_ADDR'] = '127.0.0.1'; | |
//root of Drupal 7 site | |
$DRUPAL7_ROOT="/var/www/site.com"; | |
define('DRUPAL_ROOT',$DRUPAL7_ROOT); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Bootstrap override | |
* make dropdown menus do dropdown on hover, | |
* and allow parent link to be clickable | |
*/ | |
// place this in your styles | |
ul.nav li.dropdown:hover > ul.dropdown-menu{ | |
display: block !important; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// order. | |
$order_wrapper = entity_metadata_wrapper('commerce_order', $order); | |
// Order id. | |
$order_id = order_wrapper->order_id->value(); | |
// User detils. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define static var | |
define('DRUPAL_ROOT', getcwd()); | |
// include bootstrap | |
include_once('./includes/bootstrap.inc'); | |
// initialize stuff | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
//load user |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_form_alter(). | |
* | |
* Alter exposed filter form in views | |
*/ | |
function MODULE_form_views_exposed_form_alter(&$form, &$form_state, $form_id) { | |
if (isset($form['sort_by'])) { | |
// Combine sort drop-downs into one. | |
$form['sorting'] = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var delay = 0; | |
var offset = 100; | |
document.addEventListener('invalid', function(e){ | |
$(e.target).addClass("invalid"); | |
$('html, body').animate({scrollTop: $($(".invalid")[0]).offset().top - offset }, delay); | |
}, true); | |
document.addEventListener('change', function(e){ | |
$(e.target).removeClass("invalid") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** SHOW MORE FIX AJAX ADD TO CART ***/ | |
Drupal.behaviors.commerceAjxCart = { | |
attach: function (context, settings) { | |
$('.commerce-add-to-cart .form-submit', context).once('ajax', function () { | |
var base = this.id; | |
Drupal.ajax[base] = new Drupal.ajax(base, this, { | |
event: 'mousedown', | |
url: Drupal.settings.basePath + 'system/ajax' | |
}); | |
}); |
OlderNewer