I'm writing a module and for the life of me I can't get it to work. I've made several modules in the past so I'm guessing I have some stupid mistake somewhere. Does anyone know if there's a Magento module validator out there to point out problems with a modules structure and format?
The closest thing is the configuration lint system I built a while back. While far from a full fledged validator, it checks for common configuration errors and allows you to write you own test.
The first unofficial steps of manual validation involve checking the "Disable Module Output" section of the magento admin to see if your module is loading. If it doesn't show up in there, that means there's a problem with your
etc/module/*.xml
file. (maybe code pool?)
There isn't any validators that I'm aware of. Sometimes the best thing to do is to start a new module and slowly re-build it. Keep adding very small pieces of functionality or configuration at a time. You'll eventually find out what doesn't work.
With Magento, there are so many places it can go wrong, even down to improper capitalization of words in your config.xml file. I can't tell you how many times I've made dumb mistakes that I spent hours trying to figure out, and it was a misspelling or something silly.
Good luck. I hope you can figure it out soon!
Related
this is kind of a specific question but I am wondering if someone of you came across the same problem before.
What I am trying to do:
I am working on a jtl plugin.
To start off, the plugin should just run over the payments (the specific hook is active an works) and rename the description. Since I need to add more functionality later, all the stuff has to happen in the plugin (even though jquery would be easier for the former case).
In the shop system, the payments are set like this:
$smarty->assign('Zahlarten', $zahlarten);
In the plugin, I get all the payments like this:
$tmpPayments = $smarty->get_template_vars('Zahlarten');
I then loop over the array, doing specific changes. In the end, I want to add the payments back like:
$smarty->assign('Zahlarten', $tmpPayments');
And this is, what does not work. When I change the description and watch the variables in the phpstorm debugger, they are updated accordingly.
But after the page is loaded completely, the changes are not visible.
I know professional plugins that do it the exact way, and it works.
Changing the original array also does not help.
Also, deactivation caching does not work. Like this:
$smarty->assign('Zahlarten', $tmpPayments', true);
What works is:
$smarty->assign('Zahlarten_tmp', $tmpPayments');
But thats obviously not what I want, since I would have to change the template for that.
To wrap it up, it seams to me that there is some kind of caching going on which I can not figure out.
Does anyone has an idea or can point me to sources that might help?
Thanks in advance!
I finally came across the answer (hours later :P).
Root of the problem:
Some system source code far away from my actual context made its own calculations, leading to another
$smarty->assign('Zahlarten', $farAwayCalcs);
,thus overriding my changes.
Never underestimate stepping through the code with your favorite debugger. ;)
Cheers!
My question is do widgets get in on any custom libraries that I add to a custom module? What I want to achieve is create a custom module and I want to add ability to generate pdf documents so I was thinking of making the pdf generation a widget as I would like to use that on another site. If I made it a module, would I be able to share the resources between my pdfmodule and any other module? Sometimes I wish there was a book written on pyrocms that clarifies these issues.
Sorry it took a month to spot this one, but we generally help out on the support forums and don't look here as often.
SO, cross loading resources. Yep that is supported just fine. We use the HMVC plugin for CodeIgniter and often forget that people don't know too much about how it works. I'll get something added to the documentation for this, but basically you just specify the module name like this:
$this->load->library('modulename/libraryname');
Hope this helps anyone finding this in the future. It's probably a bit late for Eagletrophy.
I have created a sample module, but I am not sure if its /module/etc/config.xml file is getting loaded. I am sure there is a problem in that only. Is there a way that I can find out whether this file is getting loaded?
The free Module List module (built by me) will tell you which module's are installed in the system, and will tell you if your config.xml is being loaded.
If you have a good debugger Xdebug or Zend Debugger, you can check the variable $mergeToObject in the method loadModulesConfiguration of the class Mage_Core_Model_Config.
Or the bad guy way :-), you die the script at the same place but just before return $mergeToObject; you do print_r($mergeToObject);.
You could see in this method if your module is loaded too.
A debugger is your best friend. ;-)
All of this allow to check what is loaded from your config.xml but doesn't mean that the syntax is correct into your config.xml to load models or else. You should take a look in other config.xml of the core modules to help you.
I have forgotten, check if you module is correctly loaded and recognized by Magento after a cache flush, you should take a look in the System > configuration > advanced tab and see if your module name appears.
Drop this in the bottom of your index.php, similar to Alans Module List but a quick code copy/paste approach. Remember all of Magento's XML's get combined into one XML tree.
header("Content-Type: text/xml");
die(Mage::app()->getConfig()->getNode()->asXML());
As long as you have Your_Module.xml in app/etc/modules/ and it is enabled (might have to flush the cache if you have caching enabled), app/code//Your/Module/etc/config.xml is one of the most sure things that will load. Other files may not for different reasons, but that one will always load. Whether or not it's properly set up to let your module work is an entirely different story though. I've spent plenty of time debugging a config.xml file to find some minor spelling error was the reason my module wasn't working.
Alternatively, you could throw some invalid XML into it and see if Magento borks out.
I know some of the tutorials for creating Xcode project templates, for example this one here: http://robnapier.net/blog/project-templates-364
This is the best one I could find. All others basically repeat the same info, or are no longer up to date, or worse tell me that even they don't know what they're doing. Possibly useful tools that are linked to here and in other places are no longer available.
I keep running into roadblocks, and would like to gather as much information as possible on the process of creating Xcode project templates. Info that is most importantly up to date (at least it must be relevant for Xcode 3 or higher).
For example, what I'd like to see is:
a description of the
TemplateChooser.plist and similar
plist files and what these options do
(in my case, once I add a
TemplateChooser.plist, my project
disappears from the Xcode project
template list)
how to create a project template that references another .xcodeproj (when I do that, the other .xcodeproj appears in the project template list even though it doesn't use the special naming convention)
processes that can be applied, for example is it possible to run a script during the creating of a project from a template? This would be useful to unzip certain files into the newly created project.
If you have the answer or suggestions to any of the issues above, I'd appreciate that. Otherwise any link to good Xcode project template resources would be highly recommended. Especially if there is an official documentation from Apple - I haven't found one yet which seems to imply that project templates are undocumented.
Have you seen these:
http://www.sodeso.nl/?p=895
http://www.codeproject.com/KB/iPhone/CreatingXcodeProject.aspx
If you say you have searched, I'm pretty sure you've already seen the links but these are the best resources I could find with my 'googlabilities'
You might try contact this guy - http://linkedin.com/in/mottishneor he has some related messages around the web
The links suggested by FX are also not bad at all!
There is indeed little XCode template info out there. What I have found of interest are the following links (I documented myself on the topic, but haven't yet gone any further):
a Google Code search reveals a few examples, but not much
in particular, I found interesting to look at the code provided by Three20; they have some basic examples, like here
referencing another project worked for me, so maybe you could open a specific question about that giving more details?
there is information scattered on the Apple mailing-lists
there is no official documentation from Apple, as is evidenced by the lack of results to this query
I'm sorry if this is not a Enlighting, concise answer. As you said, it's not well documented, and sources are all over the place. I just hope I could highlight some places to find information that your own searches might not have reached :)
I don't have a Mac anymore, so this is as much as I can give you without testing this myself. As far as I can tell, Xcode templates are undocumented by Apple.
This guy has some guides for messing with Xcode templates but the info is pretty sparse. My suggestion for working with templateChooser.plist is to try to only edit that file in the interface builder.
This guide is a good example of how to add a reference to another .xcodeproj. For the reason you were having trouble adding a reference to your project we probably need more information.
If you scroll way down in this doc you can that each template already includes a script called myscript.sh. This script will show up in the scripts menu for projects built with that template. That isn't quite as convenient as running scripts automatically, but it's better than nothing.
In conclusion, Xcode template documentation is a nightmare. It looks like there are a lot of powerful features there, but they are obscured because of lack of user friendlyness and because documentation lags far behind Apples updates of Xcode. It just doesn't seem to be a priority for them. I hope this helps.
And yet another video link http://howtomakeiphoneapps.com/2010/10/how-to-make-custom-xcode-templates-with-video/
I want to ask one of those broad questions so please go easy on me. I know that phil is doing well with pyrocms but I would like to use pyro for my sites and also know how to write custom additions to the cms to suit my needs so what bums me out is how do you use it? where do i add my additions? how is it laid out? Like I said before go easy with me cos there is no documentation for pyrocms.
Thanks
I suppose this is one for me then :-)
modules can be added to the system by adding the folder to application/modules and copying the folder structure. To understand the modular structure better read the documentation for Matchbox by Zacharius K. I'm on my iPhone on a train so not going to look I up for you :-)
look a details.XML within the module to see how to set frontend/backend module type and when you have set a module with is_backend_sidebar clear the cache (or wait 6 hours :-p).
Documentation WILL come soon, my Internet has been down 2 months longer than expected so finishing v0.9.8 then documenting the lot will take a while.
Tweet or email me for more help.