magento


Magento checkout/onepage/savemethod not found 404

When attempting to register an account today, I would be redirected back to the checkout cart page every time. The page was making an ajax request to checkout/onepage/savemethod and it would return a 404. This only occurred on our staging server and not locally, so I figured it must have been a configuration difference. Locally where it worked, checkout/onepage/savemethod correctly returned a blank page and not a 404. Long story short, the solution was to log into the admin and to go configuration->sales->checkout and enable “allow guest checkout” . A more elegant way of handling this would be good, like a user message on the frontend stating what the problem is instead of just returning a 404 and a redirect.


MWI Plugin relative path to Mage.php

The MWI plugin http://www.mwi-plugin.com/ is a great plugin to integrate Magento and WordPress. It allows you to pull in Magento blocks, CSS, JS and other Magento functionality into a wordpress blog. However, one thing that bothered me with this wordpress plugin was it required you to enter the full path to the Mage.php file, starting from the server root. This does not allow for seamless movement of the website’s database between environments.

The below solution will allow you to enter a full path on the server if you’d like, or a relative path from the wordpress root to the Mage.php file. Open up file wp-content/plugins/magento-wordpress-integration/mwi.php and within function mwi_admin_page() just below the $magepath declaration right around line 134, add four lines to check for a relative path as below.

// Mage Path
$magepath = self::getValue('magepath');

//check for relative path from blog root
if(file_exists(ABSPATH . $magepath)) {
	$magepath = ABSPATH . $magepath;
}
//check for relative path from blog root

// notification/error messages

Magento is difficult to modify and customize 47

Update:

This post is a number of years old and I’ve got the hang of Magneto these days. Yes, it has quite a learning curve and will take many hours weeks or months to become effective with Magento. Initially development will be slow while frustration and learning will be high :).

 

 

I’ve recently started a side project for a friend building an ecommerce solution that requires some customizations.  I’ve read about Magento and attended a presentation about it at ZendCon 2008 by a couple guys from Varien, the company that built Magento, and viewed a few of their sample sites.  Because I have years of experience with oscommerce ecommerce, I was eager to dive right in and customize one of these!  Unfortunately, it turns out Magento sucks to work on.  Yes, I said Magento sucks.

Features

Magento has nearly all the ecommerce features you could imagine.  It has pretty much everything that oscommerce ever had, even after installing a hundred community contributions. They support downloadable products, grouped products, different customer types (retail, wholesale) and pricing for each, and a variety of payment and shipping modules.  Magento has “current” features such as tagging and tag clouds and on the backend also has a caching mechanism to speed things up on the site.

Bugs

There are some bugs in Magento and this is expected with any software.  They’ve been releasing an updated version every 2-3 weeks.  I’m still waiting on the payment subscription feature and a bug fix that will allow me to assign downloadable products to a group product.

Interface

Looking over a Magento store from the front end and peering into the source code you’ll quickly notice it uses very few tables.  On a given page, there was one small table in one of the sidebar objects.  That’s it!  Very good for search engine optimization.

Admin

The admin took a little getting used to.  Especially the product configuration as it’s laid out a little differently than the oscommerce I’m used to.  The main problem with the admin is that it’s freak’in SLOW!!!!  The ajax page content thing is cool and all, but not when it takes a minute to refresh!  It’s ridiculous.  At one time I had four tabs open and three of them loading a page in the admin while I worked on another.  I’ve tried it in firefox and google chrome and after reading the forums, I’m not the only one with these troubles.

Modifying code

The code… well, sad to say, but the learning curve is extremely steep.  I’m not talking in hours or days… weeks is getting closer, and I’d feel comfortable with months if you’re putting in a few hours per week.  It would probably make things a hellava lot easier if you’re a Zend Framework master as Magento is built on top of the Zend Framework.  Look into the code and you’ll just dig into directories eight or ten levels deep.  Many of the directories contain sub directories with the same name, making things even more confusing.  Each sub directory may contain one to four files and each file has about 50 to 100 lines of code that seem to only call an object or set a variable.  Where is the meat and potatoes?  You know, the controller containing all the logic?  Oh, and the XML config files for every modules and chunk of code in the system are kinda cool, but I really don’t know how they work at this point.  Below is a screen shot from my Zend Studio looking at a project and a sample file.

