Jump to content

PW vs Drupal new project


freestone
 Share

Recommended Posts

I am starting a new project and ran across PW on the Bitnami list.  I spent the time to install PW on my WAMP stack and take a look. I went through the Planet Tutorial and implemented HTML Jump start and the grids are working.  I am amazed at how quickly I have ramped up to this point.   I have a lot of Drupal module experience and can tweak Drupal modules.  I have a lot of programming experience but little php. I am not worried about learning the needed PHP skill.   

Below is a list of the things I need to do for this site.

My question is …..Can I learn the needed skills to produce this site faster in PW or Drupal.  Drupal will get me 70% there will modules.  PW I think more like 50% but after only working with PW a short period of time it seems I might be the other 50% done in PW faster than the 30% in Drupal ?

I don’t know either API set (drupal hooks) but I started down the Drupal path and was discouraged quickly as it is learning a new language
that is applicable only to Drupal and most likely makes sense after you are ramped up but right now look ill thought out.  Drupal is great if you can get 95% there with modules.  This project is more like 60% there with Drupal modules but I sure dislike the BLOAT and the resulting lack of speed.

For this site I need.

1.  Has to be tablet and phone responsive.

2.  Easy two level nav bar (menu)

3.  Has to manage orders as it is a service oriented e-commerce site.  Shop for PW looks like 60% of what I need.

4.  Need to easily be able to ask the users a series of questions and build an “order” based on the answers.  Some of the questions will result in form changes that would ask yet different questions.  So I need to look at some good code for DB interaction.  Perhaps looking closer at Shop will ramp me up there since the DB interaction I need is all order related.

5.  I need to interact with a tool that will calculate mileage from address A to Address B.

6.  I need authorize.net payment gateway.

7. Standard social media like/follow

8.  Contact Form with email to multiple email addresses.

9.  I need to expose the Orders and other order related info to admin users that should only see the order management (none of

the standard PW admin).  This is pretty easily done in permissions in Drupal and it looks to be the case in PW also but I have not looked close enough yet.

That is it…version 1 does not need sliders or anything flashy….maybe later.

So if anyone out there knows the Drupal bloat and also knows PW and can venture an opinion which tool I can use to create this site faster I am all ears.  Also any specific tutorials or other ramp up articles to read to understand working with MySQL would be
great.

Thanks Much

JW  

Link to comment
Share on other sites

Hi Freestone, welcome to processwire

My question is …..Can I learn the needed skills to produce this site faster in PW or Drupal.

You sure can, just need to learn the pw basics and the pw api:  http://processwire.com/api/

The api of pw is very powerfull. You already have website experience with drupal so no problem

at all to learn these things. PW is build around an amazing concept that everything is "a page"

associated with fields and templates, which makes it very easy to make fast and scalable websites.

Here is a post about moving from drupal to processwire:

http://processwire.com/talk/topic/1015-switching-from-drupal-to-processwire/page__view__findpost__p__8988

And here are some modules that I know of:

http://modules.processwire.com/modules/form-builder/
http://modules.processwire.com/modules/blog-profile/
http://modules.processwire.com/modules/shopping-cart/
 

More about pw here:

http://processwire.com/talk/topic/4173-grouped-forum-posts-links-articles-tutorials-code-snippets/

And a lot of experienced pw people on this forum that can help you out.

  • Like 6
Link to comment
Share on other sites

Hi Freestone,

Welcome to the forum. Apologies for not going into detail here but just to say as someone who has used Drupal, your experience in PW will be akin to sitting outside on a warm summer's day with your feet up and listening to the birds sing.

Drupal does have advantages when taking on a very complex authoring system but other than that (in my eyes) styling templates alone is enough to make me want to gouge my eyeballs out.

Most things here seem pretty straightforward in PW (almost anything is achievable with PHP) and we'd be happy to give you a guiding hand.

  • Like 2
Link to comment
Share on other sites

Thanks to you both.  I am continuing down the PW path for now.    Still wrapping my head around template vs page.  Of course I keep wanting to liken some things to Drupal ...like templates are like much more flexible blocks.

It seems my biggest challenge will be adding on to the Shop module the way I need to so after I finish some of the suggested tutorials I will get that module installed and see if I can understand how tweak it to what I need to do.

Already I see that I can use the html kickstart to get a responsive theme going as a starting point and could already build a site that was an info site.

Is it easy to expose certain parts of the Admin pages to users that need to maintain site content but limit them to what you want them to see the same as roles in Drupal ?  In Drupal I would simply use a menu module and plug in the parts I wanted to expose to that menu system and give the proper privileges.  

I will post my questions as I go and sure appropriate the help.   Hopefully the other side of this project I can contribute something to the party. 

It sure does feel light and airy compared to drupal.

