Monday 27 August 2012

Display Product Custom Option On list.phtml

<?php if($_product->isSaleable()): ?>
    <form action="<?php echo Mage::getBaseUrl(); ?>checkout/cart/add/" method="post" id="product_addtocart_form_<?php echo $_product->getId() ?>"<?php if($_product->getOptions()): ?> enctype="multipart/form-data"<?php endif; ?>>
        <fieldset class="no-display">
            <input type="hidden" name="product" value="<?php echo $_product->getId() ?>" />
            <input type="hidden" name="related_product" id="related-products-field" value="" />
        </fieldset>
    <?php $product = Mage::getModel('catalog/product'); ?>
    <?php $product->load($_product->getId()); ?>
 
    <?php
    $sandy = "";
    $attVal = $product->getOptions();
    if(sizeof($attVal)) {
      foreach($attVal as $optionVal) {
        $sandy .= $optionVal->getTitle().": ";
        $sandy .= "<select name='options[".$optionVal->getId()."]'>";
        foreach($optionVal->getValues() as $valuesKey => $valuesVal) {
          $sandy .= "<option price='".$valuesVal->getPrice(true)."' value='".$valuesVal->getId()."'>".$valuesVal->getTitle() .'+'. $valuesVal->getPrice(true) ."</option>";
        }
        $sandy .= "</select>";
      }
    }
    echo $sandy;
    ?>
 
     <?php echo $this->getPriceHtml($_product, true) ?>
 
<?php // Product quantity and add  ?>
 
    <?php if(!$_product->isGrouped()): ?>
        <label>Qty:</label>
        <input name="qty" type="text" id="qty" maxlength="12" value="<?php echo $this->getMinimalQty($_product)==null?1:$this->getMinimalQty($_product) ?>"/>
        <button type="button" onclick="productAddToCartForm<?php echo $_product->getId() ?>.submit()">Add to Cart</button>
 
    <?php endif; ?>
 
    </form>
    <script type="text/javascript">
            var productAddToCartForm<?php echo $_product->getId() ?> = new VarienForm('product_addtocart_form_<?php echo $_product->getId() ?>');
            productAddToCartForm<?php echo $_product->getId() ?>.submit = function(){
                    if (this.validator.validate()) {
                            this.form.submit();
                    }
            }.bind(productAddToCartForm<?php echo $_product->getId() ?>);
    </script>
<?php else: ?>
    <div class="out-of-stock"><?php echo $this->__('Out of stock') ?></div>
<?php endif; ?>

Difference btwn HTML4 and HTML5

The main difference between HTML4 and HTML5 are :-

1. API(Application programming interface) - is provide a better & improved application to development system

In Html5 in introduce several new API

2. Automatically delete unnecessary elements

3. More flexible compare to html4

4. New elements

Header
Foooter
Section
Article
Nav
Aside
Video
Progress
Meter
Time
Figure
Dialog
Datagrid
Menu
Command
Canvas

5. More powerful video games can we inbuilt in html5

Friday 24 August 2012

Delete Product images in magento


To delete all product images in magento is simple

Truncate table Catalog_product_entity__media_gallery
Truncate table Catalog_product_entity__media

Difference between Magento Community,Enterprise and Enterprise premium




Support, Services and Security

Support, Services and Security Magento community Magento Enterprise Magnento Enterprise Premium
Multiple Licenses Support
Consulting Services Support
Training Support
Support Support Support
PA-DSS Security Compliant & Strong Data Encryption Support Support
Code-level Access Support Support Support
Web Services APIs Support Support Support
3rd-party Extensions & Themes Support Support Support
Major Features

Major Features Magento community Magento Enterprise Magnento Enterprise Premium
Customer Segmentation with Targeted Offerings Support Support
Full-page Caching Support Support
Reward Points System & Store Credits Support Support
Return Management Authorization Support Support
Enhanced Catalog and Content Management System (CMS+) Support Support
Staging, Merging and Rollback of Content Support Support
Minimum Advertised Price Support Support
Call Center with Assisted Shopping Support Support
Private Sales, Events, Invitations Support Support
Gift Registry and Gifting Options Support Support
Price and Promotion Permission Support Support
Solr Search Support Support
Persistent Shopping Cart Included Support Support Support
Flexible Pricing Rules Support Support Support
Multiple Stores and Website Views Support Support Support
Analytics and Reporting Support Support Support
Layered Navigation Support Support Support
International Support & Multiple Languages Support Support Support
Shipping Rules, Payment Configurations and Gateways Support Support Support
Product Configurations Support Support Support
Up-sells, Cross-sells and Related Products Support Support Support
SEO Support Support Support
Flexible Couponing and Promotions Included Support Support Support
Customer Accounts Management Support Support Support
Order Management Support Support Support
Mobile Commerce Support Support Support

