Another Example of tabs

<script src=”//code.jquery.com/jquery-1.10.2.js”></script>
<script>
$(document).ready(function(){

$(‘ul.tabs li’).click(function(){
var tab_id = $(this).attr(‘data-tab’);

$(‘ul.tabs li’).removeClass(‘current’);
$(‘.tab-content’).removeClass(‘current’);

$(this).addClass(‘current’);
$(“#”+tab_id).addClass(‘current’);
})

});
</script>
<div class=”container”>

<ul class=”tabs”>
<li class=”tab-link current” data-tab=”tab-1″>Tab One</li>
<li class=”tab-link” data-tab=”tab-2″>Tab Two</li>
<li class=”tab-link” data-tab=”tab-3″>Tab Three</li>
<li class=”tab-link” data-tab=”tab-4″>Tab Four</li>
</ul>

<div id=”tab-1″ class=”tab-content current”>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
<div id=”tab-2″ class=”tab-content”>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div id=”tab-3″ class=”tab-content”>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</div>
<div id=”tab-4″ class=”tab-content”>
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>

</div><!– container –>

<style>
body{
margin-top: 100px;
font-family: ‘Trebuchet MS’, serif;
line-height: 1.6
}
.container{
width: 800px;
margin: 0 auto;
}

ul.tabs{
margin: 0px;
padding: 0px;
list-style: none;
}
ul.tabs li{
background: none;
color: #222;
display: inline-block;
padding: 10px 15px;
cursor: pointer;
}

ul.tabs li.current{
background: #ededed;
color: #222;
}

.tab-content{
display: none;
background: #ededed;
padding: 15px;
}

.tab-content.current{
display: inherit;
}
</style>

Advertisements

Another Example of Tabs

<script src=”//code.jquery.com/jquery-1.10.2.js”></script>
<script>
$(document).ready(function(){

$(‘ul.tabs li’).click(function(){
var tab_id = $(this).attr(‘data-tab’);

$(‘ul.tabs li’).removeClass(‘current’);
$(‘.tab-content’).removeClass(‘current’);

$(this).addClass(‘current’);
$(“#”+tab_id).addClass(‘current’);
})

});
</script>
<div class=”container”>

<ul class=”tabs”>
<li class=”tab-link current” data-tab=”tab-1″>Tab One</li>
<li class=”tab-link” data-tab=”tab-2″>Tab Two</li>
<li class=”tab-link” data-tab=”tab-3″>Tab Three</li>
<li class=”tab-link” data-tab=”tab-4″>Tab Four</li>
</ul>

<div id=”tab-1″ class=”tab-content current”>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>
<div id=”tab-2″ class=”tab-content”>
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
<div id=”tab-3″ class=”tab-content”>
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
</div>
<div id=”tab-4″ class=”tab-content”>
Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
</div>

</div><!– container –>

<style>
body{
margin-top: 100px;
font-family: ‘Trebuchet MS’, serif;
line-height: 1.6
}
.container{
width: 800px;
margin: 0 auto;
}

ul.tabs{
margin: 0px;
padding: 0px;
list-style: none;
}
ul.tabs li{
background: none;
color: #222;
display: inline-block;
padding: 10px 15px;
cursor: pointer;
}

ul.tabs li.current{
background: #ededed;
color: #222;
}

.tab-content{
display: none;
background: #ededed;
padding: 15px;
}

.tab-content.current{
display: inherit;
}
</style>

Tabs Functionality

<!doctype html>
<html lang=”en”>
<head>
<meta charset=”utf-8″>
<title>jQuery UI Tabs – Default functionality</title>

<script src=”//code.jquery.com/jquery-1.10.2.js”></script>
<script src=”//code.jquery.com/ui/1.11.2/jquery-ui.js”></script>

<script>
$(function() {
$( “#tabs” ).tabs();
});
</script>
</head>
<body>
<div id=”tabs”>
<ul>
<li><a href=”#country1″>Nunc tincidunt</a></li>
<li><a href=”#country2″>Proin dolor</a></li>
<li><a href=”#country3″>Aenean lacinia</a></li>
</ul>
<div id=”country1″>
<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
</div>
<div id=”country2″>
<p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
</div>
<div id=”country3″>
<p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
<p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
</div>
</div>
</body>
</html>

List of Books

Ebooks-List

*****************************************************

BuddyPress Theme Development.pdf

Head First WordPress.pdf

Professional WordPress Plugin Development.pdf

Social Media for WordPress.pdf

The WordPress Anthology.pdf

WordPress 3 For Business Bloggers.pdf

WordPress: The Missing Manual.pdf

WordPress E books URLS

************************************************

WordPress

**************************************
http://www.it-ebooks.info/book/379/

http://www.it-ebooks.info/book/1180/

http://it-ebooks.info/book/1225/

http://it-ebooks.info/book/1660/

**************************************

BuddyPress

**************************************

http://www.it-ebooks.info/book/3161/

Google Analystics
**************************************

http://it-ebooks.info/book/101/

Highlights of WordPress :

Highlights of WordPress :

*********************************************************************************

Custom Post Concepts

*********************************************************************************

Creating Custom Post Type

Creating Custom Taxonomies

Displaying Custom Post types

Displaying Custom Post type Based on Category

Displaying Categories List if the posts are empty.

Display Custom Post type Cateogory List

Display Single Post.

Pagination of Customization By Numbers.

Expertise on the Follwing Areas on WordPress.  

***********************************************************************************
Theme Conversion.

Plugin Customization.  

Plugin Development.

Theme Upgradtion.

Plugin Upgradation.

WordPress Child Themes.

Handling Purchased themes.

Experience On WooCommerce.

URLS for PHP DEVELOPER 25

List of URL’s Working http://praveensprojectlist.blogspot.in/ List of URL’s Working http://praveensprojectlist.blogspot.in/ http://drupaldevelopertricks.blogspot.in/ http://wordpressdevelopertrick.blogspot.in/ http://phpdevelopmenttircks.blogspot.in/ http://mysqldevelopertricks.blogspot.in/ http://drupaldevelopertricks.blogspot.in/ http://wordpressdevelopertrick.blogspot.in/ http://phpdevelopmenttircks.blogspot.in/ http://mysqldevelopertricks.blogspot.in/

CUSTOM POST TYPE WORDPRESS

function my_custom_post_friend() {
    $labels = array(
        ‘name’               => _x( ‘Friends’, ‘post type general name’ ),
        ‘singular_name’      => _x( ‘Product’, ‘post type singular name’ ),
        ‘add_new’            => _x( ‘Add New Friend’, ‘book’ ),
        ‘add_new_item’       => __( ‘Add New Friend’ ),
        ‘edit_item’          => __( ‘Edit Friend’ ),
        ‘new_item’           => __( ‘New Friend’ ),
        ‘all_items’          => __( ‘All Friends’ ),
        ‘view_item’          => __( ‘View Friend’ ),
        ‘search_items’       => __( ‘Search Friends’ ),
        ‘not_found’          => __( ‘No Friends found’ ),
        ‘not_found_in_trash’ => __( ‘No Friends found in the Trash’ ),
        ‘parent_item_colon’  => ”,
        ‘menu_name’          => ‘Friends’
    );
    $args = array(
        ‘labels’        => $labels,
        ‘description’   => ‘Friends Data’,
        ‘public’        => true,
        ‘menu_position’ => 5,
        ‘supports’      => array( ‘title’, ‘editor’, ‘thumbnail’, ‘excerpt’, ‘comments’ ),
        ‘has_archive’   => true,
    );
    register_post_type( ‘friend’, $args );    
}
add_action( ‘init’, ‘my_custom_post_friend’ );

Import Complete localhost database using command prompt mysql

For Ubuntu

Importing complete localhost (containing one or more databases)

mysql -u root -ppassword < /var/www/localhost.sql

For Windows

localhost.sql represent your sql file

Importing complete localhost (containing one or more databases)

mysql -u root -p password < /var/www/localhost.sql

localhost.sql represent your sql file

 

Importing single or large files using Command prompt

localhost.sql represent your sql file

Importing complete localhost (containing one or more databases)

mysql -u root -p password database_name < /var/www/localhost.sql

localhost.sql represent your sql file

 

Activating Theme using mysql

It's possible to break everything by doing something so little for example renaming/removing the current theme without disabling it first.
It may also be the case that a new theme is installed which gives that white screen of death.

Hopefully fixing the problem should be painless if you have access to phpMyAdmin (or through SSH) with a few lines of MySQL

First, set Garland as default.

UPDATE system SET status=1 WHERE name = 'garland';

This alone won't fix the issue as the default theme is still set in the variables table and also more than likely in the cache.
Change the variable value.
UPDATE variable SET value='s:7:"garland"' WHERE name = 'theme_default';

Then make sure the cache is cleared. TRUNCATE will drop all the rows in the cache table.

TRUNCATE cache;

Drupal follows Presentation–abstraction–control drupal architecture

Presentation–abstraction–control (PAC) is a software architectural pattern. It is an interaction-oriented software architecture, and is somewhat similar to model–view–controller (MVC) in that it separates an interactive system into three types of components responsible for specific aspects of the application’s functionality. The abstraction component retrieves and processes the data, the presentation component formats the visual and audio presentation of data, and the control component handles things such as the flow of control and communication between the other two components

Product Pricing Rules for Drupal Commerce

  1. Go to Store -> Configuration -> Product Pricing Rules
  2. Click “Add a pricing rule”
  3. Give your rule a name
  4. Under “Actions” click “Add Action”
  5. Under “Commmerce Line Item” choose “Multiply the Unit Price by Some Amount”
  6. The data selector should be “line_item”
  7. The amount should be .9 (in other words, multiply the price by .9).
  8. Now all products have 10% taken off of them.

Differnt Prices for Different User Groups

Drupal Commerce – Different prices for different customer groups

Posted on Fri, 2012-09-14 09:14

What are we looking to do?

When you have an online store, by default a product has a set price which is what everyone pays. You may have discounts through voucher codes but occasionally you want to offer a different price to shoppers i.e. wholesalers.

So what we will be doing is creating a new role called ‘Wholesaler’, adding a new price field to our product, then we will set up a rule which will calculate the right price for the wholesaler.

The tutorial will be focused around a basic Drupal 7 install with the Commerce module (and the other relevant modules installed).

Tutorial

Create user role

Go to admin/people/permissions/roles and add a new role.

Whenever you have a wholesaler wishing to use the site, you will need to give the wholesaler role to that user.

Set up a new price field

Go to admin/commerce/products/types/product/fields and in the Add new field, type Wholesaler price.

For the field type select Price, then chose the Price with currency widget type and add the field.

On the settings form, it is up to you whether you want to make it required etc. But leave the Number of values set to 1.

Set up the pricing rule

Go to admin/commerce/config/product-pricing and click the Add a pricing rule link.

For the name, just enter Wholesaler price rule.

Under events, it will automatically set the event called Calculating the sell price of a product.

Skip past to the Conditions section and click the Add condition link.

From the drop-down, select Entity has field.

Under Entity, for the Data selector set it to commerce-line-item. From the drop-down this will be listed as commerce-line-item (Product line item).

For the field, select commerce_product. Click Save.

Add another condition, and select Entity has field again. For the Data selector, choose commerce-line-item:commerce-product. In the drop-down you will need to select commerce-line-item… (Product line item) (not the …) which will bring up a few more options, from these select commerce-line-item:commerce-product (Product).

Then in the field box select field_wholesaler_price or whatever you called the field in step 2.

Lastly, had a new condition called and select User has role(s). From the data selector chose site:current-user. You can choose this by going to site:…(Site information) then choosing site: current-user (Logged in user).

Then in the Roles section click your wholesaler role.

Save the condition.

Finally, under Actions click Add action. In the drop down under Commerce Line Item, select Set the unit price to a specific amount.

The Data selector should already be set to commerce_line_item.

Under Amount, click the link which says Switch to data selection.

From the drop down select commerce-line-item:… (Product line item) then select commerce-line-item: commerce-product:… (Product).

Then select your price field which will be commerce-line-item: commerce-product: field-wholesaler-price:… (Wholesaler price). Then select commerce-line-item: commerce-product: field-wholesaler-price: amount (Amount).

Leave the Price component type set to Base price. Under Price rounding mode it is up to you how this is set.

Conclusion

If you now set up a dummy user, give them the role wholesaler and login as them and browse the site, all the prices will now be showing the wholesaler price by default. Log out and the prices will go back to retail prices.

You can set up multiple different pricing structures thanks to Drupals fields module which allows an infinite amount of price fields.

Potential problem

This may cause a few issues for people on how they want data to appear. When a wholesaler is logged in they will see the wholesaler price and not the retail price. If you want to show the retailer price as well you will have to alter your product display template file to show both prices.

Creating Select options using Drupal

$form[‘value’][‘country1’] = array(
      ‘#type’ => ‘select’,
      ‘#title’ => t(‘Country’),
      ‘#options’ => array(‘au’ => ‘Australia’,’nz’ => ‘Newzeland’),
      ‘#default_value’ => $this->value[‘country1’],
      ‘#process’ => array(‘ctools_dependent_process’),
      ‘#dependency’ => array(‘edit-options-origin’ => array(‘country1’, ‘postal_default’)),
      ‘#weight’ => 4,
      ‘#maxlength’ => 16
    );

List of Countries

    $form[‘value’][‘country’] = array(
      ‘#type’ => ‘select’,
      ‘#title’ => t(‘Country’),
      ‘#options’ => array(” => ”) + location_get_iso3166_list(),
      ‘#default_value’ => $this->value[‘country’],
      ‘#process’ => array(‘ctools_dependent_process’),
      ‘#dependency’ => array(‘edit-options-origin’ => array(‘postal’)),
      ‘#weight’ => 4,
      ‘#attributes’ => array(
        ‘class’ => array(‘location_auto_country’),
      ),
    );

 

 

Creating Text Field in drupal

 $form[‘value’][‘city’] = array(
      ‘#type’ => ‘textfield’,
      ‘#title’ => t(‘City’),
      ‘#default_value’ => $this->value[‘city’],
      ‘#process’ => array(‘ctools_dependent_process’),
      ‘#dependency’ => array(‘edit-options-origin’ => array(‘city’, ‘postal_default’)),
      ‘#weight’ => 3,
      ‘#maxlength’ => 16
    );

Display Logo in Drupal

     <?php if ($logo): ?>
                            <a href=”<?php print $front_page ?>” >                            
                            <img src=”<?php print $logo ?>” alt=”<?php print $site_name ?>”  /></a>
                            <?php endif; ?>

How to Update the Contributed Modules for Minor Versions in Drupal

Step:1

Check your notes, and the UPGRADE.txt files inside each module, to see if any special upgrade instructions apply

 Step: 2

 Firstly you set to the site maintanence to offline

Step:3

 Remove the complete module with new one

Step:4

Run the update.php script in the browser.

Step:5

 it shows access Denied the go to sites/default/settings.php

 $update_free_access = FALSE; changes to

$update_free_access = TRUE;

Run update.php script in browser it will update to latest version.

Step:5

check in configuration status report contains available updates there you can find the corresponding module is update or not

if it is updated then go tp sites/default/settings.php and $update_free_access = TRUE; make changes to $update_free_access = FALSE; Don’t Forget to Update

Custom Post Type in WordPress

add_action( ‘init’, ‘create_post_type’ );
function create_post_type() {
    register_post_type( ‘acme_product’,
        array(
            ‘labels’ => array(
                ‘name’ => __( ‘Products’ ),
                ‘singular_name’ => __( ‘Product’ )
            ),
            ‘public’ => true,
            ‘has_archive’ => true,
            ‘rewrite’ => array(‘slug’ => ‘products’),
        )
    );
}

Print Submenu in Each Page

<?php
if (is_page()) {
  $page = $post->ID;
  if ($post->post_parent) {
    $page = $post->post_parent;
  }
   $children=wp_list_pages( ‘child_of=’ . $page . ‘&title_li=’ );
  if ($children)
      {
    $output = wp_list_pages (‘child_of=’ . $page . ‘ ‘);
  }
}
echo $output;
?>

Story Behind Sudo (Ubuntu)

In Linux (and Unix in general), there is a SuperUser named Root. The Windows equivalent of Root is Administrators group. The SuperUser can do anything and everything, and thus doing daily work as the SuperUser can be dangerous. You could type a command incorrectly and destroy the system. Ideally, you run as a user that has only the privileges needed for the task at hand. In some cases, this is necessarily Root, but most of the time it is a regular user.

By default, the Root account password is locked in Ubuntu. This means that you cannot login as Root directly or use the su command to become the Root user. However, since the Root account physically exists it is still possible to run programs with root-level privileges. This is where sudo comes in – it allows authorized users (normally “Administrative” users; for further information please refer to AddUsersHowto) to run certain programs as Root without having to know the root password.

This means that in the terminal you should use sudo for commands that require root privileges; simply prepend sudo to all the commands you would normally run as Root. For more extensive usage examples, please see below. Similarly, when you run GUI programs that require root privileges (e.g. the network configuration applet), use graphical sudo and you will also be prompted for a password (more below). Just remember, when sudo asks for a password, it needs YOUR USER password, and not the Root account password.

Jquery Validation

$(document).ready(function(){

$("#form1").validate({
   rules: {
     field1: "required"
   },
   messages: {
     field1: "Please specify your name"

   }
})

$('#btn').click(function() {
 $("#form1").validate();  // This is not working and is not validating the form
});

});