vikas
Vikas Pandey@vikas

I am the best

  • 5 years-11 months

    How to Manipulating or Modify the Browser History in Complex HTML5 and JavaScript Applications

    • Category : java
    • Location : Chandigarh, India
    • Posted On : Jul 08, 2016
    • Posted by : Vikas

    URL — The new history entry's URL is given by this parameter. Note that the browser won't attempt to load this URL after a call to pushState(), but it might attempt to load the URL later, for instance after the user restarts the browser. The new URL does not need to be absolute; if it's relative, it's resolved relative to the current URL. The new URL must be of the same origin as the current URL; otherwise, pushState() will throw an exception. This parameter is optional; if it isn't specified, it's set to the document's current URL.

    // modify history
    window.history.pushState(obj, title, url);
    window.history.pushState("", "", 'www.dorcode.com');  
  • 5 years-11 months

    How to add Magento Canonical Meta Tag

    • Category : magento
    • Location : Chandigarh, India
    • Posted On : Jul 06, 2016
    • Posted by : Vikas

    Magento SEO - How to add Magento Canonical Meta Tag

    Step 1: Login your Magento Admin Panel

    Step 2: Go to  System > Configuration

    Step 3: In the left menu, choose Catalog >> Search Engine Optimizations
    • In the "Use Canonical Link Meta Tag for Categories" choose "Yes"
    • In the "Use Canonical Link Meta Tag for Products" choose "No"

    Step 4:  Save the changes
     
  • 5 years-11 months

    Magento. Adding page links to the navigation bar

    • Category : magento
    • Location : Chandigarh, India
    • Posted On : Jul 06, 2016
    • Posted by : Vikas

    This tutorial shows how to add page links to Magento navigation bar. In order to add the page links to the navigation bar, you should perform the following steps:

    Step 1: Adding the Subcategory
     
    1. Go to Catalog -> Manage Categories in your Magento Admin.

    2. Select ‘Default Category’ on the left, then click the ‘Add Subcategory’ button:
    3. Fill in the fields:
    4. – Specify your link Name.
    5. – Set ‘Is Active’ to Yes.
    6. – In the URL Key field type the name of your page link in lowercase letters with hyphens instead of spaces (f.e.’About Us’ becomes about-us):
    7. – Scroll down to the bottom of the form and set Include to Navigation Menu to ‘yes’.
    8. – Click ‘Save Category’ button:
     

    Step 2: Creating a Redirect
     

    1. Navigate to Catalog -> URL Rewrite Management.
    2. In the search box of the Request Path column, type in the URL key for the subcategory, and click Search.
    3. When the subcategory is located, click ‘Edit’ to open the record:
    4. NOTE: you will have records for each installed language. You can open the record for each language in the new browser tab.
    5. Open the notepad on your PC and save the following info: the ID path of your URL Rewrite and the Request path:
    6. Now we should delete the URL Rewrite for each language – click the Delete button at the top right.

    Step 3: Adding a new URL rewrite
     
    1. In Catalog -> URL Rewrite Management click Add URL Rewrite button at the top right.

    2. In the Create URL Rewrite field select ‘Custom’.

    3. Fill in the URL Rewrite Information form:

      – Add the ID path for the item which you have noted and saved in the notepad on step 2.2.

      – Add the Request Path for the item which you have noted and saved in the notepad on step 2.2.

      – To fill in the Target Path field, open any navigation menu on your site and copy-paste its url into the field, f.e: http://yourdomain.com/index.php/contacts/ (where ‘contacts’ is the Request Path for the Contact Us navigation page). Replace the Request Path with the new item Request Path which you have noted and saved in the notepad on step 2.2 of this tutorial.

    4. Set Redirect to ‘Permanent 301′.

    5. Click ‘save’ button at the top right:
       

    Step 4: Creating a page
     
    1. Go to CMS -> Pages.

    2. Click ‘Add New Page’.

    3. Specify the page title, the URL key for the page, select All Store Views:

    4. Switch to the Content Tab on the left. Put the html for your page content here.

    5. Switch to the Design Tab on the left. In the layout field choose the desired Page Layout:

    6. Click ‘Save Page’

    Step 5: Clearing your Magento Cache

    This is the end of the tutorial. You’ve learned how to add page links to Magento navigation bar
  • 5 years-11 months

    How to compress CSS files using PHP

    • Category : php
    • Location : Chandigarh, India
    • Posted On : Jul 01, 2016
    • Posted by : Vikas

    When you’re using a sophisticated design, CSS files can quickly become very long, and takes time to load. I have compiled interresting ways of compressing CSS files by using PHP.

    (1.)
    <link rel="stylesheet" type="text/css" media="screen" href="/style.css.php"/>
    Once you successfully rename your css files, edit it and add the following code at the beginning of the file:
    <?php if(extension_loaded('zlib')){ob_start('ob_gzhandler');} header("Content-type: text/css"); ?>
     

    2 Answers

    View More

    vikas image

    Name: vikas

    Experiance: 5 years-11 months

    answered
    Jul 01, 2016

    Then, add the next line to the very bottom and save the file.
    <?php if(extension_loaded('zlib')){ob_end_flush();}?>
     
  • 5 years-11 months

    UI Datepicker be made to disable Saturdays and Sundays with custom date

    • Category : jquery
    • Location : Chandigarh, India
    • Posted On : Jun 08, 2016
    • Posted by : Vikas

    I use a datepicker for choosing an appointment day.I want to exclude Saturdays and Sundays from the available choices. Can this be done? If so, how?

    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <input name="datenew" type="text" id="datepicker">
    <script>
    var unavailableDates = ["21-6-2016","22-6-2016","23-6-2016","24-6-2016"];
    function unavailable(date) {
      var day = date.getDay(), Sunday = 0, Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6;
        dmy = date.getDate()   "-"   (date.getMonth()   1)   "-"   date.getFullYear();
      var closedDays = [[Saturday],[Sunday]];
     for (var i = 0; i < closedDays.length; i  ) {
        if (day == closedDays[i][0]) {
          return [false];
       }
    
     }
        if (jQuery.inArray(dmy, unavailableDates) == -1) {
            return [true, ""];
        } else {
            return [false, "", "Unavailable"];
        }
    }
    jQuery(function() {
      jQuery( "#datepicker" ).datepicker({    
        changeMonth: true,
        changeYear: true,
       dateFormat: 'dd MM yy',   
        autoclose: true,
        minDate:  2,
        firstDay: 1,
        beforeShowDay: unavailable
      });
    
    });
    </script>
  • 5 years-11 months

    woocommerce cart not working for without login

    • Category : wordpress
    • Location : Chandigarh, India
    • Posted On : May 26, 2016
    • Posted by : Vikas

    I am fairly new to woocommerce and although the other day the add to cart and cart page was displaying fine. I am now finding that going to my cart page brings up a blank page.

    add this code in function.php
    add_filter('woocommerce_add_to_cart', 'custome_add_to_cart');
    function custome_add_to_cart() {
        global $woocommerce;
     $woocommerce->session->set_customer_session_cookie(true);
    }
     
  • 5 years-11 months

    how bootstrap modal rotate and show

    • Category : css
    • Location : Chandigarh, India
    • Posted On : May 09, 2016
    • Posted by : Vikas

    this css class add your bootstrap modal then see the magic

    rotate {
        transform:rotate(180deg);
        transition:all 0.5s;
    }
    .rotate.in {
        transform:rotate(1800deg);
        transition:all 1.5s;
    }
  • 5 years-11 months

    PHP mysql search multiple tables using a keyword

    • Category : php
    • Location : Chandigarh, India
    • Posted On : May 05, 2016
    • Posted by : Vikas

    I have two tables in my database which are: user and event for PHP mysql search multiple tables using a keyword

    create table : event like
    CREATE TABLE IF NOT EXISTS `event` (
      `id` int(32) unsigned NOT NULL AUTO_INCREMENT,
      `email` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
      `event_name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    then create table : user like
    CREATE TABLE IF NOT EXISTS `user` (
      `id` int(32) unsigned NOT NULL AUTO_INCREMENT,
      `email` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
      `name` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    mysql query
    $query = "(SELECT name,email,'new_name' as type FROM user WHERE name LIKE '%te%') UNION (SELECT event_name,email,'new_event_name' as type FROM event WHERE event_name LIKE '%te%')";
    mysql_query($query);
    output
    name     email                 type
    denis terzo   abcd@gmail.it       new_name
    Andrea    abcddd.abcddd@gmail.com   new_name
    test    abcddd.vvvv@gmail.com     new_event_name
    test    abcddd.vvvv@gmail.com     new_event_name
    ram     abcddd.vvvv@gmail.com     new_name
     
  • 5 years-11 months

    woo-commerce cart item session start and destroy after 30 Min.

    • Category : wordpress
    • Location : Chandigarh, India
    • Posted On : Apr 28, 2016
    • Posted by : Vikas

    woo-commerce cart item session start and destroy after 30 Min

    <?php
    
    global $woocommerce;
    if (!isset($_SESSION['EXPIRES']) || $_SESSION['EXPIRES'] < time()) {
     $woocommerce->cart->empty_cart(); 
    } else {
      $_SESSION['EXPIRES'] = time() 1800;
    }
    
  • 5 years-11 months

    Return all dates or time between two dates in an array

    • Category : php
    • Location : Chandigarh, India
    • Posted On : Apr 20, 2016
    • Posted by : Vikas

    Return all dates or time between two dates in an array

    print_r(createDateTimeRangeArray('2007-01-15 11:15:00', '2007-01-20 18:15:00','  1 day','d/m/Y h:i:s A'));
    
    
    function createDateTimeRangeArray($start,$end,$step = '  30 minutes',$output_format = 'H:i') {
      $range = array();
     if (is_string($start) === true) $start = strtotime($start);
     if (is_string($end) === true ) $end = strtotime($end);
      if ($start > $end) return createDateTimeRangeArray($end, $start);
      do {
        //$range[] = date('Y-m-d', $start);
       $range[] = date($output_format, $start);
        $start = strtotime($step, $start);
      }
     while($start < $end);
      return $range;
    }