Monday 13 August 2012

Disable Mouse Text Selection

Disable Mouse Text Selection

Script for disable mouse selection 

<script type="text/javascript">
//Disable mouse select
// http://nxwiki.blogspot.com
var omitformtags=["input", "textarea", "select"]
omitformtags=omitformtags.join("|")
function disableselect(e){
if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
return false }
function reEnable(){
return true }
if (typeof document.onselectstart!="undefined")
document.onselectstart=new Function ("return false")
else {
document.onmousedown=disableselect
document.onmouseup=reEnable }
</script>





Sunday 12 August 2012

Essential Web Development Tricks

1. Functions and Classes

You can find a whole array of pre-made classes and functions to help save development time. A great resource directory for finding the perfect PHP classes is PHPClasses.org. For those of you who use Perl, you should be familiar with CPAN.

CAPTCHA

CAPTCHA (Completely Automated Public Turing to tell Computers and Humans Apart) is the term used to describe the use of images which humans can identify, in order to ensure an automated bot/computer program isn’t accessing your application. The ideal use for this is in contact forms to ensure only humans can send messages — therefore eliminating automated spam and junk messages.
The following CAPTCHA systems can be easily integrated with your applications:
  • reCAPTCHA
    One of the most popular CAPTCHA systems that helps to digitize books, newspapers and old time radio shows by using CAPTCHA inputs to help translate. There is also a Perl module available for reCAPTCHA.
  • Securimage
    Securimage is a free open-source PHP CAPTCHA script for generating complex images and CAPTCHA codes.
  • freeCap
    A GPL CAPTCHA script to stop spam.
  • HN CAPTCHA
    A CAPTCHA script written in PHP, licensed under LGPL.

Date Manipulation

Manipulating dates in your applications can be a time-consuming process. PHP and Perl include numerous functions for automating the process, but often don’t offer all the required functions.
The following date manipulation functions can be easily integrated with your applications:
  • PEAR Date
    Generic PHP classes for representation and manipulation of dates, times, and time zones without the need for timestamps.
  • Date Class
    This PHP class allows you to add or subtract periods from dates, and calculate the difference between two dates.
  • Date manipulation in PHP
    A PHP tutorial on PHPBuilder.com, guiding you through a number of common date manipulation processes.
  • Date::Calc Perl Module
    A powerful Perl module for date calculations based on the Gregorian calendar.

Image Manipulation

Manipulating images is a common requirement. Whether you want to resize your images while maintaining aspect ratios, or add watermarks, the process can be entirely automated using a server-side language like PHP or Perl.

Form Validation

Form validation is critical to ensure users enter form information in a suitable format, and is especially important to protect your application against attacks.

Password Validation

Password validation is important to ensure your users choose passwords that offer an adequate level of security to prevent their accounts from being compromised.

2. Ajax and JavaScript

Ajax is a web methodology that uses JavaScript to make HTTP connections to retrieve and process data for the purpose of dynamically updating the content of a static web page. Ajax enables you to update content within a web page without reloading the entire page, thus reducing load times and server loads, making your web pages more interactive and intuitive. A great resource for Ajax tools is MiniAjax.

Auto Suggest

Auto suggest or autocomplete tools are usually applied to text inputs like search fields. When a user begins their input, the input field shows a list of options that match what they have entered so far. This enables users to enter their input more quickly, and can also help them enter terms that match search data that are more likely to return relevant results.

Calendars

Ajax calendars are extremely useful when you need your users to enter a date. They reduce confusion over date formats, and enable users to easily find the date they are looking for rather than typing a date format string.

Sliders

Ajax sliders enable users to use an interactive draggable element to select values. These are very useful for features like colour pickers as they enable users to ‘slide’ through a range of colours to select the one they want.

Data Grids

Ajax data grids enable you to display data in a table, but with the benefit of features like column sorting and pages without the need to reload the entire page.
  • Grid3
    A useful data grid tool which is part of the Ext JS library.
  • dhtmlxGrid
    A powerful data grid tool that includes column sorting and search functionality.
  • Unobtrusive Table Sort Script
    A data grid tool that includes multiple column sorting.
  • AJAX Data Listings Engine
    A powerful open source PHP data grid tool for use with mySQL.
  • TableKit
    A data grid tool based on the Prototype JavaScript framework that features field editing.

Draggable Content

Ajax-based draggable content features can be very useful when used appropriately. Such tools enable users to reorganize a page to suit their needs, and can also serve as a basis for an interactive feature like a shopping basket.

Image Enlarging

Image enlarging scripts, similar to JavaScript light boxes, enable the user to enlarge or zoom in on an image chosen from a set of thumbnail images.

Galleries and Slideshows

