A Wp-e-Commerce Module Framework
Posted by jghazally | Filed under wordpress, wp-e-commerce
So I’ve made a couple of modules (Upgrades) for wp-e-commerce now, and I’m starting to get the hang of things. Theres a few key things to make a module actually tick with wp-e-commerce but don’t worry it takes it’s inspiration from WordPress so if your familiar at all with developing in WordPress then you should pick it up quick and easy.
I’ve made a basic frame for building my wp-e-commerce modules quick and effortless. It’s really simple, it does the first two things every module needs… well sort of apart from actually DOING anything.
- Has an Upgrades File Header
- Adds a new page to the Products sidebar in wp-admin
Step 1 : Location and File Structure
All upgrades either live in this folder or in a folder in this folder
wp-content/uploads/wpsc/upgrades
All upgrades have a main file with its comment header (just like themes and plugins with WordPress)
*/
/*
Upgrade Name:WPSC Skeleton Module
Upgrade URI: http://www.screamingcodemonkey.com
Description: A skeleton module for wpec
Version: 0.0
Author: ScreamingCodeMonkey
Author URI: http://www.screamingcodemonkey.com
Then Some but not all modules/upgrades require a new page in the ‘Products’ wp-admin Sidebar Widget:
if (is_admin()) {
function wpsc_add_modules_admin_pages($page_hooks, $base_page) {
$page_hooks[] = add_submenu_page($base_page, __('-New Page','wpsc'), __('-New Page','wpsc'), 7, 'wpsc-module-admin', 'wpsc_display_admin_pages');
return $page_hooks;
}
add_filter('wpsc_additional_pages', 'wpsc_add_modules_admin_pages',10, 2);
}
*/
It’s pretty basic, hope you find this useful. If you have any suggestions I’d like to hear from you. You can download a .zip of the moduleSkeleton bellow.
|
|
download: moduleSkeleton (3.14KB) added: 13/01/2010 clicks: 126 description: A Wp-e-Commerce Framework for creating additional modules(Upgrades) |
January 14, 2010 at 1:04 pm
When it comes to WP e-Commerce, Jeff is an absolute genius. He has totally come through for me in my various times of need, going so far as to put off what he was doing in order to help me out. He has gone above and beyond what you could ever hope for in a programmer. I am so freaking grateful to him right now, and would highly recommend him to anyone in need of a programmer.
January 14, 2010 at 3:20 pm
I second what Sara says – Jeff’s help with the e-commerce plugin has been invaluable. A useful upgrade to an already awesome plugin, will be implementing this in the future for sure. Big thanks Jeff
January 15, 2010 at 11:57 am
I’m working on something similar for my own plugin at the moment. I find it tricky writing something which will give maximum flexibility for module writers without over-complicating things.
January 15, 2010 at 12:13 pm
@Ryan, I think the best option (which is what Wp-e-Commerce does) is add do_action at the start and end of its functions people want to tap into. KNOWING which functions that are is the tricky part~
January 16, 2010 at 4:14 am
Dumb question – but why does WP E-Commerce need it’s own “upgrade” framework. Why aren’t bolt-ons just distributed as standard plugins?
Also – most of the stuff in this template should be wrapped inside:
`if (is_admin()) {
}`
so that you’re not including / parsing a whole bunch of code that will never run.
But I do agree that Jeff rocks
January 16, 2010 at 12:16 pm
Hi Lee,
Thanks for the suggestion, Ill update that and reupload it shortly. As for your question regarding why Wp-e-Commerce needs its own upgrade system (not a dumb question at all), basically there are two main reasons that I can think of.
1. Less clutter in your Plugins directory, for example I’m not saying it’s wrong, but I personally don’t like the way MailPress adds a whole lot of ‘additional’ Plugins into your Plugin directory for different functionalities. I think it’s better to just leave the core Plugins in the Plugin list.
2. If it’s a Plugin you have to activate it, If it’s a module it is true plug ‘n’ play.
Another reason that springs to mind is that Dan wants it that way, and we ALL know that Dans the boss
and the Boss gets what the Boss wants tehehe.
January 16, 2010 at 12:36 pm
I’ve added Lee’s is_admin check to make sure it is only called when necessary. Thanks Lee you tha bomb!
January 18, 2010 at 3:09 pm
[...] Download 3.7.6 Beta 1 ยป Who’s canonical? We are! This entry was posted in WP Plugins, WP e-Commerce. Bookmark the permalink. Post a comment or [...]
January 18, 2010 at 3:21 pm
Yeah hey guys. I agree with everything people have said about Jeff. He’s a super duper screaming monkey. And a good coder too
The decision to put add-on WP e-Commerce Plugins into their own folder was based mostly around the concept of keeping ones Plugin directory clean. I agree with Jeff – once you’ve seen a Plugin mess up your /wp-content/plugins folder with hundreds of little Plugins it becomes a pain to manage. Also I never really thought of it as “plug – n – play” but I do like that too.
If you don’t like our thinking now I’m sure that you will when there are hundreds of additional WP e-Commerce Plugins / Modules available for download.
January 22, 2010 at 7:26 am
I was also wondering why you had gone down the separate module route rather than plugins. If you’re hoping people will run with this and create a loads of great modules it totally makes sense.
…so when is an e-Commerce Module repository with auto-update functionality planned!
March 11, 2010 at 12:03 pm
Great site jghazally…
Top Tips!
May 10, 2010 at 5:51 pm
Hi there,
I really appreciate your work. Now I know this will sound dumb, but I’m trying to get your upgrade to work. Did I misinterpret this post, I’m guessing this is an upgrade I can add to my site. If so, how exactly to I install, I put it into the upgrade directory, obviously it will take more.
May 11, 2010 at 8:34 am
Apart fro the obvious unzipped the file… You are on the right track,,, wouldn’t know what the problem is sorry..
Best
Jeff
May 20, 2010 at 9:58 am
Help! I am totally stuck, and everyone says you’re so helpful. I wondered if you could assist, its an urgent issue that could do with a quick fix!
Being new to wordpress I thought I knew what I was doing and I don’t and I’m needing help.
I use e-commerce/wordpress to run a live sales site at https://www.securessluk.net/jacquismithnet and I thought I was doing really well being completely lazy and running a site that is both user friendly and the admins can operate really easily! OOOPS I’ve found out theres more to it than donwload and install!
WP E-Commerce doesn’t like RB Link 0.2, and due to the fact that I have PHP 4 on my server I have to stick with 0.2.
Because WP E-commerce is not a post, excerpt or page the add_filters don’t work to parse the RB Internal links added in the product editor.
Take a look at https://www.securessluk.net/jacquismithnet/ about half way down the page there is supposed to be internal links to other parts of the site, but the E-Commerce isn’t transforming the code.
What can I do? I would really appreciate assistance with this, I have trawlled the internet for days and can’t come up with a resolution. What can I say? I am a noob!!
If you could help that would be amazing.
Many thanks,
Russel
May 20, 2010 at 7:49 pm
Hi sorry I’m pretty flat out i’m stocked ppl say I’m helpful but I have no clue what RB link is,,,
Have you tried asking on the forum? Getshopped.org/forum that is,,
June 7, 2010 at 1:15 pm
My Luminary is Hellen, Likeable to come across you all !