Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

[SOLVED] Joomla categories 11 Oct 2011 10:49 #189

Hi!
I want to know if is possible to use the joomla categories or do you have a table of categories?
tnx

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Re: Joomla categories 11 Oct 2011 13:33 #190

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
No, it is not possible.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: Joomla categories 11 Oct 2011 16:34 #195

ok thanks

Please Log in or Create an account to join the conversation.

Re: Joomla categories 12 Oct 2011 04:58 #206

Actually.. it is...

It will give you a little extra work, but at the end will function correctly...

I would do this...

1 - Create a table called 'category' and would make it exactly clone of com_category table (Joomla's default category)

2 - Create the component as you normally would... with all the foreign keys, connecting categories to items and vice-versa.

3 - Once you are satisfied creating the component, build by normal process and install it to your Joomla.

4 - Go to the models and just rename the category table, so instead to save to your Component category, if would save to the Joomla's com_category table... example

The original Query on model would be something like this
function _buildQuery_ticket()
	{

			$query = 'SELECT a.*'
					.	' , _category_.title AS `_category_title`'
					. 	$this->_buildQuerySelect()

					.	' FROM `vs4go_compname_item` AS a'
					.	' LEFT JOIN `vs4go_compname_categories` AS _category_ ON _category_.id = a.category_id'
					. 	$this->_buildQueryJoin()

					. 	$this->_buildQueryWhere()

					.	'';
		return $query;
	}

So, you have to change for something like this
function _buildQuery_ticket()
	{

			$query = 'SELECT a.*'
					.	' , _category_.title AS `_category_title`'
					. 	$this->_buildQuerySelect()

					.	' FROM `vs4go_compname_item` AS a'
					.	' LEFT JOIN `vs4go_categories` AS _category_ ON _category_.id = a.category_id'
					. 	$this->_buildQueryJoin()

					. 	$this->_buildQueryWhere()

					.	'';
		return $query;
	}

Pay attention that the change was very small... I just renamed the LEFT JOIN `vs4go_compname_categories` to `#__categories`... by this way, I stoped to use the component's categories table, to use Joomla's default categories table.

Hope you get the idea...

PS: Just remember that categories table, may be instantiated in another files on component, such as table folder, controllers and view... Simply rename as I suggested and everything will work fine... After you renamed all, you can drop the table you created and let the component use the default Joomla's table
Paulo Griiettner
The following user(s) said Thank You: urbanspaceman

Please Log in or Create an account to join the conversation.

Last edit: by griiettner.

Re: Joomla categories 12 Oct 2011 06:35 #208

many tnx, grriettner maybe this solve my problem

Please Log in or Create an account to join the conversation.

Re: Joomla categories 12 Oct 2011 06:39 #209

Let us know if this worked for you, so people that want to do the same thing, would find this topic useful...
Paulo Griiettner

Please Log in or Create an account to join the conversation.

Re: Joomla categories 13 Oct 2011 16:47 #220

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I think this is not a good idea. What you propose is called a "database hack".

In some case it works, but you REALLY need to know what you do.

In particular on Joomla 1.6 category table, you may destroy the tree structure (hierarchy parenting) because some specials fields as 'lft', 'rgt', and 'level' will be broken.


If you do this to hack a Cook generated model, some functions will not be anymore supported. FK Integrityes for exemple.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: Joomla categories 13 Oct 2011 18:26 #228

Admin...

You are right about the 1.7 version... the 'lft' and 'rgt' can be a problem for those that does not know how to use it... I would not have problem configuring that, but I'm not sure about others.

About the FK Integrity, it is just of a matter to generate the table and disable this on cook when creating the Foreign Key connection...

Any way... I posted just an Idea... but of course, this would require a more advance Joomla programmer that know exactly what he/she is doing.
Paulo Griiettner

Please Log in or Create an account to join the conversation.

Re: Joomla categories 13 Oct 2011 18:33 #230

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I do exactly the solution you described, when I use for my personal needs. It fits. But it is not a ready-to-use solution.

This was just the meaning of my comment.

For read only operations, there is no problem.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: Joomla categories 25 Nov 2011 23:24 #623

It would be great to get this on the development road map, to use the default Joomla category manager. Why reinvent the wheel, when we can use what's already available out of the Joomla box ;) This would also cut down on the development time not having to create everything that goes along with managing categories.

Please Log in or Create an account to join the conversation.

Re: Joomla categories 29 Nov 2011 12:48 #637

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
In facts, I understand.

But it is an intentional choice for many reasons.
- FK integrities should be much more complicated (creation of plugin)
- It is more comfortable to do not mix the database objects. Your component is contained only in the component tables (except for foreign object such as 'users')
- We are preparing a Nested table system wich will do exactly the same than categories, in more light, and even more extended possibilities.
- Our Nested system will be available in 1.5
- Templating of the categories is global, so it is a problem for particular uses

So. This functionality of categories integration is not a priority for the moment and if we include it, it will disallow the FK integrities (item cascad operations on category delete)
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Re: Joomla categories 23 Mar 2012 15:45 #1718

Jocelyn,

I know you already gave your explanations about this subject, but is there any chance to make integration of com_categories to cook developed components?

Would be great to have this feature in the same way you have for users, where it shows in the diagram the com_user tables and its connections with other tables...
Paulo Griiettner

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.082 seconds

Just wanted to congratulate you on the J-Cook website / web development tool. In a couple of visits I've had a play around with Cook and have to say I think it is fantastic.  I've played with a number of component builders in the past and yours is certainly looking like the best so far. I'd also like to help you spread the word - I'm really surprised more people aren't excited about this tool. Good luck with the project.
Dean

Get Started