Link to comment
Share on other sites

Link to comment
Share on other sites

OK now my head is spinning....LOL  I have been through the planet tutorial and the longer tutorial found here http://wiki.processwire.com/index.php/Basic_Website_Tutorial 

I understand the concept of field, template, template file (and I get the difference) and pages ....still having a bit of a time thinking in this way but I see the elegance in moments of clarity.

My next step was to install a few modules which I did.  Then I implemented HTML Kickstart and all looked good with my example on tablet, phone and desktop so I got it to be responsive.

Next I installed Shop model and was trying to implement a simple product page and check out and also use it as a bit of a spring board to understanding the APIs.

Once I started looking at the install instructions for the Shop module since the core of what I need to do is sell a service and get a customer to pay....this is when the spinning started.  When looking at the Shop module install instructions I actually understand the later steps better than number #2 and #3 which have me stumped.  It seems in the later steps Apeisa is showing you his hook for rendering the cart and checkout process but you have to have products and add to cart first.

The second and third step of the instructions read..

2. Add sc_price class to your product template (can be multiple templates)  An example would go a long way.  I'm declaring a php class in a product template I create?

3. Edit few of your products and give them price - The module did not create any products or even a product template so I went to create one ....but.....

I found a post by Dave (I think) about the add to cart button which said echo $modules->get("ShoppingCart")->renderAddToCart(); 

So I proceeded to create some other fields since the only ones I saw was price and QTY.  I created ID and Desc and created a template like this

<?php 
 
include("./TUT_header.inc"); 
 
echo $page->sc_product_id;
echo $page->sc_product_desc;
echo $page->sc_product_qty;
echo $page->sc_product_price;
echo $modules->get("ShoppingCart")->renderAddToCart();
 
include("./TUT_footer.inc");
 
Then I created a page but the page error-ed and had a line through it on the page list. 
 
I then also noticed that in the fields there are some fields it was not showing when I changed the filter to show the "Built-In" fields. and in fact there was a field that says it is type=page which blows my simple mind a bit.  These fields are not however available for a template so I am guessing if I start looking at the code they are using in the checkout process and there are api's that let you create these fields.
 
I am headed out of town for 4 days but if anyone can give some simple steps to creating a product with an add to cart button perhaps I can keep going from there.
 
The other thing that is confusing to me is that I was headed down a path to create a template for a product (which is kind of like a DB table but also has some html to render it ....Right?)  but in order to create say ....3 products I then have to create 3 pages ? That does not make any sense to me.  Guess I expected the Shop module to handle product management as well as order management.   I realize this is more flexible in that I can define what the attributes ( columns/fields what ever you want to call them) of a product are instead of the module dictating that but I feel like I was swimming along in the shallow end pretty good and then went straight over my head.
 
It there another tutorial or example project that would help me understand the "class" reference in step #2 and that would help me start to understand how to start using the API's to do more than present some info pages?  I know I could build a nice info site right now that would be so much quicker than anything I built in Drupal but need to take the next step in understanding and did not really see a next step tutorial in the wiki.   I started to look at the API's but I think that will only be helpful once the log jam in my  head is broken.
 
Thanks for being patient with a newbie.
  • Like 1
Link to comment
Share on other sites

@freestone, very entertaining reading :)

Seriously, I think the chaps here painted it too pink for you. Reading your requests on your first post I can predict some trouble in the way. PW has lots of modules right now, but nothing as complete as some ecommerce modules that you would find on the big three. Apeisa's module is great but has some limitations for now, I have the idea that it's not as plug-and-play as you may have thought, but can't help you much there since I only played with it a bit in the very beginning.

That, said, you won't find anywhere as much flexibility as in PW. I'm sure Apeisa's module can be easily adapted to your needs on the time that you will gain for making your website in PW. Hope someone with will come up with a fresher insight about this module.

I sense that you are suffering from a common trauma that people recently arrived to PW have with pages. Joss wrote the perfect therapy here http://processwire.com/talk/topic/2296-confused-by-pages/ :)

  • Like 4
Link to comment
Share on other sites

Diogo.....Yes Joss summed up where I am pretty damn good.   It is hard to get a page not to be ......well ....a page in your head.  It is hard to take instructions like ....just take your products...when there are no product...and make progress if you are not already on level 5.

 I have the concept and think....man this is elegant....and as soon as I think of how to use it my mind goes to the thing I am actually trying to do an I am stumped.  Such is the learning curve.   I must say I have done a lot with drupal and for all its baggage it has its place. I just need to take my skills to the next level with PHP and I am concerned that with Drupal I have to climb the Drupal hook ladder and also the php ladder.  With PW I have to climb the php ladder and general concept and construction and the api but I am still not ready to toss in the towel and go the certain Druapl route only because I think there is more long term benefit at the top of the PW ladder.....but yes I am still on the fence and will soon have to make a decision.  Hoping someone will put me back on the ladder as I have fallen off .

