tebdilikiyafet Posted July 2, 2013 Share Posted July 2, 2013 Hi everybody; I want to ask a basic question about prestashop. A .tpl files use which .php files? for example order-opc-new-account.tpl uses which php file? And how can I learn it for all tpl files? Link to comment Share on other sites More sharing options...
vekia Posted July 2, 2013 Share Posted July 2, 2013 well, in this case there is no simple answer. You should know something about prestashop - how the MVC (model - view - controller) works. Prestashops is based on MVC. It mean that each .tpl file have got own controller. Controllers are located in the /controllers/front directory. in this case you have to check the controllers/front/OrderOpcController.php file Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted July 2, 2013 Author Share Posted July 2, 2013 Okay I will learn. I want to ask this because there is an interesting think in order-opc-new-account.tpl there is two input field and two of them write to same database cell. <input type="text" class="text" name="vat_number" id="vat_number" value="" /> <input type="text" class="text" id="vat_number_invoice" name="vat_number_invoice" value="" /> How can it be? name of input field are different but write to same database cell. ps_address->vat_number Link to comment Share on other sites More sharing options...
vekia Posted July 2, 2013 Share Posted July 2, 2013 but on opc page (when you're ordering something) there is only one field, am I right? Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted July 2, 2013 Author Share Posted July 2, 2013 (edited) No you are wrong. When you check "Please add different invoice address" new form is opened and the vat_number_invoice is here. You can check. Edited July 2, 2013 by tebdilikiyafet (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 2, 2013 Share Posted July 2, 2013 so there is everything okay, with this form you're defining new address, which will be added to ps_address table, and it will be used as an address for invoice (not for delivery) Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted July 2, 2013 Author Share Posted July 2, 2013 Okay but I want to add a custom field for example: vat_place. I derived it from vat_number and copy-pasted all vat_number fields. I configured address.php and address.tpl and it is okay. I can add new address when login. Than I configured order-opc-new-account.tpl. When I create delivery and invoice on opc page, delivery-form works well and save vat_place but invoice form doesn't save vat_place_invoice. I think I should configure a different file for it. Link to comment Share on other sites More sharing options...
tebdilikiyafet Posted July 2, 2013 Author Share Posted July 2, 2013 okay I found the solution. In order-opc.js there is a function "function saveAddress(type)" params += 'vat_number='+encodeURIComponent($('#vat_number'+(type == 'invoice' ? '_invoice' : '')).val())+'&'; makes the magic Link to comment Share on other sites More sharing options...
vekia Posted July 2, 2013 Share Posted July 2, 2013 so, if everything works as you expect i can mark this thread as [solved] thanks for your solution regards Link to comment Share on other sites More sharing options...
Recommended Posts