Magento Themes and Magento Extensions

Magento: Easily and Quickly Delete All Products

Share
Posted on May 30th, 2011 | Posted by admin

If you have ever tried to delete a large amount of products out of  Magento, you’ll realize that it takes forever, and in many cases, you have to do it in small quantities at a time otherwise it will freeze up. I needed to delete all the products out today but found that I could only delete about 30 at a time. This just wasn’t going to work since there are about 2500 products in the DB. I found something out today by accident that turned out to be extremely helpful.

Due to the nature of the InnoDB mysql engine that Magento uses, and the way they setup their foreign keys, all it takes is one simple mysql command, and mysql will automatically clear out all of the product data from all of the different tables it uses. On top of that, it resets the auto-increment values back to 1 so that you can start off with entity_id 1 again.

I haven’t given it extensive testing, but I checked every table that I knew that stored product information and they were all clear. So, if you need to clear out all your products, open up mysql and just enter this one line in:

TRUNCATE TABLE `catalog_product_entity`;

For more information on how it works, you can visit the Truncate Syntax page on the Mysql website.

Magento: No Tax for Wholesale Customers

Share
Posted on May 30th, 2011 | Posted by admin

We ran into the need today to not charge tax for wholesale customers. The good news is that no code modifications are needed to accomplish this. All the functionality is already built right into Magento. Here’s a step-by-step process on how to charge no tax for wholesale customers only:

  1. Go to Sales->Tax->Customer Tax Classes. Add a new class, and call it something like “Wholesale – No Tax” and save it.
  2. Go to Sales->Tax->Manage Tax Zones & Rates. Add a new tax rate, call it “Wholesale”, select your country, select “*” for state and zip, and give it a rate of 0. Save the new tax rate.
  3. Go to Customers->Customer Groups. Click on the Wholesale group. In the “Tax Class” drop down, select your new “Wholesale” tax class, and save it.

Now – any customers that you assign to the Wholesale customer group will no longer be charged any tax. Having walked through these steps, you can see how much flexibility Magento offers you.

Adding Magento products to Google Base

Share
Posted on May 27th, 2011 | Posted by admin
Adding Magento products to Google Base

Magento made adding products to Google Base (Google Product Search) a pretty simple process that can be done using Magento’s admin interface. This guide will tell you how to do it and how to fix known issues.

First of all, I wanna show you this really nice screencast I found on Vimeo that guides you through the process of adding your Magento products to Google Base, however you will probably have some issues after you follow the screencast since it doesn’t really tell you everything there is to know.

Creating cron script in Magento

Share
Posted on May 27th, 2011 | Posted by admin

Creating Magento cron script is very simple thing. First of all we have to create the module, (I hope that you know how to create magento module) and add in config.xml file next code:

1
2
3
4
5
6
7
8
<crontab>
<jobs>
<inchoo_birthday_send>
<schedule><cron_expr>0 1 * * *</cron_expr></schedule>
<run><model>birthday/observer::sendBirthayEmail</model></run>
</inchoo_birthday_send>
</jobs>
</crontab>

Next step, we have to create model file observer.php (in folder model) with method sendBirthayEmail

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Inchoo_Birthday_Model_Observer
{
public function sendBirthayEmail()
{
//this collection get all users which have birthday on today
$customer = Mage::getModel("customer/customer")->getCollection();
$customer->addFieldToFilter('dob', array('like' => '%'.date("m").'-'.date("d").' 00:00:00'));
$customer->addNameToSelect();
$items = $customer->getItems();
foreach($items as $item)
{
// send email or do something
}
return $this;
}
}

This cron will be executed every day at 01:00 AM. The important thing: You have to set cron execution on the server (www.yourstore.com/cron.php), without it will not work.

A new WordPress Members Plugin blows away its predecessors

Share
Posted on May 27th, 2011 | Posted by admin

The Members plug-in by Justin Tadlock is a very young plug-in (0.1) and is compatible with WordPress 2.8. This new Membership Plug-in adds a series of components that you can activate based on your needs. The Members plugin is meant to be a complete user, role, and content management plugin for WordPress. Its purpose is to give you fine-grained control over who has access to what. Right now, it’s in the early stages of development.

I’ll be testing it on a new personal project here. The basic modules are WordPress Roles Manager (Edit Roles and New Roles) that allow to create and assign WordPress capabilities to existing Roles and to create new Roles.

The Content Permissions module adds a meta box for the post/page editor that allows you to grant permissions for who can read the content based on the the user’s capabilities or role.

The Shortcodes modules rovides a set of shortcodes that may be used to restrict or provide access to certain areas of your site from within the post editor (or other areas where shortcodes are allowed).

Two more modules compelte the plug-in arsenal: Template Tags adds new functions for use within your WordPress theme for various things and Private Blog will create a blog that can only be accessed by users that are logged in (redirects them to the login page).

At a glance, the plug-in is very well documented so be sure to check /wp-content/plugins/members/readme.html after you install the plug-in (the documentation is not easily accessible from the plug-in’s website).

The plug-in was released on September 17, 2009 and the great news is it’s open source: it’s not a commercial product like most of its competitors… Check it out on Justin Tadlock website.

Page 4 of 39« First...«23456»102030...Last »