I subscribe to a video learning for Drupal modules...Build-a-Module and the guy goes into gory detail on all the simple stuff and the hard stuff he just wises by.  This tells me he does not really understand what he is teaching or his audience. Here there for me seems to be a gap between building a fluff and buff site (easy in PW) vs a true business process site. I have a lot of e-commerce experience and I am a re seller of pinnacle cart and have done some open cart and xcart but luckily I don't need all those features on this project.  I need to interview a customer and build an order and checkout.  So again hoping someone can put me back in the saddle.

Link to comment
Share on other sites

On mobile now. Don't get me wrong, I'm more than convinced that PW is much easier to learn than Drupal. Forget all the PHP. You only have to know the very basic to work with PW, and the rest you can learn when it's required for each project, so by now focus on the tutorials and only that. If you know that much about ecommerce, it shouldn't be difficult for you to create a specific module, especially because you only need the checkout part. Modules are also very easy in PW. Surprisingly easy.

You also won't find a better support in any other forum :)

  • Like 1
Link to comment
Share on other sites

2. Add sc_price class to your product template (can be multiple templates)  An example would go a long way.  I'm declaring a php class in a product template I create?

3. Edit few of your products and give them price - The module did not create any products or even a product template so I went to create one ....but.....

Edit the product template you created and add sc_price field to it. This means: login to admin, goto setup => templates => product and add the sc_price field and save.

  • Like 2
Link to comment
Share on other sites

Just a quick thing about a page not being a page. I think the reason why this nomenclature is spot-on is because, unlike with other systems, in PW each "node" lives in it's own unique URl, making it a perfect candidate to be a page.

Link to comment
Share on other sites

Well I was really there I just had some typos and also a very strange thing happening and still don't quite understand it.

apeisa I did have the price in my template.....well I typed it as sc_product_price as you can see from my post and I changed it to sc_price (duh!) and it worked.  My one suggestion for newbies would be to change #2 to say something like render the sc_price field in your product page template and template file.  I think of a class in the OO sense of the word?  Also it would be very helpful to show the echo $modules->get("ShoppingCart")->renderAddToCart(); code since a product page without an add to cart button is not of much use.  For # 2 you could add that you need to create a few product by creating a product page for each product instance....well at least that is all I know how to do at this point....how else would you create a product ?     That's my input on the instructions.

The other thing that is really strange is the reason I could not save the page with data in it and the page had a line through it was the sc_product_id field I created.  I found that I could store and instance of the page with all the fields filled in but for the sc_product_id .  I could not figure out why so I deleted that field and recreated it and still I could not store any data in it.  I then removed if from the template again and deleted it again and this time called it sc_id and it worked fine.  So I am very puzzled as to why sc_product_id would not hold any data.  When I was trying to put data in it on the product page I got unknown page at the top in red.  Very strange.  That name perhaps is a conflict ?  I would pick a name that would simply not work...LOL

I now have a product page showing with an add to cart button so now I can look at the other get shopping cart features to checkout.

So is there an easy way to include a page in a search but not in the Nav Bar....they seem tied together ?

thanks for the help.  I am sure I will be back with more questions once I return from a bit of time off.

Link to comment
Share on other sites

So is there an easy way to include a page in a search but not in the Nav Bar....they seem tied together ?

What is the code that you are using to build the nav bar? What appears there is completely up to you, in some cases, people build it by showing all the children of home:

$navPages = $pages->get('/')->children();

foreach($navPages as $navItem)...

If that's the case, you can, for instance, remove the page that you don't want on the nav:

$navPages = $pages->get('/')->children()->remove($pages->get('/pagetoremove/'));

or

$navPages = $pages->get('/')->children('name!=pagetoremove');

but this is only one way...

  • Like 2
Link to comment
Share on other sites

Thanks again Diogo I will take a look.  The only menu code I have put in place so far is the code that came with the longer tutorial.  TU_topnav.inc.

I am back at this and also just notice that apeisa does clearly say in step #4 that you can render an add to cart button using this code echo $modules->get("ShoppingCart")->renderAddToCart(); ......I was so focused on my confusion of #2 and #3 I missed that.  

I am now going to see if I can render a Cart button and get into the cart.  Then I will start looking at the code.

Thanks to all for the help so far.

Link to comment
Share on other sites

So I did a lot of reading and testing and reading and looking at some profiles and module code and I still having trouble wrapping my head around using the field/template/page structure to simply implement some business process against standard relation tables in the MYSQL database.  Of course the way I think is order table (with all its columns), Order item table (with all its columns), product table (and all its columns) ....these are all related with foreign keys of course.   So in php I would write some code to run joined queries get the result and mark it up and render it.  So how in the heck do you make the leap to organize the wire components of field/template/page in such a way were you can simply run queries across multiple tables.  

