Search the Community
Showing results for tags 'Field'.
-
-
Hi everyone, I don't found a module for my need, and I would like make a custom modify. I don't know how to do, please anyone can help me, I do a discounts with voucher on cart rules. I make vouchers with percentage discount for some products, for X minimal total cart value. Example: Product A cost € 10, I make a voucher for Product A with 10% of discount, if minimum cart value is € 30. I need to show this voucher rules to customers, on product page and product tabs. I need to show: -"voucher description field" where i have writed 'If you spend €30 ' -"price product discounted" applicated with voucher I attach 2 images of my idea. I hope someone can help me, because I don't know how to show my voucher discounts to customers. Thanks
-
Hello everybody, Presta 1.7.7.5 i am newbie in creating modules, but still have decided to solve one small problem by creating a very simple module, which adds 2 fields in the carrrier / checkout step. These fields are saved in the ps_orders table and will be used and displayed on the new order mail template. But the problem is that i can not display the two input text fields in the carrier step of FO. So i can not fill the fields with information. Here the code of my main class: Full text is attached below as text file as cloudflare blocks the post with code even in code tags I am using the hookdisplayAfterCarrier - to display the text fields there. But in the FrontOffice at the position where these text fields should be displayed i receive only: Array And in console the html generated is: in text file also below So the example where i have taken the code this definition is put in constructor in the override of class. But i do not want to make this override. Should i put this definition in constructor of my main class also? Would you help me please to display these fields in FO. I hope the other part of the code is correct. What concerns the database - the fields are added there. They are in orders table, when i install module. new_topic_module.docx
-
Hi. How to make existing field to be required? I checked Localization/Country but I can't or don't know how to make it required. I'm trying to bypass hard-coding if possible, to not scramble my project. Thanks for replies.
-
Hi, I want to add a new checkbox in the product tab that will be called product_unchecked in Prestashop 1.7.8.3. My problem is that when I check the checkbox and hit save no error appears, but when I refresh the product tab again, the checkbox is unchecked and in the database does not change the value to 1. I have seen several tutorials but I can't find the solution, as they are quite old. These are the steps I have followed, I attach screenshots to see if a solution can be found. 1.- Add field in the database 2.- I create the file product.php in override/classes/Product.php <?php public $producto_descatalogado ; public function __construct ( $id_product = null , $full = false , $id_lang = null , $id_shop = null , Context $context = null ) { self::$definition['fields']['producto_descatalogado'] = array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'); } ?> 3.- I add the following lines in src/PrestaShopBundle/Form/Admin/Product/ProductInformation.php ->add('producto_descatalogado', FormType\CheckboxType::class, [ 'label' => $this->translator->trans('producto descatalogado', [], 'Admin.Global'), 'required' => false, ]) 4.- I add the following lines in src/PrestaShopBundle/Model/Product/AdminModelAdapter.php: private $multiShopKeys = [ [...] 'producto_descatalogado', ]; private $translatableKeys = [ [...] 'producto_descatalogado', ]; private $unmapKeys = [ [...] 'producto_descatalogado', ]; private function mapStep1FromData(Product $product) { [...] 'producto_descatalogado' => $product->producto_descatalogado== 0 ? false : true, ]; } 5.- I add the following lines in src/PrestaShopBundle/Resources/views/Admin/Product/ProductPage/product.html.twig: {# PANEL ESSENTIALS #} {% block product_panel_essentials %} {% set formQuantityShortcut = form.step1.qty_0_shortcut is defined ? form.step1.qty_0_shortcut : null %} {{ include('@Product/ProductPage/Panels/essentials.html.twig', { [...] 'formDescatalogado': form.step1.producto_descatalogado, }) }} {% endblock %} 6. I add the following lines src/PrestaShopBundle/Resources/views/Admin/Product/ProductPage/Panels/essentials.html.twig <div class="form-group mb-4"> <h2>Descatalogado</h2> {{ form_widget(formDescatalogado) }} </div> Attached is a screenshot of the product sheet with the checkbox That's all, thank you.
-
Hi again community. I managed to make my own custom field for the checkout form, specially to the section Delivery Address. I did this: 1 - I added my custom field to the DB into the Address table. 2 - I modified the CustomerFormatterAddress file to display my custom field: $format['custom_final_customer'] = (new FormField) ->setName('custom_final_customer') ->setType('checkbox') ->setLabel( $this->translator->trans( 'I want my invoice as End Consumer', [], 'Shop.Forms.Labels' ) ); 3 - I modified the Address model file: //Custom Fields public $custom_final_customer = 0; 'other' => array('type' => self::TYPE_STRING, 'validate' => 'isMessage', 'size' => 300), 'phone' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'phone_mobile' => array('type' => self::TYPE_STRING, 'validate' => 'isPhoneNumber', 'size' => 32), 'dni' => array('type' => self::TYPE_STRING, 'validate' => 'isDniLite', 'size' => 16), 'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'copy_post' => false), 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), //Custom fields 'custom_final_customer' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool') My field is displaying correctly in the front office: But two things: 1 - I don't know when even start to make that field into de position/order I want in that form. 2 - I assumed that maybe in BO / Countries / My country / Address Format, I could order my custom field like does the default fields, but nope. While my custom field is properly listed in the Address section inside the Address Format fields to add, my front office looks even worst: The final result: Thanks in advance.
-
I noticed that there isn't a way to delate or reset the field of product-customization.tpl I thought to add something like this in the product-customization.tpl, but it doesn't work (nothing happens). Any suggestions? <div class="clearfix"> <button class="btn btn-primary float-xs-right" type="submit" name="submitCustomizedData">{l s='Save Customization' d='Shop.Theme.Actions'}</button> <button class="button btn btn-default button button-small" name="resetCustomization" value="1"> <span>{l s='Reset customization'}</span> </button> </div>
- 1 reply
-
- 1
-
- 1.7.5.1
- product-customization
-
(and 1 more)
Tagged with:
-
Hi everyone, I am trying to create a file type field in the registration form of my prestashop. I have already created the field and I can attach a pdf, the problem I have is that I cannot save this file on the server, and in the database the name of the file is saved, but not the path, since it does not exist not being saved on the server. Does anyone know how I can save the path of the file that I want to upload and how to save it in a folder on the server. I attached some screenshots showing the development. Thank you very much, I wait for your help!
-
Hi. I just want to add new field in registration form. That field will be filled with phone or mobile phone number. I'm using Prestashop 1.7.2.4. Can I apply this simply for guest and user? Is it possible through module? Thanks for replies.
-
Hi Prestashop Gurus, I would like to include numerical characters in the Last Name field, during registration (which is currently blocked for any characters other than alphabetics) Anyone has any idea? Many Thanks Ian
- 10 replies
-
- field
- registration
-
(and 1 more)
Tagged with:
-
Hi, I have a Prestashop 1.7.6.3 and I want to block the description_short field when creating or updating products via webservice Can you help me , please ?
-
- webservice
- field
-
(and 1 more)
Tagged with:
-
Hola a todos! Comento mi situación: Hace unos meses instalé prestashop 1.7.6 para crear mi tienda online. Después de realizar las configuraciones, activé el modo B2B y traducí los campos SIRET y APE a DNI y CNAE (datos fiscales en España) e importé los datos de mis clientes. Hasta aquí todo funciona correctamente, el problema viene cuando quiero modificar cualquier campo del cliente, ya que Prestashop detecta el DNI como inválido y no puedo guardar cualquier dato que haya cambiado en la ficha de cliente. Tras visitar varios posts en diferentes foros, he anulado el validador que se encuentra dentro de Classes/Validate.php devolviendo true al final de las funciones isSiret y isApe: /** * Validate SIRET Code. * * @param string $siret SIRET Code * * @return bool Return true if is valid */ public static function isSiret($siret) { return true; } /** * Validate APE Code. * * @param string $ape APE Code * * @return bool Return true if is valid */ public static function isApe($ape) { return (bool) preg_match('/^[+0-9. ()-]*$/', $ape); } Esto lamentablemente, no solucionó mi problema, así que encontré este POST: https://www.prestashop.com/forums/topic/350955-property-customer-siret-is-not-valid/ En el que borran y regeneran los campos en la tabla de clientes de prestashop. También he realizado este paso, y sigo teniendo el problema. No se a qué se debe este problema y como solucionarlo, pero necesito poder guardar estos datos para sincronizar mi ERP con prestashop. Dejo adjunta una imagen con un cliente real para que veáis a que me refiero. Gracias de antemano, toda la ayuda es bienvenida. ¡Feliz año nuevo!
-
Ciao a tutti, come faccio a far comparire il campo alias quando si inserisce l'indirizzo durante la fase di checkout?
-
Hi im new to Prestahop and hope to find some answers. On the product page I used the customization field to have a customer upload a photos and a comment. I want to move that custom block under the attribute fields instead of above as it is the default. In product.tpl {if $product.is_customizable && count($product.customizations.fields)} {block name='product_customization'} {include file="catalog/_partials/product-customization.tpl" customizations=$product.customizations} {/block} {/if} <div class="product-actions"> {block name='product_buy'} <form action="{$urls.pages.cart}" method="post" id="add-to-cart-or-refresh"> <input type="hidden" name="token" value="{$static_token}"> <input type="hidden" name="id_product" value="{$product.id}" id="product_page_product_id"> <input type="hidden" name="id_customization" value="{$product.id_customization}" id="product_customization_id"> {block name='product_variants'} {include file='catalog/_partials/product-variants.tpl'} {/block} and I moved {if $product.is_customizable && count($product.customizations.fields)} {block name='product_customization'} {include file="catalog/_partials/product-customization.tpl" customizations=$product.customizations} {/block} {/if} to the bottom outside the form. Which gives me the correct layout on the page. But when selecting an attribute on the product page the URL does not update and refresh back to its previous default. I know its a form issue but not sure how to resolve it. Thanks.
- 11 replies
-
- customization
- field
-
(and 3 more)
Tagged with:
-
How to change the order of fields for customer registration form (Tested with v1.7+) Simply change the order in the following class (Override class is recommended) classes/form/CustomerFormatter.php public function getFormat() { $format = []; //#1 field $format['id_customer'] = (new FormField()) ->setName('id_customer') ->setType('hidden'); //#2 field $genders = Gender::getGenders($this->language->id); if ($genders->count() > 0) { $genderField = (new FormField()) ->setName('id_gender') ->setType('radio-buttons') ->setLabel( $this->translator->trans( 'Social title', [], 'Shop.Forms.Labels' ) ); foreach ($genders as $gender) { $genderField->addAvailableValue($gender->id, $gender->name); } $format[$genderField->getName()] = $genderField; } //#3 field $format['firstname'] = (new FormField()) ->setName('firstname') ->setLabel( $this->translator->trans( 'First name', [], 'Shop.Forms.Labels' ) ) ->setRequired(true); //#4 field $format['lastname'] = (new FormField()) ->setName('lastname') ->setLabel( $this->translator->trans( 'Last name', [], 'Shop.Forms.Labels' ) ) ->setRequired(true); For example if lastname should be displayed before firstname move code $format['lastname']... before $format['firstname']... //#3 field $format['lastname'] = (new FormField()) ->setName('lastname') ->setLabel( $this->translator->trans( 'Last name', [], 'Shop.Forms.Labels' ) ) ->setRequired(true); //#4 field $format['firstname'] = (new FormField()) ->setName('firstname') ->setLabel( $this->translator->trans( 'First name', [], 'Shop.Forms.Labels' ) ) ->setRequired(true);
-
Hello eveybody i am presently working on ps1.7.6 and i am facing 2 issues i can't solve : 1st) i have few items unavailable for the moment that i want to keep visible by customers the thing is that in addiction to the non-clickable "add to cart" button it necessary needs a text informing that the product is not in stock for the moment it's like this i'd like to change this 'out-of-stock' text and i can't succeed in finding it in International > Translations > Theme could you please tell me where to find this field ? Moreover, weird thing, on my french language, there is no message at all ! do you know if i could fulfill a message somewhere ? 2nd) concerning price, i have 'tax included' [ and TTC in french] below the price and once again i can't find where to erase it. i tried to put blank field in International > Translations > Theme, but nothing changed... if anyone could give me a clue thanks a lot in advance keep safe
-
Hello! I represent a team of a developer and a content manager. We are using PrestaShop v1.7.4.4 to develop and support a shop for a client. The context My goal currently is adding a custom field to the customer registration form. Customer should be able to fill the form as usual with option to specify their phone number. The phone should be saved somewhere in the database, preferably in it's own table with a key pointing to a row in customers table. I'd also like to see that information in the back office somewhere. There seem to be a couple modules I found that would work for this purpose. Registration Fields Custom Fields Module Both of them are priced the same (€39). That's pretty expensive for us as we've bought an entire theme for this shop and it costed us €70 already, as a developer I'd rather write my own module. The first one comes from a website I'm not sure I can trust, second seems to be the official prestashop addons marketplace, but the compatibility goes up to prestashop v1.6.1.23. So another option would be to use a quick solution like modifying the core file as described in this tutorial ADDITIONAL FIELDS FOR REGISTRATION FORM PRESTASHOP 1.7 I will probably take this route as the last resort. So far my choice is to create a module for this purpose, and I've had some progress with this. What I did Used module generator as described in the docs Modules > Getting started this provided me with a working module template I could upload to the shop and see in the module list, nice starting point! Added 'additionalCustomerFormFields' hook to display my new field in the form another successful step, the field is displayed as expected Added 'validateCustomerFormFields' hook to validate it using ->addError method results in visible error on the form so it's working too The issue Next thing I tried was using 'actionCustomerAccountAdd' hook to acquire the new customer and save into database the field information provided. According to the docs at List of hooks, 'actionCustomerAccountAdd' hook should give the following array as a parameter array( '_POST' => (array) $_POST, 'newCustomer' => (object) Customer object ); Again, according to aforementioned docs this hook should be triggered in /classes/form/CustomerPersister.php when I check the file however it only seems to provide the 'newCustomer', but no '_POST' Hook::exec('actionCustomerAccountAdd', array( 'newCustomer' => $customer, )); logging the argument I get in my hookActionCustomerAccountAdd method gives me an array with following members: newCustomer, cookie, cart, and altern. That's surprisingly more than what 'create' method in 'CustomerPersister.php' provides, but there is no '_POST' that I can see anyway. here is body of the function I use to log public function hookActionCustomerAccountAdd(...$args) { file_put_contents(DIRNAME(__FILE__).'/test_log.txt', var_export($args, true)); } I'm attaching the full output of it for inspection. Current state of things It's cool that my module is able to see the contents of the field at the point of validation, it can also get new customer when it's created, but there seems to be no way to get the field and new customer id. If the '_POST' data was provided as described in the docs, I assume that would allow to get the form posed as-is, including my custom field, but that doesn't seem to work. In hopes that both 'validateCustomerFormFields' and 'actionCustomerAccountAdd' hooks are used in the same run I could try to set some sort of global variable just to save the value, but that looks uglier than modifying core files. Another thing I could do is assume the form is valid when the phone is valid (very optimistic guess), precalculate the new user's id from mysql's atoincrement feature and save the phone early, doesn't look like a good solution either. Please tell me of a hook I'm missing or any other methods of getting the value of my custom field after the entire form is considered valid and new user's id is available. test_log.txt
-
Bonjour, J'ai téléchargé un module avec prestashop validator. Mon but est de faire plusieurs choses : 1. Ajouter un champ à la base de donnée - réussi 2. Faire un display de ce champ dans la fiche produit (admin) - c'est la raison de ma question. Je n'arrive pas à récupérer ma variable dans le fichier views/templates/hook/extrafields.tpl 3. Mettre à jour la base de donnée du produit en question lors de la sauvegarde du produit - réussi. Je me suis basé sur ceci : https://github.com/sekourm/custom-field-product-prestashop-1.7/tree/master/amproductfields/amproductfields Une idée du problème ? myproductcustomfield.zip
-
Hello, I want to add 2 fields to product combinations. Someone did it or bought a module for this (free or paid)? I can't use attributes because each product have a different value. Prestashop 1.7 Thanks
- 2 replies
-
- 1.7
- prestashop
-
(and 4 more)
Tagged with:
-
Our site has multiple variants of the same product (eg. 1 pendrive, 8 different colors). So all information of the product is similar for the different variants except for the color. I wanted to upload one product with all details filled in, and make 7 duplicates of it. Everything is copied, but inside the section 'modules' (please see attached video), the texts are not copied, and it is inconvenient to copy the text manually for each variant of the same product. Our site is built on Prestashop version 1.7x I tried to look up for a solution for this but couldn't find any. Is there a workaround or an alternative to fix this issue? details_not_copied.mp4
-
Hi, I'm trying to be able to validate the field ean13, so that there is only one record in the table with a unique code. I think it's the file "AdminProductController.php" in which I have to check. I'm not sure where I put the code when I add a product and get a validation error message like "Ean13 number already exists a record". I have thought something similar to this: 'SELECT id_product FROM' ._DB_PREFIX _. 'Product WHERE ean13 = "'. PSQL ($ ean13). ' Can someone help me? Thank you.
-
Bonjour, je débute en Prestashop, et j'aimerais savoir s'il existe un module (gratuit de préférence mais bon ^^) ou même une façon de faire pour réussir à rajouter des champs produits sur le Back Office ET le Front office (par exemple un champ"Indications" en dessous de "Description" sur la fiche produit. Aussi est-il possible de paramétrer l'import de produit via un tableau Excel pour qu'il reconnaisse ce nouveau champ ? ( rajouter une colonne "Indications" qui remplirait automatiquement le champ "Indications" créé plus haut) Même une partie de solution m'aiderais beaucoup car là je suis vraiment bloqué et j'ai besoin d'intégrer de nouveaux champs dans mon projet ... Merci d'avance !
-
Hello everyone, I'm trying to add the description field from ps_product.attribute to show it on the frontoffice. My theme calls all the color and size attributes from the product_variants.tpl I'd like to add colour description beside the colour radio button. Thanks in advanced for your help.
-
Hello everyone, I'm trying to add the description field from ps_product.attribute to show it on the frontoffice. My theme calls all the color and size attributes from the product_variants.tpl I'd like to add colour description beside the colour radio button. Thanks in advanced for your help.