Pages

Tuesday, April 2, 2013

Magento-Home Page-Language drop down not showing up

Checklist:

1. To show a language bar in the header of your website you should have multiple stores(or store views).

If I peek into languages.phtml we get the following code

"getStores())>1): ?>"

which clearly states that the number of stores should be greater than 1

2. Make sure in case you are using 2 websites the "Main Website" default one and the other one(your's) then your's should be default one.

3. Make sure System>>Configuration>>General>>Locale is set to local languages for your respective store views.

4. Make sure language files are installed perfectly and correctly.If not download them from

http://www.magentocommerce.com/translations

and added them in accordance to the folder sequence as in zip file

5. Make sure it is called correctly in page.xml in respective block

6. Flush your cache's

7. Reindex Data

Saturday, March 30, 2013

Recover Lost WAMP Databases

Sometimes we are messed up tinkering with WAMP vanilla package.And all we end up is fatal errors that either restrict us to use PHP MyAdmin or let us forget the fact of importance of an Database Backup.

We take the backup of WWW/our Important Projects but are hopeless when we find no database for the same.

Here is a way to resolve the problem.First and Important step Backup of whatever you are left with

If you have the the following folder intact with you

"D:\wamp\bin\mysql\mysql5.5.24\data".(You may find a change in version of your Mysql Folder.)

You can bring back the Data out from ashes.

This folder remains even if you uninstall wamp.Its ur Mysql Data Dump.Unless and untill you have tempered with this area you can get your databases back.

Now That's the ingredients we need

1. The folder in bold above
2. A Wamp setup(we will be going for a fresh installation)

 If you have them in hand let's startoff with recovery process then

1. Rename this folder to something other than "wamp".Let's say "wamp_bak"
2. Reinstall wamp to your favorite location.
3. Under your wamp installation you will find a file with path and name as follows

"D:\wamp\bin\mysql\mysql5.5.24\my.ini"

You may see only "my" as file name in case your extension types are hidden.Again your mysql version may differ.

Open this file in your favorite text editor.I prefer using "notepad","notepad++" in order to preserve their encodings.

Search for a line like as follows

"datadir=d:/wamp/bin/mysql/mysql5.5.24/data"

It was 39th line I am using notepad++. 

copy this line and place a hash before the same.

"#datadir=d:/wamp/bin/mysql/mysql5.5.24/data"

We have commented this line here....

paste the uncommented  exactly same line just below this commented line.

"datadir=d:/wamp/bin/mysql/mysql5.5.24/data"

We will be playing with Path's now

In windows explorer navigate to your old wamp backup till the data folder and copy its path. Considering you are following the same directory and naming conventions as me you would get a path like this one

"D:\wamp_bak\bin\mysql\mysql5.5.24\data"

(I suppose you have copied it from window's explorer's address bar like any smart freak does )


paste the path in my.ini and replace it with the path in our copied uncommented text.We will get sth like this


"#datadir=d:/wamp/bin/mysql/mysql5.5.24/data" (commented line)
"datadir=D:\wamp_bak\bin\mysql\mysql5.5.24\data" (uncommented line)

In the uncommented line change the copied path as follows

"d:/wamp_bak/bin/mysql/mysql5.5.24/data"

Restart Wamp if you get a green signal everything went well if not check path again.

Open phpmyadmin in browser

http://localhost/phpmyadmin

You will find a list of databases from your previous installations.

Next Step: Exporting Databases

Select Export

Under "Export Method" select "Custom"

Select All Databases Except/Excluding

1. mysql
2. performace_schema
3. information_schema
4. test

Scroll Down Select Go soon you will be told to save an sql file containg sql dump of all your previous databases.

Save it....That's your Magic Wand in Hand to bring up Databases from Ashes.

Change the Path in "my.ini" back to

"datadir=d:/wamp/bin/mysql/mysql5.5.24/data"

(remove the copied line and uncomment the orignal one to get a line sth as above)

Restart Wamp and open 

http://localhost/phpmyadmin in browser 

You should be back with your original setup by now

Now all you need to do is Import SQL File

You may need to modify the sql file again open the same in your favorite editor

remove following lines from top

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
 


remove following lines from bottom

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Also you might need to modify some Referential Integrity Constraints if you are facing importing error's.

If it imports successfully you are back with original databases.If not let me know the error's.I would with glad to assist you in recovery.

PS:In case you fail even after this do follow our important comments too

Wednesday, January 23, 2013

Shine.com Hack(select all jobs at once)

Paste the following code in firebug(mozilla firefox) or run via js debugger in any browser and apply to all your selected jobs at once at shine.com

jQuery(".cls_chk_apply_cnd_job").each(function(){$(this).attr("checked","checked");});

Saturday, December 22, 2012

Getting Tags,Categories by Post Type Wordpress/get_terms shows empty array

Recently I faced an Issue of getting tags of a Custom Postype created by Me and I solved it as follows
I registered a taxonomy for the same as follows

For Tags
register_taxonomy(ad_tag,
            array('my_cust_posttype'),
            array('hierarchical' => false,
                  'labels' => array(
                        'name' => __( 'Ad Tags', 'appthemes'),
                        'singular_name' => __( 'Ad Tag', 'appthemes'),
                        'search_items' =>  __( 'Search Ad Tags', 'appthemes'),
                        'all_items' => __( 'All Ad Tags', 'appthemes'),
                        'parent_item' => __( 'Parent Ad Tag', 'appthemes'),
                        'parent_item_colon' => __( 'Parent Ad Tag:', 'appthemes'),
                        'edit_item' => __( 'Edit Ad Tag', 'appthemes'),
                        'update_item' => __( 'Update Ad Tag', 'appthemes'),
                        'add_new_item' => __( 'Add New Ad Tag', 'appthemes'),
                        'new_item_name' => __( 'New Ad Tag Name', 'appthemes')
                    ),
                    'show_ui' => true,
                    'query_var' => true,
                    'update_count_callback' => '_update_post_term_count',
                    'rewrite' => array( 'slug' => $tag_tax_base_url, 'with_front' => false ),
            )
    );

For Categories
    register_taxonomy( APP_TAX_CAT,
            array(APP_POST_TYPE),
            array('hierarchical' => true,
                  'labels' => array(
                        'name' => __( 'Ad Categories', 'appthemes'),
                        'singular_name' => __( 'Ad Category', 'appthemes'),
                        'search_items' =>  __( 'Search Ad Categories', 'appthemes'),
                        'all_items' => __( 'All Ad Categories', 'appthemes'),
                        'parent_item' => __( 'Parent Ad Category', 'appthemes'),
                        'parent_item_colon' => __( 'Parent Ad Category:', 'appthemes'),
                        'edit_item' => __( 'Edit Ad Category', 'appthemes'),
                        'update_item' => __( 'Update Ad Category', 'appthemes'),
                        'add_new_item' => __( 'Add New Ad Category', 'appthemes'),
                        'new_item_name' => __( 'New Ad Category Name', 'appthemes')
                    ),
                    'show_ui' => true,
                    'query_var' => true,
                    'update_count_callback' => '_update_post_term_count',
                    'rewrite' => array( 'slug' => $cat_tax_base_url, 'with_front' => false, 'hierarchical' => true ),
            )
    );

And Then I retrieved Tags for my custom post type as
$mylinks_tags = get_terms('ad_tag','orderby=name&hide_empty=0');

remember the parameter hide_empty if you are starting afresh you will get an empty array if this is not set to 0 by default this is 1 which means all empty terms will be hidden.Scratched my head for a couple of hours to figure this out

Saturday, December 15, 2012

Wordpress Theme Not Updating Or Cache Issue

Wordpress Theme Not Updating Or Cache Issue:

Sometimes we get a wordpress installation and have to work on the same.I recently faced this theme not updating issue when I had to customize the functionality of a Preinstalled theme by creating a child theme from the same.


If you installed WordPress yourself and you did not install a cache plugin then WordPress itself is not caching. If you are you using a preinstall then check the plugins to look for anything that could resemble a caching plugin. One of the better known one's is WP Super Cache for example.


Firefox Caching: Get latest page every time

Firefox Caching
Get latest page every time


Internet Explorer has a fantastic Web Cache option in Tools > Internet Options > Browsing History > Settings > called “Check for newer versions of Stored Pages:’. This option lets you override Internet Explorers smart caching option.
This is useful when you’re visiting websites that frequently have changing, dynamic data, but their meta tags or HTTP Content headers don’t tell your browser to get a new copy of the page every time. All you have to do is switch the setting to “Every time I visit the webpage“.
To access it in Firefox, simply enter this into your URL location box:
about:config
Then find the browser.cache.check_doc_frequency and change it to 1. This will force Firefox to check for a newer version of the page you’re viewing, regardless of the servers instructions, or Firefox’s default settings.
This is useful because by default Firefox is set at 3 which means that it will always used an old, cached version of the web page, unless the server specifically indicates a newer one is available. You never know if you’re getting the right stuff.
For reference, valid values for browser.cache.check_doc_frequency are:
0 – Check for a new version of a page once per session (a session starts when the first application window opens and ends when the last application window closes).
1 - Check for a new version every time a page is loaded.
2 – Never check for a new version – always load the page from cache.
3- Check for a new version when the page is out of date. (Default)




Friday, December 14, 2012

Remove Wordpress Toolbar/Panel from top

To remove wordpress toolbar/panel from top use the following code in functions.php of your template

add_filter( 'show_admin_bar', '__return_false' );
To remove the faint line, go into white.css, find the block:


#header {
 background-color:transparent;
 background-image:none;
 border-bottom:1px solid #E5E5E5;
}
and remove the line border-bottom:1px solid #E5E5E5;

