Working SQL

  • How to create and use a robots.txt file

    Web site owners use the /robots.txt file to give instructions about their site to web robots; this is called The Robots Exclusion Protocol

    Below are instructions for creating and using a robots.txt file for your website, so that search engines index the content management of your website

    robots.txt is a structured text file, when the spider (bot, crawler) of the SE (search engines) to the site to collect data on the robots.txt file would be to see the instructions in this file.

    robots.txt can assign each of the different types of bot SE can vary in each area of the website or the website or not?

    Some of the SE bots: Googlebot (Google), Googlebot-Image (Google), Yandex (Russian SE)​​, Bingbot (Bing) / Yahoo Slurp (Yahoo) ...

    The common syntax of a robots.txt file

    User-agent: objects bot is accepted

    Disallow / Allow: URL you want to block / allow

    *: Represents all

    For example: User-agent: * (That means accepting all types of bots.)

    Lock the entire site

    Disallow: /

    Block 1 folder and everything in it

    Disallow: /wp-admin/

     

    Block 1 Page

    Disallow: /private_file.html

     

    Removing pictures from Google Images 1

    User-agent: Googlebot-Image

    Disallow: /images/sexy.jpg

     

    Put all the pictures from Google Images:

    User-agent: Googlebot-Image

    Disallow: /

     

    Block any image file, for example gif

    User-agent: Googlebot

    Disallow: /*.gif$

     

    Things to avoid in the robots.txt file

    - Distinguish case sensitive.

    - No written opinion, the lack of spaces.

    - Do not insert any character other than the command syntax.

    - Each statement should be written on one line.

    How to create a robots.txt file and location

    - Use notepad or any other program that created the file, then rename the file robots.txt.

    - Put in the root directory of the website.

  • Magento: How to update custom attributes product values by script

    This should give you an idea for how to run a script to perform a mass update on your products.

    /*
     * Script to update custom attributes product values
     */
     
    $_productCollection=Mage::getModel('catalog/product')
                        ->getCollection()
                        ->addAttributeToSelect('*');
    $storeId=0;
     
    foreach($_productCollection as $_product)  {
        $product = Mage::getModel('catalog/product')->load($_product->getId());   
        $data=array(
                    'custom_attribute_1' = 'VALUE_OF_ATTRIBUTE1',
                    'custom_attribute_2 '= 'VALUE_OF_ATTRIBUTE2',); 
        Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->getId()), $data, $storeId); 
    }
  • Import database using command line (on Windows)

    1. Open command line windows (C:\windows\system\cmd.exe)

    2. type: mysql -u [{username}] -p [{password}]
    Ex: mysql -u [root] -p []

    3. type: cd {my_sql_path}\bin
    Ex:
    cd C:\xampp\mysql\bin

    4. type: use {database name}
    Ex:
    use demo_db

    5. type: \. {sql_file_path}
    Ex: \. C:\demo.sql

3 Item(s)

per page
My Cart
loading