Jump to content

create a new fields in shopping cart file

Recommended Posts

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

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;

	return array(



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>

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 by Nishith Nesdiya (see edit history)
Link to comment
Share on other sites

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?



Link to comment
Share on other sites

  • 2 years later...

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

  • 2 years later...

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.

  1. Shopping_cart.tpl file image link



  1. Identity.tpl file image link


Edited by kirubanidhi (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...