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

TOPIC:

Create New => Run Function 02 Jul 2013 00:38 #7796

I have a component I made earlier this year with jCook v2.0. I came back to update/upgrade the component to add some features. Well, the structure has changed and I was wondering if someone could point me in the right direction.

Before:

com_name > admin > tables > the_item.php

Within this file was this:
	/**
	* Overrides JTable::store to set modified data and user id.
	*
	* @access	public
	* @param	boolean	$updateNulls	True to update fields even if they are null.
	*
	* @return	boolean	True on success
	*/
	public function store($updateNulls = false)
	{
         .....
        }


I inserted my code that needed to run after a new item was created and life was good. In v2.5.4 this no longer exists. I am assuming it has been moved?

Ideas?
--
Jerry Benton

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

Create New => Run Function 02 Jul 2013 00:52 #7797

I may have answered my own question. Is it now in the FORK for each item?


www.j-cook.net/index.php/forum/added-fun...ctionality-for-forms
--
Jerry Benton

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

Create New => Run Function 02 Jul 2013 20:40 #7809

Well I am at a loss. I have reviewed the Forks documentation. Reviewed MVC (again). I can't figure out the new structure or where to place my function.

Basic Structure:

Pages >
>> Backend
>>> Item
>>>> View Item page
>>>> Create item page

When I create an item I need to fire off some custom code. So if you could please tell me where I would place this code, I would appreciate it.

Also, when I create an item and make a user the "Created By", the item always saves as me, the person creating the item. My other component correctly saved as the user I was selecting. (jCook v2.0)
--
Jerry Benton

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

Create New => Run Function 03 Jul 2013 22:42 #7841

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Table::store() > Model::prepareTable()

I do nit understand the problem with Created by... For me it works very good.
Did you downloaded recently ?
Coding is now a piece of cake

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

Create New => Run Function 03 Jul 2013 22:44 #7842

Yes, I downloaded it yesterday. I looked at some of the code. It appears that there are checks for the assigned user's ACL permissions and if they are not set a certain way, it changes it to the admin creating the record. I have to go back, edit the record, and change it again. Then it works.
--
Jerry Benton

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

Create New => Run Function 03 Jul 2013 22:47 #7843

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
If you want to execute after store(), then it is still possible.

Create this store() function in the table file. (Same than before)
Write ALL your customs in fork files.

Copy the original function from the Joomla native table class
libraries/table/table.php
public function store($updateNulls = false)
{
  return parent::store($updateNulls);

  // FORK AFTER
}
Coding is now a piece of cake

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

Last edit: by admin. Reason: added return ... in code

Create New => Run Function 03 Jul 2013 22:48 #7844

Ok thank you. I will look at it over the weekend.
--
Jerry Benton

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

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

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started