Thursday, December 13, 2012

Buddypress-User registration is currently not allowed

Buddypress Error:

Buddypress Error:User Registration is currently not allowed on registration page is simple caused because Membership for anyone is disabled in wordpress.

To resolve this issue simple do 1 thing

In admin panel go to

Settings->General

and in front of Membership section check mark "Anyone can register Check box"

Tuesday, December 11, 2012

Oscommerce Add products to cart manually

In order to add products manually by Id or customize cart manually in OSCommerce

we need to first include the following file

require("includes/application_top.php")

What  this does is automatically includes the following class

require(DIR_WS_CLASSES . 'shopping_cart.php');(line 126)

and instantiates an object of class

if (!tep_session_is_registered('cart') || !is_object($cart)) {
    tep_session_register('cart');
    $cart = new shoppingCart; 
} 
or you can yourself include these files and create an object
But for any action in oscommerce I prefer to include application_top.php
If you are building up a new cart add
$cart->reset();
This will reset your cart which is only required if you are planning to add a new cart in my case I was sending all Items from another website to my oscommerce website so I decided to reset cart first

Now let us suppose we have item information in an array $items

foreach($items as $item)
{
       $attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';
       $cart->add_cart($item['id'],$item['quant'],$attributes);
      //In case cart is not empty and you want to add quantity to an item
      $cart->add_cart(
$item['id'], $cart->get_quantity('$item['id']')+1);
}

Then add the following lines
//Cleans any product with quantity zero
$cart->cleanup();
//Calculates the weight and total cost in all finalizes your cart
$cart->calculate();

That's All

Associate a file extension with a language in notepad++

Select Settings and then Style Configurator and you will get a window as follows


 Add a file type as shown above for example I have added ctp User extension to link cakephp ctp extension as a php file