Magento API: v2_soap Does Not Use Call()

If you are utilizing Magento’s API and have checked out the documentation, you’ll see that they have included a V2 of their soap API saying:

As of v1.3 you may also use http://yourmagentohost/api/v2_soap?wsdl=1 which has been added to improve compatbility with Java and .NET.

If you find the need to utilize the v2_soap API, take note that you will need to call your methods differently than the documentation explains.

For example, if you would like to use the sales_order.info method, using the standard soap API, you would do the following to get all the order info for order number 1000000142:

$client = new SoapClient('http://yourwebsite.com/api/soap/?wsdl');
$session = $client->login('username', 'password');
$result = $client->call($session, 'sales_order.info', '1000000142');

If you need to use the V2 API, you need to so it slightly different. Instead of using the call() method, you call the specific API method instead:

$client = new SoapClient('http://yourwebsite.com/api/soap/?wsdl');
$session = $client->login('username', 'password');
$result = $client->salesOrderInfo($session, '1000000142');

So, for V2, you must convert the method names in the Magento documentation to a camel-case method name.

Posted in Magento | 1 Comment

URL Rewrite Import/Export Module – Now on Github

I’m making another Magento extension available for free via Github. This module provides an easy interface to import/export Custom URL rewrites. As of the current version, please note that it does not import/export System rewrites.

https://github.com/Prattski/import-rewrites

If you are using 1.5.x+: Being that I developed this module on 1.4.x, the current package that you can download from Github will not work to install via the mage script. I would have to manually install it on 1.5 and then re-package it so that it’s a Magento Connect 2.0 package instead of a 1.0 package.

If you want to use this module, you’ll have to just unpackage it yourself. Inside, you’ll find 3 directories:

  • adminhtml – open it up, and copy the adminhtml/default/prattski/ directory into app/design/adminhtml/default/
  • modules – open it up and put Prattski_ImportRewrites.xml into app/etc/modules/
  • Prattski – put in app/code/community/
Posted in Magento | 8 Comments

Dependent Filters Module – Now on Github

Since I’m not going to bother with regular updates and support, why not make it free and accessible, right? I just put my Dependent Filters module up on Github for all of you to use.

This module adds on option on the attribute edit view that allows you to select dependencies from a list of existing filters. When dependencies have been set, the filter will not show up on the front end until one of the selected dependencies have been selected.

I hope you find it useful! https://github.com/Prattski/dependent-filters

Posted in Git, Magento | Leave a comment

It’s Been a While…

It is nearing 2 months since I last posted an article. I’m very overdue for a post. Why has it been so long? I’ll explain:

I have a full-time job, a family with 3 children, and I have been doing freelance Magento work on the side. All of this combined simply hasn’t been working for me. It’s too much. My family often gets the worst end of the deal when I’m busy with freelance. It was hard for them, stressful for me, and I needed to make a change.

I decided to stop most of my freelance work to focus on having more time with my family, so I pretty much went all out and stopped doing much of any work outside of my full-time job (including blogging). It has been very rewarding, and I’m glad I made that move. I know that I will never regret having spent a lot of time with my family, but I would definitely regret having not spent enough.

I still do almost nothing but Magento work, so I hope to start blogging more frequently with the things I’m doing/learning at work, so hopefully posts will pick up a bit more soon. I may even start opening up some open source Magento modules in Github soon as well (ones that I wanted to charge for, but I don’t want to deal with maintenance and support).

I hope you have found my blog useful, that’s what it’s here for. I hope to continue making it even more helpful.

Posted in Misc | 3 Comments

Full-Time PHP Programmer Needed

If you live in the Minneapolis/St. Paul area and you are looking for a programming job, August Ash is looking for a full-time PHP programmer. Any Magento module development experience is a huge bonus! Plus, I currently work there doing mainly Magento development, and I would love to have another Magento programmer to work with.

Check out the job posting.

Posted in Magento, Misc | Leave a comment

Netbeans: Display .gitignore File in Projects/Files

By default, Netbeans will ignore files such as CVS files, SVN files, dot files, etc. If you would like to have your .gitignore file displayed in your Projects or Files views, open up your Netbeans preferences, go to the the Miscellaneous tab at the top, then click on the Files tab. You’ll see a “Files Ignored by the IDE” section there. That field accepts a regular expression string that allows you to hide files. I have Netbeans NOT ignoring my .htaccess and my .gitignore files, but ignoring all other dot files. Here is what my pattern looks like:

