This file contains 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 | |
// Get a nicely formatted amount for Ex VAT & Vat order totals. | |
// Get the order wrapper | |
$order_wrapper = entity_metadata_wrapper('commerce_order', $order); | |
// Order total. | |
$order_total = $order_wrapper->commerce_order_total->value(); | |
// Get ex vat amount. |
This file contains 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
drush vset comment_maintain_node_statistics TRUE |
This file contains 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
// Using the Entity API | |
$image = $MY_ENITIY->field_image->value(); | |
$variables = array( | |
'style_name' => 'my_style__img', | |
'path' => $centre['image']['uri'], | |
'width' => $centre['image']['width'], | |
'height' => $centre['image']['height'], | |
); | |
$img = theme('image_style', $variables ); | |
This file contains 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 | |
function amazons3_upload($file, bucket) | |
if(!libraries_load('awssdk')) { | |
print t('Unable to load the AWS SDK. Please check you have installed the library correctly and configured your S3 credentials.</br>'); | |
return; | |
} | |
else if(!class_exists('AmazonS3')) { | |
print t('Cannot load AmazonS3 class. Please check the awssdk is installed correctly.</br>'); | |
return; | |
} |
This file contains 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
drush dl entity_translation | |
drush en entity_translation -y | |
drush dl title | |
drush en title -y | |
drush dl variable | |
drush en variable -y | |
drush dl i18n | |
drush en i18n, i18n_translation, i18n_field, i18n_menu -y |
This file contains 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 | |
/** | |
* Implementation of hook_commerce_currency_info_alter(). | |
*/ | |
function MyModule_commerce_currency_info_alter(&$currencies, $langcode) { | |
// Add a curreny format callback so we can take over formating. | |
$currencies['RUB']['format_callback'] = 'MyModule_commerce_currency_format'; | |
} | |
This file contains 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
/** | |
* Implements hook_form_alter(). | |
*/ | |
function dwwcommerce_form_alter(&$form, &$form_state, $form_id) { | |
// The style edit form. | |
if ($form_id == 'product_style_node_form') { | |
// Add a custom submit. | |
$form['actions']['submit']['#submit'][] = 'mymodule_node_prod_display_form_submit'; | |
} | |
} |
This file contains 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
### Keybase proof | |
I hereby claim: | |
* I am BBGuy on github. | |
* I am guy_schneerson (https://keybase.io/guy_schneerson) on keybase. | |
* I have a public key whose fingerprint is E0F9 7435 1C0D 3783 458E 5F99 CE91 6F6F 7690 BF49 | |
To claim this, I am signing this object: |
This file contains 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 | |
/** | |
* Get the node ID for a commerce product using it's product ID. | |
* | |
* Asumes only one. If not will return the first node referencing the product. | |
* If the commerce product has no product display will return FALSE. | |
*/ | |
function _get_product_referencing_nid($product_id) { | |
$query = new EntityFieldQuery(); |
OlderNewer