I assume the fact that I even ask this means I just don't get it ?

I don't see any profiles that have this sort of logic implemented.  The profiles I see are very simply by comparison so no examples to really follow.

Can I simply build the tables I want and use the API's to I/O and render them?  Perhaps this defeats the entire reason for using PW ?

Or is there a forum post I have missed that describes how to think of the PW construct for a standard relational data base with its associate query's? 

Link to comment
Share on other sites

This post https://processwire.com/talk/topic/3579-tutorial-approaches-to-categorising-site-content/ pretty much sums up how you can relate things in PW. Just change "categories" to any other word you want.

It doesn't make sense to think in terms of tables when working in PW because PW gives a much more powerful way of organizing content, the tree. Think JSON and XML instead of tables.

  • Like 2
Link to comment
Share on other sites

So how in the heck do you make the leap to organize the wire components of field/template/page in such a way were you can simply run queries across multiple tables.  

I assume the fact that I even ask this means I just don't get it ?

I don't see any profiles that have this sort of logic implemented.  The profiles I see are very simply by comparison so no examples to really follow.

Can I simply build the tables I want and use the API's to I/O and render them?  Perhaps this defeats the entire reason for using PW ?

Or is there a forum post I have missed that describes how to think of the PW construct for a standard relational data base with its associate query's? 

Diogos right - everything you need is in the API rather than by thinking in terms of what the database is up to. The DB structure that Ryan has designed allows anything to be related to anything else without having to change the structure (and everything is indexed so you don't get slowed down by any particular approach).

The parent child/relationships that can be built either logically or from one branch to another, basically give you all the relational tools you want.

So, at a very basic level, a set of children having a common parent will give you a very strict relationship, and a visual one too, since you can see it in the tree structure.

But it goes further, very simply. One of the more powerful tool is the Page Field. Since this can be used to relate any page to one or more other pages (and, by logic, the other way round as well) you can easily move from a one to one, relationship to a one to many or many to many relationship. And you can build multiple relationships for each template (and by extension the page container based on the template) - as many as you like really. 

Also, if you remember that a page is simply a container that can hold one or more fields of data, plus any relationships via the page field, then you can see that you have a potentially very powerful beast.

It really does help to forget that there is MySQL in the backend - just think of templates as tables and pages as rows (er, I think that works) and so think of the page system as your database.

And off you go!

Did any of that make sense? I got a bit lost somewhere....

  • Like 3
Link to comment
Share on other sites

Thank again diogo...... it is a matter of really old dog, newer trick....lol

I follow the logic but it goes through an example where all the data is created in the admin.  That is obviously not real life.  In looking at the APIs are retrieval oriented.  so for CRUD the api's handle the R but you have to create (insert), update and delete using queries you build ?

The path I was headed down was to create the fields I need, put them into template that related to what I think of as tables complete with IDs and forgien keys and then assign pages so I could retrieve the data.  Relatively ease to then loop through the retrieved templates......but for me the missing part is insert, update and delete.  If I have to write all those queries then I might as well just write the entire app in php...... No ?

Link to comment
Share on other sites

// Bookstore examples

// Find all books that are priced over 30 dollars and set them on sale

$overpricedBooks = $pages->find("template=book, price>30");

foreach($overpricedBooks as $b) {

  $b->title .= " *SALE*";

  $b->price = $b->price - 10;

  $b->save();

}

// Find author

$sk = $pages->find("template=author, title=Stephen King");

// Find all books written by that author

$books = $pages->find("template=book, author=$sk");

// create new author

$ap = new Page();

$ap->parent = $pages->get("/authors/");

$ap->template = "author";

$ap->title = "Antti Peisa";

$ap->save();

// Add Antti as a second author for all the books written by Stephen King (continues from earlier example)

foreach($books as $b) {

  $b->author->add($ap);

  $b->save();

}

  • Like 6
Link to comment
Share on other sites

Thanks a lot guys.   I stared at the API cheat sheet a lot in the last few days and never noticed that there were +'s at the bottom of many of them....LOL...so I never saw save. ...Duh.  That is what happens when you are at the edge of your skill set.  The brain just start blocking things.

OK so pages are rows and templates are tables .... . I can wrap my head around that..... the XML tree thinking might take some time to get oriented in my head....  I am still inclined to use the template as tables with my own foreign keys since I now understand the page CRUD.....LOL

Another questions in looking at what I have to do.  I see there is a date time field.  How can I pop out a calendar to pick the date?

Many noob thanks,

JW

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...