down arrowMenu

UNI Webtools: Resources for Web Developers

Gizra.com: Forking Todo Restful with Backbone.Marionette

Posted on Friday, May 22nd, 2015 by drupalroot

In this guest post, Luke Herrington shares his experience with integrating an existing Drupal backend with a Backbone.Marionette Todo app.

If you're reading this, you probably already know about all of the great work that Gizra has done in the Drupal/REST space. If you haven't, I highly recommend you check out their github repo. Also see the RESTful module.

Mediacurrent: Highlights From DrupalCon Los Angeles

Posted on Friday, May 22nd, 2015 by drupalroot

DrupalCon Los Angeles Recap

Last week, was in sunny Los Angeles for DrupalCon 2015. Though many were seasoned veterans, it was my first time at a Con. It was a whirlwind of team building, a magical Prenote, great one-on-one coversations and plenty of Drupal talk. Needless to say, I'm still recovering! But if one thing is certain, our team had a wonderful time. Here are some of their takeaways:

Paul Booker: Creating an action to update the prices of your commerce products

Posted on Friday, May 22nd, 2015 by drupalroot
/**
 * Implements hook_action_info().
 */

function mymodule_action_info() {
  return array(
    'mymodule_update_products' => array(
      'type' => 'entity',
      'label' => t('Update products by 2%'),
      'configurable' => FALSE, 
      'triggers' => array('any'),
      'pass rows' => TRUE,
    ),
  );
} 
 
function mymodule_update_products(&$entity, $context) {	
  $product_id = $entity->product_id; 
  //dsm($product_id);	
  $price = $entity->commerce_price[LANGUAGE_NONE][0]['amount'];
  //dsm($price);
	
  $updated_price = 1.02 * $price;
  	
  $affected_rows = db_update('field_data_commerce_price')
    ->fields(array('commerce_price_amount' => $updated_price))
    ->condition('entity_id', $product_id)
    ->execute();
          

Pages

Subscribe to UNI Webtools: Resources for Web Developers RSS