untitled-12

Customizing

After looking at this code for an hour, I decided to try the old way of locating something in a file.  Yep, I went to the product detail page and copied the text “product description” that was printed on the page, then search the whole codebase for it.  Nothin.  Ok, it must be in the database somewhere, so check the database… damn… over 200 tables!  I tried this a few times and came up empty.

If you don’t have 100-200 hours to learn the Zend Framework and play around with Magento, then I’d say forget about making customizations to it.  Yeah, it’s open source, but not too many do it yourselfers (if any) are going to be able to modify and taylor this thing to their needs.  Sure, it’s an awesome piece of work, but take it as it is or find something else.

How they make their money

They build the most complicated open source package I have every seen… by far.  Sure, it’s open source and maybe they “gave back to the community”… no.  It’s obvious the first time you hit their website that they’re in this for big bucks.  They make it easy to download, but as soon as you need something altered, it’s damn near impossible for any casual coder.  It’s still a challenge for a PHP Expert and Zend Certified Engineer without the proper training and experience.  They do have a tutorial on “how to customize Magento” at http://www.magentocommerce.com/wiki/groups/174/changing_and_customizing_magento_code , which pretty much just tells you how to merge a new release into your existing one and show you how to create a module.  Professional installation currently goes for $149 from Magento.  I was able to install Magento on my local server, but it took some tweaking and working around a few of their bugs to get it to work.  Speaking of bugs, if you want support from them it’ll cost between $42 and $1500/yr.  Why not just look on the forums?  There are a zillion questions on their forums, but no answers.  Figures… you gotta pay for the answers. How about professional training?  Yes, they offer 19 hours of professional training for $1000. They’ve done a great job at ensuring they have jobs for a few years supporting this beast.

If you want to master this solution

  1. You need to be an object oriented PHP expert.
  2. You need an awesome IDE to work with that has intellisense. Zend Studio is a good choice. Don’t even think about using Dreamweaver here folks.
  3. Gain experience with Zend Framework.
  4. You must have a lot of time available to learn this solution
  5. Pay for their training and figure out how this damn thing works.

Thanks Varien for the cool product, but it’s not for me right now.  Don’t have the hundreds of hours to learn your system; there are much easier shopping cart solutions available.


Magento mod_rewrite doesn’t work 3

After installation of Magento and ensuring that mod_rewrite is enabled and working on my apache server, the Magento shopping cart still gives me the below error:

Whoops, our bad…

The page you requested was not found, and we have a fine guess why.
  • If you typed the URL directly, please make sure the spelling is correct.
  • If you clicked on a link to get here, the link is outdated.

The Fix

Log into the admin area and navigate to system->cache management.  Click the “refresh” button next to “catalog rewrites”.  That’ll fix’er.  It’s pretty dumb that this must be done on a fresh install, but it does the trick.


Magento cannot log into admin 50

I experienced a problem just after my Magento install where the page would simply redirect back to the login without displaying an error message.  I’d login using the user credentials I just created during the install and I also tried using the default user “admin” with password “123123” .  The trick was that I was installing on localhost and for some reason a cookie was not being set for the session.  I have other sites requiring a cookie on localhost, but Magento seems to have a problem with it.

The solution is to add the following line to your hosts file so you can access your localhost as www.localhost.com.
C:Windows\System32\drivers\etc\hosts (edit this file in notepad)
127.0.0.1 magento.localhost.com www.localhost.com
Also worth mentioning, if you need to reset a password manually in the database use the following:

UPDATE admin_user SET password=MD5(‘mypassword’) WHERE username=‘admin’;

If none of the above works, install the browser Opera and use it. Opera seems to work out of the box whereas IE, Firefox, and Google Chrome do not.