0

Migrating Magento to another server

Migrating the Magento platform to another server is relatively a simple task. I have detailed the steps below:

  1. From the admin, go to Configuration -> Web -> and change the (Unsecure and Secure) fields to {{base_url}}.
  2. From the admin, go to System -> Tools -> Backups and click on the backup button. This will create a backup of your database.
  3. Make a copy your Magento root.
  4. Move all data over to the new server.
  5. Restore the database on the new host.
  6. If you have a different username, password or database name. You’ll need to update that as well. You can find the file in (’magento_root/app/etc/local.xml’) and make the required changes.
  7. Navigate to your Magento root, and delete all of the files and folders in, (i.e. /var/www/magento/var) except for the .htaccess file.

Hope this helps someone :)



Bookmark and Share

0

PHP - getting a list of currently loaded classes

In some cases you may need to investigate which classes are loaded in the current scope. You can do it pretty fine with the get_declared_classes() function. This function will return an array of currently available classes.

<?php
    include_once("class.myClass.php");
    print_r(get_declared_classes());
?>


Bookmark and Share

01

Add Magento search plugin to Firefox Search bar

magentoI’ve been working with Magento for some time now. I found myself searching for help countless times on the Magento website. I thought it would be useful to have a search feature built right into Firefox’s list of search engines to search the Magento site. So went through Mozilla’s Developer Center and found instructions on the Open Search Syntax. So here you go, you can download it here. Hope you find it helpful!

I also have one for PHP which comes in handy as well. If your interested, you can grab it here.



Bookmark and Share

02

Javascript - Passing Multiple Parameters through setTimeout

One of the problems that I’ve faced with Javascript is passing multiple parameters through the setTimeout function. I found this little snippet on the internet a few months ago and would like to share it with you. I don’t know who the original author is so I could not give him/her proper credit. Thanks!

var _st = window.setTimeout;

window.setTimeout = function(fRef, mDelay) { 
	if(typeof fRef == "function") {  
		var argu = Array.prototype.slice.call(arguments,2); 
		var f = (function(){ fRef.apply(null, argu); }); 
		return _st(f, mDelay); 
	} 
	return _st(fRef,mDelay);
}

Define your function to call with setTimeout:

function alertMe(message, name) {
    alert(message + name);
}

Now, just call the function.

var message = 'Hello, ';
var name = 'Richard';
setTimeout(alertMe, 2000, message, name);

Hope this helps someone! :)



Bookmark and Share

01

How to define your own JavaScript class

There are several ways to define a class in Javascript. I will be listing my favorite method below (JSON Method). It’s important to note that there are no real classes in JavaScript. Everything is considered an object. So below is our class definition:

<script type="text/javascript">
var Person = {
    age: "25",
    sex: "Male",
    location: "New York",
    getASL: function () {
        return 'Age: ' + this.age + ', Sex: ' + this.sex + ', Location: ' + this.location;
    }
};
</script>

So you can start using the class like this:

<script type="text/javascript">
Person.age = "29";
alert(Person.getASL());
</script>


Bookmark and Share

01

Magento Beginner’s Guide - A great book for any Magento Store Owner

magento-beginners-guideRecently I obtained a copy of Magento Beginner’s Guide by William Rice from Packt Publishing. This book is great, I would recommend it to any new or existing Magento store owner. It servers as an excellent reference guide for experienced users and a great beginners guide for new store owners.

Magento is the world’s most evolved e-commerce solution and runs on the Apache/MySQL/PHP platform. From one installation, users can control multiple storefronts, all sharing customer and product information. Magento’s templates and themes enable users to customize the look and feel of their store, even optimizing it for mobile phones. Extensions enable them to connect Magento to a large number of payment gateways and shipping services.

Who this book is written for:
This book is for anyone who wants to create an online store using Magento. If you are a non-technical person and are discouraged by the complexity of this powerful e-commerce application, this book is ideal for you.

What you will learn from this book:

  • Install and configure Magento and add products to your online catalog
  • Create categories and attributes to build your catalog of products
  • Enhance your products with descriptions, images, and inventory information
  • Create product categories to help your customers navigate your online store
  • Automatically apply sales tax rules to different shipping addresses and different types of products
  • Present and sell products in groups and sets
  • Display products related to the one that is being viewed by a customer
  • Offer your customer choices for a product’s size, color, or other attribute and give discounts based on quantities
  • Accept payments using Paypal, credit cards, and checks/money orders and offer a variety of shipping options
  • Create your own, customized shipping rates and connect to shippers such as UPS, FedEx, and USPS

Thanks to Jude at Packt Publishing for inviting me to write this review.

I also cannot underestimate these useful resources:



Bookmark and Share

01

.htaccess - Limit website access by IP

I’ve been asked many times how to limit website access by allowable IP’s. This is fairly simple to accomplish with .htaccess. Simply follow the steps below:

  1. Create a file and name it .htaccess. Paste the code into it. Replace 255.255.255.255 with you IP address. (If you don’t know it, you can get it here: WhatsMyIP)
  2. order deny,allow
    deny from all
    allow from 255.255.255.255 
    
  3. Once the file is created, put it in the root directory. That’s it!


Bookmark and Share

01

Google Wave - A New Communication Platform.

google_wave

Google Wave is a new model for communication and collaboration on the web, coming later this year. In Google Wave, users create and invite other people to “waves”. Everyone on a wave can use richly formatted text, photos, gadgets, and even feeds from other sources on the web. They can insert a reply or edit the wave directly. It’s concurrent rich-text editing, where you see what other users on the wave are typing in real-time. That means Google Wave is just as well suited for quick messages as for persistent content – it allows for both collaboration and communication. You can also use “playback” to rewind the wave to see how it evolved.



Bookmark and Share

01

Migrate Wordpress to a new Server or Directory

If you decide to change the URL or link location of your WordPress Blog due to a new domain or moving to a sub-directory, here are some simple steps that should be done to ensure proper migration without breaking links.

To update WordPress options with the new blog location, use the following SQL command:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.olddomain.com', 'http://www.newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.olddomain.com', 'http://www.newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.olddomain.com', 'http://www.newdomain.com');


Bookmark and Share

0

Magento - Show blocks that are not loaded in the current Object or Template

Customizing Magento could be difficult. Here is an easy way to display any block in any template file that cannot be loaded with $this->getChildHtml().

<?php echo $this->getLayout()->getBlock('top.search')->toHtml() ?>


Bookmark and Share

Random Posts Recent Comments Tag Cloud

  • Richard Says:

    Hey thanks Giyomu, I link back would be appreciated but not required. Enjoy!...

  • Giyomu Says:

    Hi ! I used your function for my website, it is very useful ! But, how I refer to you on my ackno...

  • King Says:

    Hi, I was looking this for quiet sometime. Thanks!...

  • Richard Says:

    Hello Chaz, You are correct in stating that it queries the whole database. If you wanted to limit s...

  • Richard Says:

    Hello Chaz, This works on the home/main page as well....

  • Richard Says:

    Hello Harald! Thank you for your comment. Sometimes it may be necessary to override native functions...

  • Daniel Messano Says:

    Thank you. Given enough time I could have come up with something like this, but i don't need to beca...

  • Mary Says:

    I like books from Packt publishing! They're any easy read!...

  • Fred Says:

    This is awesome!...

  • Fred Says:

    This is pretty nice!...