Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Location
  • Activity

pl.sabotinov's Achievements

  1. Hello razaro, and thanks for your answer. Yes i want it to do some additional action when contact form is submitted. So i will put it in the postProcess() function. As i thougth. But i will keep it's declaration separate, out of the postProcess() function and will call it only in postProcess(). So should be the best way, am i right?
  2. Hello, I am using prestashop version and would like to ask the following as I am not completely sure how to do it correctly: I am overriding the ContactController.php and exactly the functions postProcess() and initContent(): class ContactController extends ContactControllerCore { /** * Start forms process * @see FrontController::postProcess() */ public function postProcess() { if (Tools::isSubmit('submitMessage')) { ……... …….. } } public function initContent() { parent::initContent(); ……. } public function MyCustomInsert () { ………………………... } } ---------------------------------------- And also have added my custom function - MyCustomInsert() after the other two functions. This is custom function , not presented in original ContactController. But I suppose this function will not be executed, if left just so in this file in overrides, as this function is not present or called in the original file ContactController.php or somewhere else. Or it will? So I am wondering how to call this custom function correctly every time when data is passed to ContactController. The override controller is as usual in override/controllers/front/ContactController.php. So what is the best way to call this function; 1. To put it in one of the another two functions so the custom function will be executed when for example the postProcess() function is called. 2. Or to put a call in initContent() function for execution during initialization 3. Of course I can insert the code of the custom function in postProcess() and so it will execute also this action as a part of it. But I think all of these solutions are not good. So what would be the best way to call and execute this custom function, when this overridden controller is called. I can not move this custom function in another file. What is the best solution? Thanks in advance.
  3. Hello everybody, i am using prestashop and today i have decided to bulk import some attributes of existing products in my store. I also want to use the existing attributes in my shop and add only some new values to the selected products. But when i use the csv combinations import of prestashop, each time i make an import, prestashop does create a new attribute with the values i have written. I have tried giving the exact position of the existing attribute or without giving any position and type of the attribute, but anyway prestashop everytime does create new attribute with new values, which i do not want. So is it possible to import only values to existing attributes for given product by its ID? Can some one explain me how to proceed. Thanks in advance.
  4. Hello Gabdara, yes but some fields like attribute and value are required. So if i try to update only some products with already available attribute values , prestashop ( in my case) does create new attribute/s and new values for the new attributes and does not uses the already available attributes, as i want. So is it possible to update a product with new or attributes at all without creating new attributes and values, but with using thees already made in the database. As far as ia have tried till now it is not possible even if i put the exact position of the available attribute. Do you know what the solution is?
  5. Still nobody? Moderators could help or send some link if there is similair theme elsewhere. Cause i couldn't find info regrding this.
  6. Hello everybody, i am trying to make the dni (identification number) not mandatory for the countries where is enabled. The purpose is to allow for recording either empty values or valid values only. So changing the code of the address.tpl i managed to show the text field and it is not mandatory, so it can be left not filled in. But when i post i real value inside, the record is not send to database and it is not recorded. So i have decided to make it another way. I have made one custom additional public function in the Tools.php file that checks the value of the field dni, only if it is not empty: public static function getIdentValue($key, $default_value = false) { if (strval($key) != null && !empty($key) && strval($key) != '') { $ret = (isset($_POST[$key]) ? $_POST[$key] : (isset($_GET[$key]) ? $_GET[$key] : $default_value)); if (is_string($ret) === true) $ret = urldecode(preg_replace('/((\%5C0+)|(\%00+))/i', '', urlencode($ret))); return !is_string($ret)? $ret : stripslashes($ret); } else{ return true; } and also changed the code inside AdminAdressesControler to make the check of the value through this custom function in Tools: if (Country::isNeedDniByCountryId(Tools::getValue('id_country')) && !Tools::getIdentValue('dni')) $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.'); But still the check is not successful and if i left the field empty, an error is raised and does not allow me to save empty value in the db. Even after clearing the cache - deleting class_index. Same result. So i have decided after all to skip the logic of dni empty value check directly before this check in Tools.php and have added additional emtpy value check directly before the Tools check in the AdminAdressesControler. So here is like it looks like: if (Country::isNeedDniByCountryId(Tools::getValue('id_country'))) if ((strval('dni') != '') && (strval('dni') != null)) { if (!Tools::getValue('dni')) $this->errors[] = Tools::displayError('The identification number is incorrect or has already been used.'); } So it should avoid the check from the Tools::getValue function if the field 'dni' is empty. But actually it does check it and an empty field could not be recorded. So i have made a change in the message error : "The identification number is incorrect or has already been used" raised by this function, so i can see where the message is raised from. Surprisingly the message error when i have tried to save an empty dni field didn't change. the controller in in override/controlers/admin, so i have deleted the cache, but still the same result. So it means that there is also another function that checks the field dni and i do not know where it is. Can you please inform me how can i make this field enabled for unique dni numbers and empty values also. I have check the table in the database, where the field dni is allowed to be null, or whatever - it is even not unique field.
  7. Hello everybody, I have searched for the solution for few hours, but didn't find the right one for me, therefore decided to ask the community for my case. (Had really no time left for more search) So I have made a template in the layered navigation block, which template has worked fine for some time and has shown all the selected indexes in the left navigation panel. I have selected all attributes + price of the items, and exclude the stock availability, condition and weight. But today I have seen that except them, the panel shows all the indexes including weight, condition and stock availability. I have tried modifying, making a new template, but still the same result. All the indexes are shown, though that there are not all selected in the template. I have read similar topics and noticed that the Friendly URL option in BO has also the warning: URL rewriting (mod_rewrite) is not active in your server.... So I asked the hosting provider and they informed me that actually this option is active by default on their servers. I also have cleared the cache, changed the permissions of the htaccess file to 666, reset and re-enabled the module, but still there is no change of the functionality and all the indexes are shown. So my question is how to enable the mod-rewriting in prestashop (where is the actual reason) and make my navigation layered module work accordingly to the template.
  8. Thanks Pascal, i have modified the pagination in the files you have mentioned. The pagination is adjusted with my new options. So i will know where to adjust it also for the future.
  9. Hello, in the backend in catalog->products i would like to change the products count per page options. I have looked for some time for the tpl file displaying the product list in backend, but couldn't find it. Would you please help me, by pointing me to the tpl or other file, where i can change the display options for the product list. I want to make the options 50/100/300/600 for example insted of 20/50/100/300. Prestashop if it matters.
  10. Hello everybody, i am using ps ver. For my colleagues, which will insert and process the products in the Back office, i would like to allow them to force the id of the new inserted product. I mean i should give them an option to insert in the Catalog>Products>Information tab a custom id of the new product, which will be actually the id of this product in the database of our ERP system, so there is no risk of duplicating (as all the id's will be synchronized). I know how to do this (by csv import or by sql statement in the database), but they will not have this access. So after i import all of the products with proper id, i should give them an option to do that also for any new product, which they will insert through the ps module for inserting. So i will have to add a textbox for custom id and also to change the code for using the value of this textbox during the statement for inserting this new product. I think there is no problem to do this. I just need to know which files i need to change for achieving this result. Does anybody knows which files should be considered for this task. This will save me a lot of time for searching through the files. Thanks in advance.
  11. Hello everybody, ( i am using ver. i have read the topic and would like to ask few questions the presta team members regarding this new version. 1. Is this version going to support the work with 3 decimal places of the values for single price and also for additional shipping costs(it is important for me)? 2. And if the version is going to support this, how will be solved the issue with the paypal module. I mean the paypal module (3.6.6) does require amounts with two decimal places. If the decimal places are more it returns error reports for invalid arguments(even if they are rounded to the second): row, total... So i suppose the paypal module should be modified to a new version for accepting this format of the numbers or the numbers should be formated before sending to it. So a new version is required. Are you going to make it. Or there is another option? I am trying at the moment to do this, by changing the hardcode of the paypal files in paypal module for my version of presta. I have started also a topic for this issue: Sending 3 decimal places amount to Paypal moduleSo here comes my third question connected: 3. Is it possible to override the files in the modules/paypal/expresscheckout(sumbit.php, payment.php, process.php) in presta So thus if i manage to find the solution it will be still possible to update the version in the future. I am asking it, because as far as i have read the convention for overriding - not all modules could be overriden in prestashop 1.5. Therefore if these files actually can not be, it is better for me to wait for the new version, and if this new version works with 3 decimal places and also Paypal does, to update my store and work with the new version, where the issue with 3 decimal places will be solved. So should i try further to change the code of the paypal files, or if they can not be overriden, it is better to wait for the update? Excuse me if i haven't asked something correctly but as a newbie in prestashop, not all the functionality is completely clear to me at the moment? regards,
  12. Hello again, as far as i can see not all modules could be overidden in prestashop. Is it valid also for the paypal module or part of it : paypal.php ; submit.php and other files in the modules/paypal folder? I am asking as i can not see this module in the appropriate folder as given in the prestashop docs: /themes/my_theme/modules/my_module/views/templates/front/my_module.tpl ...
  13. Hello El Patron, was busy last two days and couldn't answer. Regarding the Pesso format of the currency, i have read some of your posts and suppose you mean this currency format: 0,000.00X. The problem is that i have made a script for updating all of my prices in the online store automaticly from the prices in the ERP system. The format there is actually another : 000.00. So it is difficult to change the format, because i do need this function, as it saves a lot of time.(Though as i think it might be preadjusted) So i will need to find the code in the paypal module, where the api sends the info with the numbers to paypal.
  14. Hello everybody, My prestashop is and paypal module is 3.6.6. I have noticed that working only with two decimal places in prestashop causes incorrect computing of the prices. This is especially a problem when working with low value single prices. For example i have price of single piece - 0.12 Eu, and would like to add specific price rule for amount over 500 pcs. So i want to add a discount for this amount -40%. Thus the correct price with the discount should be 0.072 Eu. But because of working with two decimals presta rounds this single price to 0.07Eu. So if a customer orders 500 pcs x 0.07 = 35Eu, instead of 500*0.072 = 36Eu. I think i found the way to work properly with 3 decimal places so i have achieved a proper computing of the single prices and the end price. But here had appeared a new problem with the paypal module. It does not accept values with three decimals and returns errors: 10401, 10412, 10413, 10427. So i have decided to round the endvalues of the cart rows and the total value in the cart. So instead of sending to Paypal the amount for example: 35.953 i have managed to send this amount rounded to the 2nd decimal place - 35.950 Eu. But still i do receive the same error report from Paypal - so the module is working only with 2 decimal places - doesn't matter if the amount is rounded to the 2nd decimal place. If i switch back to wotking with 2 decimal places i do not have any error reports from paypal module. So my question is: Can i adjust the sending of the values to paypal to be made with rounded 2 decimal places amounts.And if it is possible, which files should i override. I have looked for it in the Paypal.php, but think could not fiond such a place or code to modify if for having this result. It seems that everything depends on the _PS_PRICE_DISPLAY_PRECISION_ definition. Or i could not understand all the code in this module. So please if somebody can answer me, if it is possible to work with 3 decimal places, but to send to the paypal module the total row amount and total amount from cart using only 2 decimal places. (Rounded [converted to 2 decimal places] end value of the price). Thanks in advance and kind regards,
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More