Skip to content

Instantly share code, notes, and snippets.

View bryanlittlefield's full-sized avatar
🎯
Focusing

Bryan Littlefield bryanlittlefield

🎯
Focusing
View GitHub Profile
@bryanlittlefield
bryanlittlefield / sdn-nginx-php7.vhost
Last active July 1, 2022 18:16
Forum NGINX Config
server {
# address and port accepted by the server
listen 80; ## listen for ipv4
#listen [::]:80 default ipv6only=on; ## listen for ipv6
# server IP to compare against http requests, uncomment and set proper value.
# Enter the hostname or IP address you use to reach this server. If you run on your dev environment it might be localhost.
# Note: If your vb install is in a folder inside your domain <mysite>/forum/install/path please change location directives defined below to include the path first. e.G:
# vbulletin.com/forum
#
#!/bin/bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
# =======================================================
# Run Script Command: curl -O https://gist.github.com/bryanlittlefield/8a2ba8fa4c9ae84cc370c8cea5074a7a/raw/build-tugboat-update-env.sh && sh build-tugboat-update-env.sh
#
#
# Actions:
@bryanlittlefield
bryanlittlefield / shipping_info.phtml
Created December 18, 2013 00:08
[MAGENTO] How to get order shipping address details by order id
$incrementid ="100000004";
$_order = Mage::getModel('sales/order')->loadByIncrementId($incrementid);
OR
$order_id ="4";
$_order = Mage::getModel('sales/order')->load($order_id);
$_shippingAddress = $_order->getShippingAddress();
echo $_shippingAddress->getFirstname() . '
';
@bryanlittlefield
bryanlittlefield / toolbar.phtml
Last active March 28, 2016 18:28
[MAGENTO] Custom Sort Options
Update Core Function getAvailableOrders() in : /app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php
----------------------------------------------------------------------------------------------------------------
<?php
public function getAvailableOrders(){
// CUSTOM SORT
$this->_availableOrder = array(
'position' => $this->__('Best Value'),
'entity_id' => $this->__('Newest'),
'name' => $this->__('Name'),
'price' => $this->__('Price'),
@bryanlittlefield
bryanlittlefield / 0_reuse_code.js
Created November 10, 2013 07:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bryanlittlefield
bryanlittlefield / prod-attributes
Created October 29, 2013 18:18
[MAGENTO] - List Product Page Attribute Calls
On Product Page Make Sure to Use
<!-- ************************* Fetch Product and Info ************************* -->
<?php $_helper = $this->helper('catalog/output'); ?>
<?php $_product = $this->getProduct(); ?>
<!-- ======================================================================== -->
<?php
$model = Mage::getModel('catalog/product') //getting product model
$_product = $model->load($productid); //getting product object for particular product id
?>
@bryanlittlefield
bryanlittlefield / coupon-object.phtml
Created October 24, 2013 16:01
[MAGENTO] Get Coupon Object (Name,Description)
First Load Coupon Object
--------------------------
<?php $coupon = Mage::getModel('salesrule/coupon');
$coupon->load($this->getQuote()->getCouponCode(), 'code');
$couponObj = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());
?>
Then Use the Following to get the Name or Description
-----------------------------------------------------
<?php echo $couponObj->getName(); ?>
@bryanlittlefield
bryanlittlefield / functions.php
Created October 9, 2013 18:55
[WORDPRESS] CleanUp Wordpress Dashboard Place the following in the functions.php file of your theme
// Clean Up Dashboard
add_action('admin_init', 'rw_remove_dashboard_widgets');
function rw_remove_dashboard_widgets() {
remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal'); // recent comments
remove_meta_box('dashboard_incoming_links', 'dashboard', 'normal'); // incoming links
remove_meta_box('dashboard_plugins', 'dashboard', 'normal'); // plugins
remove_meta_box('dashboard_quick_press', 'dashboard', 'normal'); // quick press
remove_meta_box('dashboard_recent_drafts', 'dashboard', 'normal'); // recent drafts
@bryanlittlefield
bryanlittlefield / sidebar-category-terms.php
Created September 17, 2013 16:29
[WORDPRESS] Walk through all levels of Custom Category Terms and their Children
<?php
function print_tax($term, $taxonomyName, $level) {
$level++;
$term_children = get_terms($taxonomyName,array('parent' => $term->term_id));
if (!empty($term_children)) {
echo '<li';
if($_GET['active'] == $term->slug) echo " id='current'";
echo '><a>'. $term->name.'</a><ul class="level'.$level.'"">';
foreach($term_children as $term_child):
@bryanlittlefield
bryanlittlefield / magento-form-validator
Created September 16, 2013 14:35
[MAGENTO] Validate Product Options before running action
<script>
function myRegistryValidate(){
var formToValidate = $('Insert Magento Form ID');
var validator = new Validation(formToValidate);
if(validator.validate()) {
//Do Stuffs
}
}
</script>