Image galleries are very useful when you have a collection of images to show, they allow users to easily browse your images, and features like slideshows allow users to sit back and enjoy watching your images.

Star Ratings

Star rating scripts allow users to rate items through an intuitive and attractive interface, which is an improvement over typical drop-down menus or radio buttons.

Colour Pickers

If you want to let users choose colours in your application, it’s better to present them with an interface rather than asking them to enter a HEX code. Colour pickers allow users to choose colours from a colour palette which then generates a HEX code for use in your HTML.

Progress Bars

Progress bars are very useful when handling user uploads or pages which can be slow to load; they keep the user informed that progress is being made and that the page is loading.

3. APIs

An API (Application Programming Interface) is a set of program functions which can be accessed by another application. One example is a currency conversion API that retrieves currency conversion data by allowing the user to enter a base currency, an amount, and the desired result currency, which returns a result via the API.
  • Alexa Top Sites
    This API provides access to lists of web sites ordered by Alexa Traffic Rank.
  • bit.ly API
    A useful API for the bit.ly URL shortening service.
  • Blinksale API
    Enables you to access Blinksale data such as invoices and customer data.
  • FoXRate
    A basic currency conversion API.
  • eBay API
    eBay’s API which allows you to submit items to be listed and obtain listing data.
  • Twitter API
    The Twitter API allows you to have access to Twitter data, including user and status information.

4. IP Locations

Finding out where your visitors are located can be valuable from a development standpoint. It can help you understand your visitors so you can design your site to better suit their needs. IP location information can help you determine where a user is located, enabling you to display content in the their language. You can also optionally customize other information such as currencies and shipping costs.
  • OpenCrypt IP Location API
    A hosted API service for determining user location by country.
  • IP Details
    A PHP class for determining geographical locations based on IP address.
  • GEO-IP
    A free IP to country database.

5. Charts and Graphs

Charts and graphs enable you to display complex data visually. This is useful for example when trying to determine information like daily pageview counts from detailed statistical logs, enabling the user to immediately see how the data varies over a period of time.
  • amCharts
    A powerful Flash charts tool which supports 3D charts and the ability to combine different graphs.
  • FusionCharts
    A well designed and stylish 3D charts tool.
  • XML/SWF Charts
    A highly customizable Flash charts tool.
  • JFreeChart
    A free Java-based charting tool.
  • pChart
    A powerful PHP class for building attractive charts.

6. Maps

Once you are using IP location tools like those listed above, you will have a collection of user location data. What better way to display it than with an interactive map. Interactive maps are also useful for understanding user location data such as sales information, for example, when you receive delivery and billing address info from a user.
  • amMap
    An interactive mapping tool which includes drill-down functionality.
  • Google Charts API
    A great mapping tool, though limited to a small map size.
  • Flashmaps
    A great collection of different Flash mapping tools.

7. Audio Players

When used well, playing audio on your web site can be a great way of setting a mood or getting a message across.

8. Video Players

Video content is now becoming a standard, but getting the right video player is very important. Video content is the ideal, and often expected tool for promotion, so getting a player which suits your site and needs is now a critical design and development choice.
  • OS FLV
    An open source and well featured Flash video player.
  • Flowplayer
    A full-featured and highly customizable Flash video player.
  • JW FLV Media Player
    A very powerful and flexible Flash video player.
  • FLV Player
    A stylish and customizable Flash video player.

9. Video Conversion

Video conversion/encoding can be a tricky business. Videos can be in a wide range of formats but most players only support a handful of those. If you don’t have a server which supports ffmpeg, converting videos to a format suitable for your player is usually an offline and manual task.

10. WYSIWYG Editors

WYSIWYG (What You See Is What You Get) editors enable you to offer an HTML editor when users enter information, for example, in content management systems, or for entering comments or reviews. These editors enable users to style and format data without the need to understand HTML.
  • TinyMCE
    A lightweight yet powerful JavaScript WYSIWYG editor.
  • XINHA
    A fully featured and open source WYSIWYG editor.
  • NicEdit
    A simple and lightweight WYSIWYG editor.
  • openWYSIWYG
    An open source, cross-browser WYSIWYG editor.
  • CKEditor
    A well designed and feature-rich WYSIWYG editor.

Thursday 2 August 2012

Curl function using to display another url page

php curl function to display another url page


<?php
/* gets the data from a URL */
function get_data($url)
{
  $ch = curl_init();
  $timeout = 5;
  curl_setopt($ch,CURLOPT_URL,$url);
  curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
  $data = curl_exec($ch);
  curl_close($ch);
  echo $data;
}

$returned_content = get_data('http://205.169.85.151/myCalendar.aspx?PID=267101&amp;PartyType=ABC&amp;');

?>