^(CVS|SCCS|vssver.?\.scc|#.*#|%.*%|_svn)$|~$|^\.(?!(htaccess|gitignore)$).*$
Posted in Git, Misc | 1 Comment

ActiveCollab: Development/Module Drawbacks

The company I currently work with recently made the transition from Basecamp to ActiveCollab. Reasons? We wanted more flexibility, the source code, and ActiveCollab offers more features that were of interest to us.

There are some important tweaks that we would like to make to the system, having now used it for a little while. I started looking into module development, but was unable to find any evidence of being able to override any of the core/out-of-the-box modules. I recently posted this thread on ActiveCollab’s forum, and was really disappointed at the response.

Unlike Magento, which allows you to override pretty much anything, you cannot do overrides like that with ActiveCollab. It does allow you to hook into some events, but the flexibility for what you can actually change is very minimal. If you want to make changes, you have to actually change the existing modules. And, like you guessed, every time you want to do an upgrade, your changes will get wiped out.

You can of course write your own modules to add new functionality, which we will be exploring. But, if you want to modify existing functionality, be sure to document all the changes you make, as you may need to make those changes again and again with each upgrade.

Don’t get me wrong about ActiveCollab though. It is a nice system, and it is working well for the most part. There is just a very disappointing level of documentation for developers. As they said, ActiveCollab is a solution, not a platform/framework. We developers wish it wasn’t that way of course, but that is how they decided to do it.

Posted in ActiveCollab | 2 Comments

Magento 1.4 Themes Design Book Review

Magento 1.4 Themes Design was written by Richard Carter and published by Packt Publishing. It was published in January of this year (2011). I read the eBook copy, so I have not yet been able to look at the paper copy, but if it is like every other book published by Packt, there’s not much to complain about.

This book is geared towards beginners looking to get their hands dirty with theming Magento, and understanding how it works. If you are only used to theming applications like WordPress or ZenCart, you will find Magento very difficult. Magento doesn’t just use template files. Magento is much more like a framework, and should be considered as such. They have implemented a powerful system of blocks, layout xml, and template files. The concept can be difficult to wrap your head around, and that’s where this book can really help you get started.

You’ll find the book very well organized, and the author does an amazing job explaining concepts without rambling on forever. There are many occasions where a link to a article (mostly wiki articles on Magento’s site) that better explains the concept in detail, which is nice as it doesn’t clog up the book, and allows you to choose to explore the concept further or not.

Some of the things about things about this book that I appreciate:

  • Suggests when upgrading from 1.3 to 1.4 to start the theme over from scratch. While this seems crazy, from my experience, it has been the best option.
  • In chapter 1, the author goes through 6 differently themed Magento sites (3 themes that come with a fresh Magento installation, and 3 established websites using Magento) and explains the design elements in Magento terminology. It was great to see so many examples to see how Magento themes can be used differently.
  • Defined the challenges of theming with Magento.
  • Did a nice job of explaining theme hierarchy.
  • Suggests only using a single xml layout file for your custom themes. I had already learned that this is a great practice to have, and the fact that the author suggested this and gave good reason for it was appreciated.
  • Walk you through how to create a theme from scratch (though still basically based off of the base/default theme).

As you walk through the chapters in this book, it does a nice job easing you into the concepts, and keeps the flow going, building further upon what you are learning. Overall, for a beginner, I would highly recommend this book.

The only cons of this book: If you are hoping for a detailed and in-depth explanation of how layout xml works (like I was), this book won’t quite do it, though does a great job explaining the basics, which is the purpose of the book. The only other complaint I have is that the author suggests that you FTP all of the unpacked files to the server. I wouldn’t ever suggest that, but, if you are a beginner and are unfamiliar with using the command line, I guess it gets the job done (though very slowly!).

Posted in Book Reviews, Magento | Leave a comment

Magento: Module Development Tip – External Files

When creating a module (extension) in Magento, if you are doing anything at all with design or skin files, you know that there’s no way to put those files within your main module directory. If you are like me, you don’t like that fact. I wish my module could all be housed inside one directory, but at this point it can’t. To help with this, I typically create a text file withing the root of my module’s directory like this: app/code/local/Prattski/MyModule/externalfiles.txt

Here I list out every file and it’s path that does not reside in my module directory. This not only helps you not forget what files belong to the module, but also make it easy to remove everything should you need to fully uninstall it. Here is an example:

### Module Files Outside this Directory
 
# Module XML File
app/etc/modules/Prattski_MyModule.xml
 
# Frontend Templates
app/design/frontend/base/default/layout/mymodule.xml
app/design/frontend/base/default/template/mymodule/file1.phtml
app/design/frontend/base/default/template/mymodule/file2.phtml
 
# Skin Files
skin/frontend/base/default/css/mymodule.css

I would encourage everyone who writes modules to get in this habit. It is not only very useful for yourself, it is also really helpful for any of you creating community extensions to include this so that whoever is installing the files can easily see all that belongs to the module if any modifications need to happen.

Posted in Magento | 5 Comments

Magento: Potential Date Field Product Import Bug

Note: Only tested so far with 1.4.1.1.

A client that I am working on has a custom product attribute, which is a date field. They recently ran an import to update that field and noticed something strange. It seems that some of the dates worked fine, and others had the day and the month swapped, creating a wrong date.

They had probably 50+ products with the following value for the date: “2011-05-10 00:00:00″. Some of them worked properly and the date ’5/10/11′ displays when editing the product in the admin. But, some of them switched the day and month and the date in the field is ’10/5/11′.

I tried reversing the day and month in the csv and imported again, and again, it switched the date around. So, now that the value in the admin was ’5/10/11′, I ran an export of just that product, and the date was correct! I took that exact spreadsheet and imported it, and it switched the day and month again.

At this point, I don’t have time to really dig into trying to figure out the issue. If you have encountered this, or even better if you have figured out the issue, please comment! Please be sure to inclue your Magento version as well, as it may not just be 1.4.1.1.

Posted in Magento | 4 Comments