Manik Posted October 28, 2013 Share Posted October 28, 2013 Hi, I am developing a plugin for cubecart admin panel.In that am using ajax to store some details through database.I have included the admin core files but still its not stored in database. can anyone know, what are all the exact files needed to be included in custom php file to access all the functions of an admin panel? Here is my code. I have tried like this. but its not allowing me to perform db operations.can any one help me please.am new to cubecart. <?php include '../../../../ini.inc.php'; include '../../../../includes/global.inc.php'; include '../../../../includes/functions.inc.php'; include '../../../../classes/db/database.class.php'; include '../../../../controllers/controller.admin.pre_session.inc.php'; $action=$_POST['action']; $data=array( 'color'=>$_POST['colorname'], 'colorcode'=>$_POST['colorcode'], ); $res=Database::getInstance()->insert('abc', $data); $GLOBALS['db']->insert('abc',$data) Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted October 29, 2013 Share Posted October 29, 2013 Hi Manik, I think you need to totally rethink. Have a good read of this.. https://support.cubecart.com/index.php?/Knowledgebase/Article/View/203/46/how-can-i-create-a-plugin-using-the-code-hooks-system-in-cubecart-v5 Let us know if you have any questions. Quote Link to comment Share on other sites More sharing options...
Manik Posted October 29, 2013 Author Share Posted October 29, 2013 Hi Staff, Thanks For your reply. I already viewed that article. But I want to do some operations in admin panel dynamically as same as when we try to add or remove zones in for plugin.I am trying to create a form in my plugin and want to submit and update the page using jquery and ajax.In my ajax file, it needs some configuration files included it.this is what am trying. I have a form like add zone. if i click that, it will open a form and when i save, it has to add in admin panel and also insert in db as well. for inserting into db, I need some files to be included in my ajax file. I am new to cubecart. I don't know much about core ffiles. please help me. Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted October 29, 2013 Share Posted October 29, 2013 You can still do this with a plugin. Honestly its the best way as the store can be upgraded to the latest version without affecting the plugin. The route you are trying to take right now is complex and has a lot of room for errors. You'll see that there are a number of plugin hooks already. If you need to add more hooks to the core code of CubeCart please feel free, lets us know what ones you have added and so long as they are not in code loops we will add them to the next release. Quote Link to comment Share on other sites More sharing options...
Manik Posted October 29, 2013 Author Share Posted October 29, 2013 Okay. can you give me a little example. I have a form in plugin, and i want to submit that to database.I don't know how to do this? so only I tried to do this using ajax. If you give me a example code to submit in plugin form itself and i will understand easily. I don't know much about hooks also, please guide me. Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted October 29, 2013 Share Posted October 29, 2013 We'd probably need a bit more information than that. Quote Link to comment Share on other sites More sharing options...
Manik Posted October 29, 2013 Author Share Posted October 29, 2013 what kind of information you need ? I am developing plugin. In that plugin I have form in tpl file. I need to submit that form to database.This is what I want. Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted October 29, 2013 Share Posted October 29, 2013 Is this form to be submit from the front end of the site or the admin side? We have front end instructions here: https://support.cubecart.com/index.php?/Knowledgebase/Article/View/208/46/how-do-i-create-a-new-front-end-dynamic-section-or-page-in-cubecart-v5 Quote Link to comment Share on other sites More sharing options...
Manik Posted October 29, 2013 Author Share Posted October 29, 2013 Its submitted from admin panel only. For example, I am going to provide users to enter some text in products (if am selling CAP means, I provide option to users to enter text in front end).In front end I have some limitations, user has to enter only limited char and based on that price also get varies. to configure all this in front end, i need a form should be submitted by admin in admin panel. Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted October 29, 2013 Share Posted October 29, 2013 Ok in that case its all explained here: https://support.cubecart.com/index.php?/Knowledgebase/Article/View/203/46/how-can-i-create-a-plugin-using-the-code-hooks-system-in-cubecart-v5 It explains how to add an extra item to the navigation menu and get it loading a custom section in the admin CP. Why don't you use the example code and adapt it to your needs? Quote Link to comment Share on other sites More sharing options...
Manik Posted October 29, 2013 Author Share Posted October 29, 2013 Its giving a idea about, developing a simple plugin.I read this article, based on this only am developing.but in this article, they didn't mention about submitting a form from tpl file.In the example visitor status plugin, the have textboxes and that submitted to database. but that data's are stored in configuration table.I want that form details should stored in custom tables.Tell me where can I able to get the post values in that form? I am asking about which file I need to edit and which hook I have to use? please guide me. Its little bit complicated. I want to add a form in my plugin tpl file like this, http://www.amitpatil.me/demos/adding-removing-rows-in-table-dynamically/# It should added to database and also dynamically added in that plugin tpl file as well... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.