Posts

Showing posts from February, 2016

Remove index.php from url in Yii Framework

Follow given steps:

Enable Url re-writing on Apache. Place .htaccess on root of your project RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # otherwise forward it to index.php RewriteRule . index.php
done...hope it will work

Add custom order filed in WooCommerce Admin and show in orders list

We can Add custom order filed in WooCommerce Admin panel and show it in orders list and woocommerce rest api also.
Copy the following code in to your active themes functions.php or plugins.

add_action( 'woocommerce_admin_order_data_after_order_details', 'rb_shop_location_admin_order_meta', 10, 1 ); function rb_shop_location_admin_order_meta( $order ){?> <br class="clear" /> <h4>Shop Location <a href="#" class="edit_address">Edit</a></h4> <?php $shop_location = get_post_meta( $order->get_order_number(), 'shop_location', true ); ?> <div class="address"> <p>Location: <?php echo $shop_location ?></p> </div> <div class="edit_address"> <?php woocommerce_wp_text_input( array( 'id' => 'shop_location', 'label' => 'Location:', 'value' => $shop_location, 'wrapper_class'…

Add product to cart with price override in WooCommerce

//Overriding price of product in cart
add_action('woocommerce_before_calculate_totals','add_custom_price');function add_custom_price( $cart_object ){ $custom_price =10;// This will be your custom price foreach( $cart_object->cart_contents as $key => $value ){ $value['data']->price = $custom_price;}}

Add minimum charge on cart page in Woocommerce

//ADD CUSTOM FEE // Add code in function.php of your themefunction woo_add_min_fee() { global $woocommerce; $stotal = $woocommerce->cart->subtotal; if ($stotal < 499 ) { $surcharge = 100; } else { $surcharge = 0; } $woocommerce->cart->add_fee( __('Surcharge', 'woocommerce'), $surcharge ); } add_action( 'woocommerce_cart_calculate_fees', 'woo_add_min_fee' );

Add or remove readonly attribute from textbox on clicking radion button using jquery

$(document).ready(function(){ $('.radio_class').click(function(){var BtnVal = $(this).val();if(BtnVal =="yes"){ $("#textBoxID").attr("readonly",false);}else{ $("#textBoxID").attr("readonly",true);}});});

Login with email or username in codeigniter

function login_user() { $email= $this->input->post('email'); $password= MD5($this->input->post('password')); $this->db->where("(Email='$email' OR Username='$email') AND Password='$password' "); $Query = $this->db->get('users'); if($Query->num_rows() > 0) { return $Query->row(); } else { return false; } }

Uncaught TypeError: Cannot read property 'task' of null at Core.js in Joomla 3.4 : Solved

Change form id in administrator/components/com_content/views/article/tmpl/edit.php
<formaction="..."method="post"name="adminForm"id="item-form"class="form-validate"> to <formaction="..."method="post"name="adminForm"id="adminForm"class="form-validate">

Cancel or Close not work in edit article on Joomla - Solved

In pages that you have JS error did you force latest JS / CSS to be downloaded ?
PC: CTRL-F5
Safari: CMD + R
Linux: F5
or change form id in administrator/components/com_content/views/article/tmpl/edit.php
<formaction="..."method="post"name="adminForm"id="item-form"class="form-validate"> to <formaction="..."method="post"name="adminForm"id="adminForm"class="form-validate">