Skip to content

Instantly share code, notes, and snippets.

View DanielSantoro's full-sized avatar

Danny Santoro DanielSantoro

View GitHub Profile
@DanielSantoro
DanielSantoro / variable.php
Created June 8, 2016 21:01
Product Variations Field
<?php
/**
* Variable product add to cart
*
* This template can be overridden by copying it to yourtheme/woocommerce/single-product/add-to-cart/variable.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
@DanielSantoro
DanielSantoro / validation.js
Last active May 25, 2016 15:09
Validation JS
function alphanumeric(inputtxt)
{
var letters = /^[0-9a-zA-Z]+$/;
if(inputtxt.value.match(letters))
{
alert('Your registration number have accepted : you can try another');
document.form1.text1.focus(); // This row would need to be modified so after document, it loaded the CSS class path ending with the ID to that field
return true;
}
else
// Shipping
if ( ( $order->get_total_shipping() + $order->get_shipping_tax() ) > 0 ) {
$post_data[ 'L_NAME' . $item_loop ] = 'Shipping';
$post_data[ 'L_DESC' . $item_loop ] = 'Shipping and shipping taxes';
$post_data[ 'L_COST' . $item_loop ] = $order->get_total_shipping() + $order->get_shipping_tax();
$post_data[ 'L_QTY' . $item_loop ] = 1;
$ITEMAMT += $order->get_total_shipping() + $order->get_shipping_tax();
$item_loop++;
}
/**
* Get shipping args for paypal request.
* @param WC_Order $order
* @return array
*/
protected function get_shipping_args( $order ) {
$shipping_args = array();
if ( 'yes' == $this->gateway->get_option( 'send_shipping' ) ) {
$shipping_args['address_override'] = $this->gateway->get_option( 'address_override' ) === 'yes' ? 1 : 0;
$shipping_args['no_shipping'] = 0;
<td class="td" style="text-align:left; vertical-align:middle; border: 1px solid #eee; font-family: 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif; word-wrap:break-word;"><?php
// Show title/image etc
if ( $show_image ) {
echo apply_filters( 'woocommerce_order_item_thumbnail', '<div style="margin-bottom: 5px"><img src="' . ( $_product->get_image_id() ? current( wp_get_attachment_image_src( $_product->get_image_id(), 'thumbnail') ) : wc_placeholder_img_src() ) .'" alt="' . esc_attr__( 'Product Image', 'woocommerce' ) . '" height="' . esc_attr( $image_size[1] ) . '" width="' . esc_attr( $image_size[0] ) . '" style="vertical-align:middle; margin-right: 10px;" /></div>', $item );
}
// Product name
echo apply_filters( 'woocommerce_order_item_name', $item['name'], $item, false );
@DanielSantoro
DanielSantoro / adsense.js
Created April 28, 2016 19:52
Sample Adsense
<!-- Start Here -->
<script type="text/javascript"><!--
google_ad_client = "pub-2151667935419035";
/* 728x90, created 7/17/08 */
google_ad_slot = "9901119915";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<?php
/**
* WooCommerce SMS Gateway class
*
* Clickatell SMS Gateway class, send out sms messages with clickatell gateway.
*
* @class woocommerce_clikcatell_gateway
* @package WooCommerce
* @category SMS Gateways
* @author WooThemes
@DanielSantoro
DanielSantoro / response.xml
Created April 19, 2016 21:44
Australia Post 160419
stdClass Object
(
[services] => stdClass Object
(
[service] => Array
(
[0] => stdClass Object
(
[code] => INT_PARCEL_COR_OWN_PACKAGING
[name] => Courier
@DanielSantoro
DanielSantoro / install.html
Last active April 13, 2016 16:08
Installation
<h2>Installation</h2>
To install this extension, you can follow <a href="https://docs.woothemes.com/document/installing-and-activating-woocommerce-extensions/" target="_blank">these instructions</a>, or follow the below steps to do a manual installation.
<ol>
<li><strong>Download</strong> the extension from your <a href="https://www.woothemes.com/my-account/downloads/" target="_blank">WooThemes.com Downloads area.</a></li>
<li><strong>Upload</strong> the plugin folder to your <code>/wp-content/plugins/</code> directory.</li>
<li><strong>Activate</strong> ‘WooCommerce Brands’ from the Plugins menu within WordPress</li>
</ol>
[box type="note"]For support and one-click updates, you'll also need to install our <a href="https://docs.woothemes.com/document/woothemes-helper/">WooThemes Helper</a> plugin.[/box]
@DanielSantoro
DanielSantoro / idea.txt
Last active March 18, 2016 20:09
Text for Idea
<strong>Topic (Suggester)</strong> - description
* <strong>Can we finish it in time?</strong> -
* <strong>Is it something we can all participate in?</strong> -
* <strong>Who will this benefit, and how?</strong> -
* <strong>What is the main goal we want to accomplish with the project?</strong> -