Skip to content

Instantly share code, notes, and snippets.

View chered's full-sized avatar

chered chered

View GitHub Profile
@chered
chered / Commerce Invoice Receipt Rule Export
Last active December 23, 2015 21:09
Commerce Invoice Receipt Rule Export
{ "rules_send_an_invoice_receipt_on_email" : {
"LABEL" : "Send an invoice receipt on email",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "commerce_invoice_receipt", "commerce_checkout" ],
"ON" : [ "commerce_checkout_complete" ],
"DO" : [
{ "commerce_invoice_receipt_action_mail" : {
"commerce_order" : [ "commerce-order" ],
"to" : "[commerce-order:owner] \u003C[commerce-order:mail]\u003E",
"subject" : "[site:name]: Order #[commerce-order:order-id]"
@chered
chered / Add delivery date field on commerce-order-invoice-view.tpl.php
Created January 7, 2014 23:46
Add delivery date field on commerce-order-invoice-view.tpl.php.
<b><?php print t('Delivery Date:'); ?></b> <?php print date('j F, Y g:i a', $order->field_delivery_date['und'][0]['value']); ?>
@chered
chered / change text on add to cart button
Last active August 29, 2015 14:06
simple drupal module to change text on add to cart button (filter by page url)
//changecarttext.info
name = change text of add to cart
description = add to cart
package = custom
core = 7.x
files[] = changecarttext.module
@chered
chered / gist:b8cfb1713d2f83cc1e43
Created November 5, 2014 15:18
override user login and checkout buttons on template.php
function power_form_alter(&$form, &$form_state, $form_id) {
/*
* Show all variables in user login
* dpm($form);
*/
if ($form_id == 'user_login') {
@chered
chered / send an email notification after an order status has been set to completed
Last active August 29, 2015 14:08
by default drupal commerce does not have an email sent when an order status has been completed. this is a rule just import it and straightaway you can use it.
{ "rules_send_email_after_order_status_is_completed" : {
"LABEL" : "send email after order status is completed",
"PLUGIN" : "reaction rule",
"REQUIRES" : [ "rules", "entity" ],
"ON" : [ "commerce_order_update" ],
"IF" : [
{ "data_is" : { "data" : [ "commerce-order:status" ], "value" : "completed" } }
],
"DO" : [
{ "mail" : {
@chered
chered / How to show or hide an element based on url using Jquery
Created November 7, 2014 00:33
How to show or hide an element based on url using Jquery
// jQuery Show / Hide Div based on URL parameter
if(window.location.href == "http://test.dev/node/1?utm_medium=adwords"){
$('.menu-818').hide();
$('.menu-900').show();
}
@chered
chered / force IE compatibility mode to off
Created November 23, 2014 02:19
this will force IE compatibility mode to off(Compatibility mode is greyed)
function your_theme_name_preprocess_html(&$vars) {
//force ie compatibility off
drupal_add_http_header('X-UA-Compatible', 'IE=edge,chrome=1');
}
@chered
chered / add bank transfer method on commerce-order-invoice-view.tpl.php using if statement
Created December 3, 2014 00:22
add bank transfer method on commerce-order-invoice-view.tpl.php using if statement
<?php if($order->data['payment_method']=='bank_transfer|commerce_payment_bank_transfer'):?>
<h4><?php print t('Bank Details'); ?></h4>
<b><?php print t('Account Name:'); ?></b> <?php print t('My Website Name'); ?><br/>
<b><?php print t('Account number:'); ?></b> <?php print t('343353535'); ?><br/>
<b><?php print t('Banking institution:'); ?></b> <?php print t('BDO'); ?><br/>
<b><?php print t('Bank code:'); ?></b> <?php print t('343434'); ?><br/>
function onboarding_remove_menu_items() {
if( !current_user_can( 'administrator' ) ):
remove_menu_page( 'edit.php?post_type=testimonial' );
endif;
}
add_action( 'admin_menu', 'onboarding_remove_menu_items' );
<?php $content = get_the_content();
$trimmed_content = wp_trim_words( $content, 200, '<a href="'. get_permalink() .'">...[ read more ]</a>' ); ?>
<div class="archive-trim"><?php echo $trimmed_content; ?></div>