Nishith Nesdiya Posted May 6, 2013 Share Posted May 6, 2013 hi friends i am new prestashop developer, i create a my own fields in shopping-cart.tpl file with mymodues. how can i add the new custom fields and shopping-cart.tpl file is override in mymodules? which controller is override CartController/Cart.php ? mymudules is the custom modules when install the the mymodules the custom fields is add shopping-cart.php file. Link to comment Share on other sites More sharing options...
benjamin utterback Posted May 6, 2013 Share Posted May 6, 2013 Hi, I'll move this to the development section of the forum, you'll find better answers there. Thanks! Link to comment Share on other sites More sharing options...
vekia Posted May 6, 2013 Share Posted May 6, 2013 about overriding you can read in official prestashop documentation: http://doc.prestashop.com/display/PS15/Overriding+default+behaviors read it - it is very helpfull in this case Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted May 7, 2013 Author Share Posted May 7, 2013 (edited) hi vekia thanks for your answer, i overide the class Cart.php like as class Cart extends CartCore { public function getmyfunction() { $test = $this->getOrderTotal()/10; $test1=$this->getOrderTotal()/20; return array( 'test'=>$test, 'test1'=>$test1, ); } } but when i call the shopping-tpl file in varable <tr class="cart_total_tax"> <td colspan="5">{l s='Test:'}</td> <td colspan="2" class="price" id="total_tax">{displayPrice price=$test}</td> </tr> it display the this type of error Notice: Undefined index: test in C:\wamp\www\prestashop\cache\smarty\compile\4612f8c1d544f1222ebdf30000632e86430430e9.file.shopping-cart.tpl.php on line 388 Edited May 8, 2013 by Nishith Nesdiya (see edit history) Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted May 8, 2013 Author Share Posted May 8, 2013 Any one help me above solution....... Link to comment Share on other sites More sharing options...
vekia Posted May 8, 2013 Share Posted May 8, 2013 but what is getmyfunction() ? you need to include variables to the smarty, and in the code you pasted i don't see any smarty arrays /etc Link to comment Share on other sites More sharing options...
Paul C Posted May 8, 2013 Share Posted May 8, 2013 I'm not sure I understand what you're trying to do either so can't say if overriding the Cart object is in fact what you should be doing. - Do you need to store the extra information in the database or is it generated/calculated from existing data? - Is the information used at any time other than during checkout? - How is the information set? Where/when would you modify the cart object to add the information? Paul Link to comment Share on other sites More sharing options...
Nishith Nesdiya Posted May 9, 2013 Author Share Posted May 9, 2013 (edited) thanks,Paul for you joining.. can i shopping-cart.tpl file is override in mycustom modules? which plase can put shopping-cart.tpl file in my modules? Edited May 9, 2013 by Nishith Nesdiya (see edit history) Link to comment Share on other sites More sharing options...
awdhesh Posted June 10, 2015 Share Posted June 10, 2015 i have faced same problem i have create a module and hook on order carrier page that module add a insurance value in the cart total but problem is that i m not showing insurance price on order payment tpl file and total is actually show. please help me ......... Notice: Undefined index: insurance_cart in /home/sparxmgnt/public-html/awdhesh/prestashop/tools/smarty/sysplugins/smarty_internal_templatebase.php(171) : eval()'d code on line 239 Notice: Trying to get property of non-object in /home/sparxmgnt/public-html/awdhesh/prestashop/tools/smarty/sysplugins/smarty_internal_templatebase.php(171) : eval()'d code on line 239 Link to comment Share on other sites More sharing options...
kirubanidhi Posted August 3, 2017 Share Posted August 3, 2017 (edited) I want to add company/organization field in shopping_cart.tpl. If the customer company name already exists just print the company name in that field. The customer company name does not exist, We add the company name that field in shopping_cart.tpl. I create new company name in shopping_cart.tpl. how to store the new company name to identity.tpl file. How can I do that? I attached my screenshoot. What do i want. Shopping_cart.tpl file image link https://ibb.co/d3eMGa Identity.tpl file image link https://ibb.co/bGnrGa Edited August 3, 2017 by kirubanidhi (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now