All Posts in development

July 29, 2014 - Comments Off on Important Advice – Talkback Tuesday

Important Advice – Talkback Tuesday

"Talkback Tuesdays" is an original weekly installment where a team member of The Mechanism is asked one question pertaining to digital design, inspiration, and experience. The Q&A will be featured here on The Mechanism Blog as well as on The Mechanism's Facebook, Twitter, and Instagram, every Tuesday. Feel free to offer up your 2¢ in the comments.

This week Dhruv Mehrotra, a key player on The Mechanism's development team, and financial system, gives some valuable advice to anyone just getting their start in the digital/graphic design world, check the best companies to fix credit report errors.

What is the most important advice you can give to a starting graphic/digital designer?

I know this question is about design, but I'm going to take some liberties and answer as if I was speaking to someone interested in becoming a developer. Talking about the importance of computer literacy is an easy platitude to fall back on, and I assume that, if you are reading this, you already want to learn how to code but just don't know where to start.

I started with and worked my way through html, css, and basic javascript. Its easier than ever to learn this stuff, and a simple google search will yield more tutorials than there are cats on the internet. Regardless of where you get your information, I think it is important to start with basic HTML CSS and Javascript in order to get a grasp of what a simple website is about.


The next pieces of advice I have are simple. Build Stuff. Build anything. Build a portfolio. Build a website for your cat. Build a joke website. Rebuild a site you think is cool. Just hit the ground running and put as many hours as you can into this.

Next I would learn to share. Don't keep your websites hoarded on your local machine like a mom hoarding baby teeth. Buy a domain name and a hosting plan. While you're at it figure out what is hosting anyways? What's a server? How does the web work? What's a GET request? Gaining a conceptual understanding of what web development is is the most important part of your learning because it'll inform how you learn more.

For extra credit I would learn GIT, because source control make recently self-taught developers hireable.

July 27, 2012 - Comments Off on Drupal commerce, rules, and beyond

Drupal commerce, rules, and beyond

When creating and processing orders with Commerce in Drupal, you will sometimes need to modify or manipulate the data at some stage in the checkout processes. As we've seen in earlier posts you can easily create or modify rules in Drupal to do just about anything. [hook_coffee_init() anyone?]. If you need to manipulate the current order, create a new rule and set it to React on the Completing checkout process event. Now  you will have access to the $commerce_order object and all of its data goodness.

Now that the Commerce Order is in scope we can access it and perform and action on it. We won't worry about setting any conditions for the rule for this example. Create a new Action for the rule and set it to Execute custom PHP code. You will now see that the $commerce_order object is available. You can start manipulating it with code right there in the PHP code block, or pass the $commerce_order object to a custom module. This is the way we chose to do it. Since we needed to do some extra stuff with the data such as compare some of its values with an external database application it seemed to make more sense to create a module with that code and have it accept the $commerce_order object. We were then able to do better and quicker coding and version control with code kept in external files out side of the rule.

To call your function, just enter it in the PHP code block and include the opening and closing PHP tags as per the instructions:

<?php mechmod($commerce_order); ?>

Here is a quick module sample that can accept the $commerce_order object and do something with it. Create these two files in /sites/all/modules/mechmod

name = Mechanism Commerce Infandibulator
description = Do stuff with a $commerce_order object
core = 7.x
version 0.0.1beta


 * function to do stuff with $commerce_order object
function mechmod_commerce_object_raw($commerce_order) {
  if(module_exists('devel')) { // If devel module is enabled, use dpm()
  else {  // otherwise, just print it out

Now enable the module:

% drush en mechmod --yes

(--yes will automatically choose 'yes' for you instead of being prompted by drush to confirm)

Now, whenever you complete the checkout process the whole $commerce_object will be printed out. This isn't terribly pretty, but it is the beginning of being able to see and then access the data in the order and from there to manipulate it.

Happy coding,

Published by: chazcheadle in The Programming Mechanism
Tags: , , ,