ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD

April 11, 2011 3:24am

Subscribe [77]
  • #226 / Nov 17, 2011 7:08pm

    aem34

    2 posts

    The latest version solved my problems with uri segmenting. It is now possible to build nested CRUD tables. Thanks!

    hello,

    how did you do the nested CRUD tables please ?

     

  • #227 / Nov 20, 2011 6:57am

    sodhancha

    4 posts

    How do i debug my callback scripts?

    I have a deal_management function which does grocery CRUD

    and i have a
    callback_after_insert( array( $this, ‘insert_coupon_codes’ ) );

    since the insertion in the database is not working in my function insert_coupon_codes i have no way to know or view my SQL.

    ** Is there any function by which i can debug my php scripts inside the callback function without any hacks.

    ** I did print_r() and var_dump() but these do not seem to work inside the callback function.

  • #228 / Nov 20, 2011 9:13am

    web-johnny

    235 posts

    How do i debug my callback scripts?

    I have a deal_management function which does grocery CRUD

    and i have a
    callback_after_insert( array( $this, ‘insert_coupon_codes’ ) );

    since the insertion in the database is not working in my function insert_coupon_codes i have no way to know or view my SQL.

    ** Is there any function by which i can debug my php scripts inside the callback function without any hacks.

    ** I did print_r() and var_dump() but these do not seem to work inside the callback function.

    print_r works fine but you cannot see the result. You have to see it with your firebug because it is a json ajax call.
    Also for debugging without hacking you can always easily have the log_message function of codeigniter. For more you can see at http://ellislab.com/codeigniter/user-guide/general/errors.html#footer

  • #229 / Nov 21, 2011 9:51am

    alexaaaaaaaaaa

    91 posts

    Ok i’m a bit new with this CRUD but here’s my problem

    i use this code

    $crud = new grocery_CRUD();
    
       $crud->set_table('a3m_account_details');
       $crud->columns('fullname','gender','firstname','id');
       $crud->display_as('fullname','Fullname')
         ->display_as('firstname','FName')
         ->display_as('gender','Gender')
         ->display_as('id','Username');
       $crud->set_subject('Customer');
       $crud->set_relation('id','a3m_account','username');
       
       
       $output = $crud->render();
       
       $this->_example_output($output);

    and it’s working ok…but how can i get the email ? the email it’s in the a3m_account table
    can you show me how to get more than one for example get the username and the email.

  • #230 / Nov 22, 2011 10:27am

    ghenesis

    1 posts

    Hello,

    I’ve recently started using grocery_CRUD, great lib. Recently I’m developing a project with grocery_CRUD v1.1.4 and the newest CI 2.1. Today I’ve found out, that something odd is going on while adding/updating html code. Basically TinyMCE is aligning an <img> tag for example using inline code, such as

    style="float:left;"

    so we receive html in this kind:

    <img style="float: right;"

    but after update/add action it is shredded a bit and appears to be

    <img  right;"

    Looks like the fragment

    style="float:</code></pre>
    
    is just cut out for some reason. Same happens to other html tags, like:
    
    <pre><code><p  justify;">

    I’ve tried to trace, where this could happen, but no luck yet. I’ve checked if this is happening before sending POST, but in the POST data it appears ok, so there’s something going on deeper. It’s a quite big issue, so please, help with this one.

    Greetings,

    ghenesis

  • #231 / Nov 24, 2011 5:15pm

    web-johnny

    235 posts

    Hello,

    I’ve recently started using grocery_CRUD, great lib. Recently I’m developing a project with grocery_CRUD v1.1.4 and the newest CI 2.1. Today I’ve found out, that something odd is going on while adding/updating html code. Basically TinyMCE is aligning an <img> tag for example using inline code, such as

    style="float:left;"

    so we receive html in this kind:

    <img style="float: right;"

    but after update/add action it is shredded a bit and appears to be

    <img  right;"

    Looks like the fragment

    style="float:</code></pre>
    
    is just cut out for some reason. Same happens to other html tags, like:
    
    <pre><code><p  justify;">

    I’ve tried to trace, where this could happen, but no luck yet. I’ve checked if this is happening before sending POST, but in the POST data it appears ok, so there’s something going on deeper. It’s a quite big issue, so please, help with this one.

    Greetings,

    ghenesis

    Just for the other users to know the answer is on http://www.grocerycrud.com/forums/topic/25-strange-html-field-behavior/page__view__findpost__p__58

  • #232 / Dec 03, 2011 9:21am

    web-johnny

    235 posts

    Ok i’m a bit new with this CRUD but here’s my problem

    i use this code

    $crud = new grocery_CRUD();
    
       $crud->set_table('a3m_account_details');
       $crud->columns('fullname','gender','firstname','id');
       $crud->display_as('fullname','Fullname')
         ->display_as('firstname','FName')
         ->display_as('gender','Gender')
         ->display_as('id','Username');
       $crud->set_subject('Customer');
       $crud->set_relation('id','a3m_account','username');
       
       
       $output = $crud->render();
       
       $this->_example_output($output);

    and it’s working ok…but how can i get the email ? the email it’s in the a3m_account table
    can you show me how to get more than one for example get the username and the email.

    No you can’t do it right now in this version of grocery CRUD . You can use the set_model thought to return more than one fields. Because many users ask for it probably in the future I will create something like a template control for example:

    $crud->set_relation('id','a3m_account','{first_name} {last_name} ({email})');

    But for now the only way to do it is with set_model . You can see this function with an example at: http://www.grocerycrud.com/crud/function_name/set_model

  • #233 / Dec 04, 2011 3:50am

    sodhancha

    4 posts

    I have 2 tables

    Users Table => id , username
    OrdersTable => order_id,user_id, qty,total
    I need to link these two tables with .

    id and user_id.

    how can i do this with grocery CRUD ?

  • #234 / Dec 04, 2011 4:01am

    alexaaaaaaaaaa

    91 posts

    I have 2 tables

    Users Table => id , username
    OrdersTable => order_id,user_id, qty,total
    I need to link these two tables with .

    id and user_id.

    how can i do this with grocery CRUD ?

    Hi i’ve also tryed that but it seems that it only accepts same id on both tables so change the user_id with id and it should work 100%

  • #235 / Dec 04, 2011 4:34am

    sodhancha

    4 posts

    $this->crud->set_table('coupon_orders');
    $this->crud->set_subject('Orders');
    //Relations
    $this->crud->set_relation('coupon_code_id','coupon_codes','code');
    $this->crud->set_relation('account_id','a3m_account','email');

    How can i get multiple values from the a3m_account table. This only fetches the email

  • #236 / Dec 04, 2011 5:48am

    web-johnny

    235 posts

    $this->crud->set_table('coupon_orders');
    $this->crud->set_subject('Orders');
    //Relations
    $this->crud->set_relation('coupon_code_id','coupon_codes','code');
    $this->crud->set_relation('account_id','a3m_account','email');

    How can i get multiple values from the a3m_account table. This only fetches the email

    I have an answer for this here - http://ellislab.com/forums/viewreply/958817/ .

  • #237 / Dec 07, 2011 2:10am

    serhat

    13 posts

    Is it possible to search between dates? My customer wants to search between 2 dates .

    Is it possible to edit some code or call_back function etc?

    Maybe he can just write like 12-5 & 12-20 or choose from fields.

  • #238 / Dec 07, 2011 6:36pm

    web-johnny

    235 posts

    Is it possible to search between dates? My customer wants to search between 2 dates .

    Is it possible to edit some code or call_back function etc?

    Maybe he can just write like 12-5 & 12-20 or choose from fields.

    For now on, no you cannot. It is just a simple search without start and end. I have it in mind though to have something like 12/11/2011 - 24/11/2011 in the future or something similar. I also want to create filtering for numbers for example 10-22 . It is a good idea.

  • #239 / Dec 09, 2011 8:32am

    fabgonber

    15 posts

    Hi,

    Two things:
    a) a bug in documentation
    look in http://www.grocerycrud.com/crud/function_name/edit_fields says “The fields that user will see on *add* operation” and must say: “The fields that user will see on *edit* operation”

    b) I need make a backup before make a change…

    my tables:

    table person(person_id,name,phone,...);
    table person_backup(person_id,name,phone,...);

    in my_model:

    function backup_person_before_update($person_id) {
            $sql = "insert into() person_backup 
                           select * from person where person_id=$person_id";
            $this->db->query($sql);
    }


    i want:
    call my_model->backup_person_before_update($person_id) after the user clicks in the
    [UPDATE CHANGES] button, but before grocery_crud make the change in the database.

    Regards,
    Fabián

     

     

  • #240 / Dec 09, 2011 3:10pm

    web-johnny

    235 posts

    Hi,

    Two things:
    a) a bug in documentation
    look in http://www.grocerycrud.com/crud/function_name/edit_fields says “The fields that user will see on *add* operation” and must say: “The fields that user will see on *edit* operation”

    b) I need make a backup before make a change…

    my tables:

    table person(person_id,name,phone,...);
    table person_backup(person_id,name,phone,...);

    in my_model:

    function backup_person_before_update($person_id) {
            $sql = "insert into() person_backup 
                           select * from person where person_id=$person_id";
            $this->db->query($sql);
    }


    i want:
    call my_model->backup_person_before_update($person_id) after the user clicks in the
    [UPDATE CHANGES] button, but before grocery_crud make the change in the database.

    Regards,
    Fabián

     

     

     

    a) Thanks, I have change it

    b) This is pretty simple. You can use the callback_before_update . Works similar with the callback_before_insert ( see http://www.grocerycrud.com/crud/example/callback_before_insert ). The only difference is that you also have a second parameter that includes the primary key . So in your case you will have something like this:

    function example_callback_before_edit($post_array, $primary_key)
    {
    $this->load->model('Your_model');
    $this->Your_model->backup_person_before_update($primary_key);
    
    return $post_array;
    }

     

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases