v 1.3.3 grocery CRUD - an automatic Codeigniter CRUD |
[eluser]WCDi[/eluser]
I just started using grocery CRUD. It's really helpfull! But now I'm stuck. I'm making a simple administration tool for products and some other stuff. I'm working on the product part for now. A product has a brand, a name, and possibly multiple EAN's. I designed my database with a 'product'-table and a 'ean'-table. See the attached screenshot. What I would like now, is to be able to add multiple EAN's while creating a new product. Is there a way to do this with grocery CRUD?
[eluser]fabgonber[/eluser]
WCDI, Grocery Crud haves one limitation, the name of the primary key and the foreign key need be the same. looking two tables of your model: productsId is the pk of products, BUT in productsEans you need rename ProductEanProductId to ProductId. And next you can make the relation with grocery
[eluser]fabgonber[/eluser]
I found a Grocery Crud Bug: If the method has the same name of the controller, the crud not render. Code: class Listas extends CI_Controller { Regards Fabián
[eluser]web-johnny[/eluser]
[quote author="fabgonber" date="1308541577"]I found a Grocery Crud Bug: If the method has the same name of the controller, the crud not render. Code: class Listas extends CI_Controller { Regards Fabián[/quote] Hmmmm yes, I think you're right. I will have it in mind to change it . Thanks Fabián
[eluser]WCDi[/eluser]
[quote author="fabgonber" date="1308429994"]WCDI, Grocery Crud haves one limitation, the name of the primary key and the foreign key need be the same. looking two tables of your model: productsId is the pk of products, BUT in productsEans you need rename ProductEanProductId to ProductId. And next you can make the relation with grocery[/quote] Tnx for your reply. Unfortunately this is no solution to my problem because this does not allow me to select multiple EAN's, but just one ![]() I've got another question. Is there a way to pass some parameters to a callback function? Also, if I use a callback for an edit field (callback_edit_field), is there a way to pre-fill file 'value'-attribute with the corresponding value?
[eluser]fabgonber[/eluser]
[quote author="WCDi" date="1308590256"] Tnx for your reply. Unfortunately this is no solution to my problem because this does not allow me to select multiple EAN's, but just one ![]() [/quote] WCDi, You need study relational models ![]() what do you need to do: a) ¿One Ean has Many Products? b) ¿One Product Has Many Eans? c) ¿Many Eans has Many Products? Look: http://dl.dropbox.com/u/2891468/dibujo_m...cional.png
[eluser]WCDi[/eluser]
[quote author="fabgonber" date="1308593942"]WCDi, You need study relational models ![]() what do you need to do: a) ¿One Ean has Many Products? b) ¿One Product Has Many Eans? c) ¿Many Eans has Many Products? Look: http://dl.dropbox.com/u/2891468/dibujo_m...cional.png[/quote] Option b. I've 'studied' relational models, but to be honest, it has been a while.. A product can have multiple EAN's, and an EAN is unique to a product, so that's option b. I would say that my model is right, or am I missing something? Thanks for your input and help!
[eluser]fabgonber[/eluser]
If it's "B" your model is right BUT you need ProductEanProductId to ProductId. ¿Are you trying select it from product crud? It's easier do it from ean crud: [code] function blah() { $crud = new grocery_CRUD(); $crud->set_table('ean'); $crud->set_relation('product_id','product','product_name'); $crud->render(); } [code] You can make new eans with one product.
[eluser]web-johnny[/eluser]
WCDi I just created an example for the callback_edit_field in http://www.grocerycrud.com/crud/example/...edit_field. You can take two parameters 1- the value of the field and 2- the primary key value. You can view the example to see how it works (press an edit to see it). Also for the options of the callbacks you can see http://www.grocerycrud.com/crud/view/options_functions , I know it might be pure but is something compare to nada
[eluser]dodulz[/eluser]
I'M newbie use grocery CRUD ... it's great plugin for CRUD, but I'Have problem with function set_model in my model I use this code Code: <?php and in controller I use Code: $this->load->library('grocery_Exceptions'); Error in Output : Code: Fatal error: Class 'grocery_Model' not found in C:\XXXX\XXX\application\models\MAsset.php on line 2 How to Fix this problem ? |
Welcome Guest, Not a member yet? Register Sign In |