developing module with drupal - php

I have a website which is up and running on drupal. Its product based website. I developed by creating my own tables and writing php code using php filters. I never used module concepts. Since the site is running well, so i am thinking to move to module concept. so wanted some help here, like how to do it.. i have gone through module development concepts also.
requirement.
1. Admin should be able to create new products like Mobile, Camera.
2. He should be able to define product properties and properties for which user will rate on.
3. Admin/ second admin should be able to create new sub products under products like mobile - nokia 8850 , nokia 9980 where he enters details of product properties also.
4. A listing page for all the sun products under main product. and from listing page we go to to main sub product page where user rates the product.
My confusion : should i create a new table or drupal takes care of all the requirements. and how do i start with it.
update : clear picture of requirement
ex :
1. 1st i add a product "MOBILES"
2. Then i add properties for this main product.
3. Then i start adding sub products under MOBILES i.e nokia 1100, samsumg 2200 and etc.
while adding sub products, in this page it gives me a text box for all the propeties i defined while creating the main product MOBILES . So is this possible using CCK.

You're right to consider using modules and following the "Drupal way". Use CCK + Views and Drupal will take care of the table maintenance and querying for you.
As already mentioned, you will need to get familiar with the CCK module. This module will allow you to create new "content types", which in your example would be the different product types and their attributes. Here is a good overview video on CCK. With CCK you can define new content types and Drupal will create the basic content creation forms for you and hide spare you from all the database details when you're working with it.
The Views module is essentially a query builder and will allow you to create views of your content. There are all sorts of related modules that can help you render your data as charts, grids, lists, slideshows, tables, etc.
There is a slight learning curve but once you get past it you'll be able to build new things pretty quick.
Update: Just another thought, if you are really needing to create some kind of classification system you should look at Taxonomies.

It sounds like you could do all of this with modules, without needing to do any php coding at all. Check out (if you haven't already) cck, views, and fivestar.

In response to your update, sounds like CCK and Node Hierarchy should do everything you need.

Related

Drupal route based node content

I'm new to Drupal and have a basic question which I cannot find a good answer to. I am trying to dynamicly determine the contents of my website based on a selection made by the user and keep the selection displayed in the routing for SEO purposes.
It's a website for a Restaurant with multiple franchises.
What i'm trying to do is the following:
The user visits my website and gets a splash screen presented with the available franchises or a textbox to enter his postalcode
Upon selecting he enters the main website with the navigational structure adapted to the selected franchise. For example: domain.com/city/, domain.com/city/menu, domain.com/city/menu/dishes, domain.com/city/contact, ...
The contents of all nodes are based upon the city the user selected. Some franchises have extra nodes which should be displayed in the main navigation aswell.
What I have thought about so far is to try to accomplish this with taxonomy but I really have no idea where to start. Parts of the nodes will be the same for all franchises other parts will be different. Menu item prices will also be different.
This is the first website i'm building using Drupal so any advice is welcome.
Thanks!
It will be impossible to explain it all here but yes it is possible to select your content based on user input in Drupal. You will need to look into Views & Panels.
In Views you can use arguments to narrow to a specific taxonomy. With Panels , an argument can be retrieved fron the URL and passed to the Views in order to display the results.
There are a lot of resources available, Merlin of Chaos, the author of the Views & Panels modules has written a book about it. There are video tutorials online. Your best bet is to start with drupal.org.

Modx custom tv with multiple inputs

I need to build a custom tv in modx that will all a user to select a image, a title and a date.
Can't seem to find any help other than the docs with although detailed don't answer my problem.
Anyone done this before and are able to advise me further
Cheers
I'm not 100% sure, if this is what you're trying to archieve, but I think multiItemsGridTv (MIGX) for modX revolution is what you want.
From the docs:
MIGX (multiItemsGridTv for modx) is a custom-tv-input-type for adding
multiple items into one TV-value and a snippet for listing this items
on your frontend.
It has a configurable grid and a configurable tabbed
editor-window to add and edit items. Each item can have multiple
fields.
For each field you can use another tv-input-type.
Essentially, you can make up a set of multiple different template variables (including images), that always belong together. If you then assign your MIGX tv to a template, you can enter as much of these sets as needed per resource.
You can download it via package management or from the modX Extras Repository.

Ecommerce application and solution

Here's my predicament. I'm working with a designer who has a very unique layout for his ecommerce site. It's kinda like a table/tier based system where you buy a certain amount of points. I need the ability to have user accounts etc and it will all be in joomla. There's many options such as magento, virtuamart etc. but basically what I'm saying is... will it be possible with any particular platform to transform the products so much so that can still use the platform? here's a screen shot...
http://www.one2designs.com/images/screen.png
Basically It needs to some way integrate into joomla, allow for user profiles etc, and I guess be so customizable that it can be transformed into that look.
Both Joomla and Virtuemart allow for 100% of customisation of the templates used. The process is simply:
Design
Cut and slice into HTML
Build Joomla template, product pages.
Further, the screenshot shows simply a list of 7 products, so either Table with 7 columns or a ul, li construct will work.
Is there anything else product wise you need to manage? It doesn't look like people will actually add more than 1 product to their "shopping cart", so a simple form manager like RSForm may achieve the same purpose. There are E-Commerce plugins for most newer form managers now and it should also not be too hard to link up third party payment gateways as a one off.
From the look of your image, that is simply a product with various options that are user selected. You would need to change the way the product options are displayed to fit the design, but other than the display, there is nothing unusual about a product with many options. Everything below the radio buttons is pretty much irrelevant as it is only option details. Virtuemart could be made to do this fairly easily.

Simple CakePHP Portfolio

I am building a very simple website ( http://driz.co.uk/beta/ ) using CakePHP to show a portfolio of my work as well a few pages such as about me and contact. I was thinking of just creating each item for my portfolio as a page inside the /views/pages/ folder but seen as I'm wanting to learn a bit about CakePHP I thought it would be probably better to use a database and store each item in a simple table.
What I need to do is have a simple page like /portfolio/ which lists all my work to date and then links to each item I have so for example /portfolio/my-awesome-work/
I also need to list the items in the sidebar as shown in the link.
For each portfolio item I will need a title, a body (which will store the content and images for each item) and also the client information. I don't need any image upload capabilities as I will be just adding the HTML for it in the database table.
If anyone can help it'd be much appreciated.
Thanks
Hopefully you aren't asking for a full solution (frowned upon on SO)
First follow the blog tutorial : http://book.cakephp.org/view/1528/Blog
This is a great place to start as it walks you through all the basics.
As for your particular problem. Creating a portfolios table with all the fields you mentioned and baking the code (you'll know what that means when you follow the tutorial) as a starting point will get you half way there.
You could also add in an admin area to manage your system. This would mean you'd need to create a users table and add the Auth component

Drupal best practices for custom admin section

Is this a common task in your Drupal work when you're asked to create a custom admin section in Drupal for your content?
For instance, you have a few content types and user wants not only to view them, but to search using different filters, to add new items - all inside the same admin subsection.
In essence, this is classic search/grid/record screen/pages and while in typical Drupal distribution content management screents are kind of scattered around, I am talking about more organized spage, e.g. in which Grid (View) also has "Add new" link and you don't have to scroll to "Create content" menu which relates to a different section.
What is your experience and opinion in this relation?
I'm actually working on something like this right now where I work. We've built a custom module to solve Drupal's biggest problem of having unorganized content by organizing it in a nice tree structure. What we've decided to do is go ahead and create a whole new section within the admin just for managing content through this module (it contains a lot more functionality than just a tree structure). There were two big deciding factors when deciding to do this.
We knew we weren't going to be releasing this module so we didn't need to worry about integration with other modules because any such integration would be done by us.
The non-technical staff that this was presented to preferred this method over having several different admin pages with different pieces of functionality on each one, despite all the functionality being related. They viewed at as simply being easier to use.
The point behind my explanation is this: if it makes sense in your situation, then I'd say make either a new section or a new page with several tabs on it. There's a lot of deciding factors to consider:
Do I (or my) clients like the Drupal admin as is?
Do I need to worry about integration with third party modules?
Is time of the essence (this one is a big one)?
How extensible do I need the new admin page(s) to be?
Is upgrading to the newest version of Drupal of big importance (from 5 to 6 and later from 6 to 7 and so on)?
Many non-developers I've talked to abhor the Drupal admin and most content editors I've talked to or worked with prefer having a single admin page they can go to to manage all of their content. As a result, our setup is well received by our clients even though some within the Drupal community may not agree with it.
you can use views_bulk_operation module to show content (or users) to execute (batch) operations on them. in this way you get a sortable grid with search capabilities (exposed filters), pagination and the possibility to execute custom bulk actions. from here it's easy to add a link "create new" in the view footer. furthermore, you can use link as "local tasks" to organize views in tabs.
usually i use simplemenu for the admin backend and i hide the navigation menu in the sidebar for all but administrators.
Another option - much easier to deliver - would be to create a new menu only visible to the administrators - and dependent on the content displayed - with links to the pages for common tasks. Particular views, for example, or to add new content of the currently displayed type, etc.

Categories