Search the Community
Showing results for tags 'Custom Field'.
-
Hello, I added a test_field in /src/PrestaShopBundle/Form/Admin/Product/ProductInformation.php public function buildForm(FormBuilderInterface $builder, array $options) { . . . ->add('test_field', TranslateType::class, [ 'type' => FormType\TextType::class, 'constraints' => [ new Assert\Regex([ 'pattern' => '/[<>;=#{}]/', 'match' => false, ]), new Assert\NotBlank(), new Assert\Length(['min' => 3, 'max' => 50]), ], 'options' => [ 'attr' => [ 'placeholder' => $this->translator->trans('Enter your test text', [], 'Admin.Catalog.Feature'), 'class' => 'edit js-edit', 'counter' => 50, ], 'required' => true, ], 'locales' => $this->locales, 'label' => $this->translator->trans('Test field', [], 'Admin.Catalog.Feature'), ]) . . . } defined 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', { . . . 'formTestField': form.step1.test_field, . . . }) }} {% endblock %} and set HTML in /src/PrestaShopBundle/Resources/views/Admin/Product/ProductPage/Panels/essentials.html.twig <div id="test_field" class="mb-3"> <strong>{{ form_label(formTestField) }}</strong> {{ form_widget(formTestField) }} </div> The field is displayed correctly. It's for JS use only - it doesn't write to the database. However, I have a problem with the translation. It should be on the Admin.Catalog.Feature domain but it's not showing in the translation interface. What am I doing wrong? How do I translate the label and placeholder for a newly added field to my language?
-
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 am adding custom field to address by overiding Address class: <?php class Address extends AddressCore { public $extrafield; public function __construct($id_address = null, $id_lang = null) { self::$definition['fields']['extrafield'] = array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64); parent::__construct($id_address, $id_lang); } } Also I have modified the template to add the new input field. This scenario is working in PrestaShop 1.6, new input is saved in database. But in PrestaShop 1.7, the new input is not saved in database. Am I missing something here ? Thanks
-
Hello, I'm using prestashop 1.7.4 and trying to add a custom extra_description and extra_title to the product admin, I followed this comment to get it done, https://www.prestashop.com/forums/topic/606651-prestashop-17-override-of-admin-product/#comment-2549505 except unlike in prestashop 1.7.3 the file "src/PrestaShopBundle/Resources/views/Admin/Product/form.html.twig" so i used the files "/src/PrestaShopBundle/Resources/views/Admin/Product/ProductPage/product.html.twig" and "/src/PrestaShopBundle/Resources/views/Admin/Product/ProductPage/Panelsessentials.html.twig" to make the extra field visible in the product admin. The problem i have is that in the DB the fields values are saved in the default language only (FR) and the fields appears empty in the front end, if i add a random value manualy via DB to the field in (EN) language it shows it in the from even if the English language is not active. How can i solve this ? is there other files to change ?
-
Hi Forum Prestashop 1.6.1.18 I have a SQL request to export all orders with products to csv: SELECT d.id_order AS ID_Registo, o.reference AS ref, os.name AS Estado_Pagamento, o.date_upd AS Data, d.product_name AS Produto, d.product_reference AS Referencia, d.product_quantity AS Quantidade, d.product_price AS Preco_Produto, ai.company AS Matricula, CONCAT_WS( ' ', g.firstname, g.lastname ) AS Nome_Cliente, CONCAT_WS(' ', ad.address1, ad.address2, ad.other, ad.phone, ad.phone_mobile) AS Morada, ad.postcode AS Cod_Postal, ad.city AS Localidade, CONCAT_WS(' ', ai.address1, ai.address2, ai.other) AS Morada, g.email AS Email, ai.phone AS Telefone, ai.phone_mobile AS Telemóvel FROM psha_order_detail d LEFT JOIN psha_orders o ON ( d.id_order = o.id_order ) LEFT JOIN psha_customer g ON ( o.id_customer = g.id_customer ) LEFT JOIN psha_stock_available s ON (d.product_id = s.id_product) LEFT JOIN psha_address ad ON (o.id_address_delivery = ad.id_address) LEFT JOIN psha_address ai ON (o.id_address_invoice = ai.id_address) LEFT JOIN psha_group_lang gl ON ( g.id_default_group = gl.id_group ) LEFT JOIN psha_order_state_lang os ON ( o.current_state = os.id_order_state ) WHERE os.id_lang =1 GROUP BY d.id_order, d.product_name ORDER BY d.id_order DESC But 1 (only) product as a custom field. How can i show it on list/request??
-
Having some issue while saving the value of the custom field added in products edit page (Backoffice). I have done things in following order: 1. Added the custom field (Boolean) in Products table (database). 2. Override the product class and added the definition for the custom field. 3. Added the custom field in the ProductInformation.tpl 4. Added the field in the form.html.twig. Problem: I'm able to see the checkbox on the products edit page from Backoffice. Also, it is not checked as the default value for the field is FALSE. But unable to update the value of the field on Save button. Other things like product name or price are updating properly but the custom field value remains the same. Please help!!!
- 5 replies
-
- product
- custom field
-
(and 1 more)
Tagged with:
-
Hi, I need to add a custom field in the form of the chekout page. I need the field to be saved (checkbox) in the orders table. I have added my input field into the template but do not understand how to recover the value of the checkbox if it is checked or not. I use the version 1.7.2.4 Thank you
-
- save
- custom field
-
(and 2 more)
Tagged with:
-
Hi, My problem is to add a message on product page for product referenced in a new table restrictedproduct. In this table only id_product is present. To do the trick I have adapt (with override) the product class (product.php) like this : added : public $restricted; added in $definition : 'restricted' => array('type' => self::TYPE_STRING, 'shop' => true, 'validate' => 'isString'), adapt the sql : public static function getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category = false, $only_active = false, Context $context = null) { $sql = 'SELECT p.*, product_shop.*, pl.* , m.`name` AS manufacturer_name, s.`name` AS supplier_name, re.id_product As restricted FROM `'._DB_PREFIX_.'product` p '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.Shop::addSqlRestrictionOnLang('pl').') LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) LEFT JOIN `'._DB_PREFIX_.'supplier` s ON (s.`id_supplier` = p.`id_supplier`)'. ($id_category ? 'LEFT JOIN `'._DB_PREFIX_.'category_product` c ON (c.`id_product` = p.`id_product`)' : ''). 'LEFT JOIN `'._DB_PREFIX_.'restrictedproduct` re ON (p.`id_product` = re.`id_product`)'. 'WHERE pl.`id_lang` = '.(int)$id_lang. ($id_category ? ' AND c.`id_category` = '.(int)$id_category : ''). ($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : ''). ($only_active ? ' AND product_shop.`active` = 1' : '').' ORDER BY '.(isset($order_by_prefix) ? pSQL($order_by_prefix).'.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way). ($limit > 0 ? ' LIMIT '.(int)$start.','.(int)$limit : ''); } And in Template product-addtional-info.tpl : <div class="product-additional-info"> {hook h='displayProductAdditionalInfo' product=$product} <p>iciiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii {$product.restricted} </div> I succed to have no error in compilation but Nothing is shown for the id_product that I select in my sql. I think that the selection is for products and not product but I cannot find the function in the class that get an individual product. Can you help me to solve this problem ? Thanks, Jean-Marie
- 4 replies
-
- product
- custom field
-
(and 1 more)
Tagged with:
-
Bonjour à tous, J'aimerai savoir s'il était possible avec Prestashop de faire ceci: Lors d'une commande, après avoir encoder mes informations, je sélectionne dans une liste un nom d'une personne (que l'admin encode au préalable). Ce nom est affiché en back-end pour l'admin pour qu'il puisse savoir quel est le "parrain" derrière la commande. Lors de la validation de la commande, un mail est envoyé à l'acheteur (ça c'est déjà le comportement classique) et aussi à ce parrain (donc il faut lier un nom à une adresse email). Merci de votre aide!
-
I am trying to add several new custom fields that the user can fill out during the registration process, which will then be attached to the ps_customer table with the rest of their information. I have created the new tables in the DB with no problem. If I manually enter values in the DB via phpmyadmin, I am able to get them to show up in the customer view/list and other BO pages, but the functions to add the values through the registration process are not working. I have attempted to follow the instructions at the link below and do believe I did it all exactly as instructed. However, I am getting the same error that the last two people were getting and I can't get the registration process to complete. It gets stuck on "An error occurred while creating your account." http://www.prestashop.com/forums/topic/113300-tutorial-add-custom-field-to-customer-registration-how-you-found-us-store-in-db-display-result-in-admin/ I haven't been able to get any assistance on that thread, so I am making a new one. I also was trying to get the page to output the actual error for troubleshooting, but I can't get that to work either. Can anyone see any fault in those instructions that would cause problems with 1.4.7.3? Maybe something is missing or should be written differently? Any help would be greatly appreciated. Thanks!
-
Buenos días, he añadido un campo nuevo en el apartado de las direcciones y me guarda bien la información, salvo en la página del pedido, si me autentifico y modifico ese campo no me lo guarda, pero sin estar logeado y rellenando el formulario (cliente instantaneo) en esa página si lo hace. ¿Alguien tiene alguna idea de que puede pasar o como arreglarlo? Gracias!!!
-
- address
- custom field
-
(and 2 more)
Tagged with:
-
Hello I'm searching a way to add custom fields to the product page on the back office. I was used this example (which is what i'm looking for) but it is for an old version of prestashop http://strife.pl/2011/12/how-to-add-new-custom-field-in-prestashop/ I found also this example which doesn't help because is not english!! http://www.webbax.ch/2011/06/24/comment-ajouter-un-nouveau-champ-sur-la-fiche-produit-et-dans-le-back-office-prestashop/ Does anyone know how i can do the first url on the newest versions of prestashop? Thank you
- 30 replies
-
- custom field
- prestashop
-
(and 2 more)
Tagged with:
-
Salve, scrivo questa guida in quanto non ho trovato molto sul web e spero sia utile. E' necessaria un minimo di conoscenza con db mysql e classi php. File da modificare: FRONT-END - themes/NOME_TEMA/autentication.tpl - controllers/front/AuthController.php - classes/Customer.php ADMIN - controllers/admin/AdminCustomersController.php STEP 1 – Aggiunta del campo al front end Inserire dove si desidera un campo di input nel file themes/NOME_TEMA/autentication.tpl Esempio: <p class="required text"><input name="vistisu" type="text" id="vistisu" /><label for="vistisu">{l s='Come ci hai conosciuti?'}</label></p> STEP 2 – modifica del controller che esegue la registrazione dell’utente Nel file controllers/front/AuthController.php trovare la funzione: protected function processSubmitLogin() E inserire dopo : $customer = new Customer(); questo codice: $_POST['vistisu'] =Tools::getValue(‘vistisu’); Spiegazione: la funzione processSubmitLogin() crea un utente durante la registrazione, (ricordo che ci sono 2 modi per registrarsi un prestashop: tramite registrazione semplice o durante il checkout). L’oggetto $customer una volta inizializzato dovrà ricevere il parametro del campo che abbiamo creato. Inizializzando una variabile in $_POST attraverso la classe statica Tools con getValue(‘nome_campo_creato’) andiamo a prendere il testo che è stato scritto nell’input box con lo stesso name passato. Ora inseriamo il campo anche per la funzione che crea l’account durante il checkout: troviamo la funzione protected function processSubmitAccount() e inseriamo $customer->vistisu = $_POST[‘vistisu’]; All’interno dell’istruzione: if (!count($this->errors)) Spiegazione: la funzione crea un account durante la fase di checkout. L’istruzione if(!count($this->errors)) verifica che non ci siano errori prima di eseguire la creazione ($customer->add()). L’istruzione che abbiamo inserito andrà a popolare una variabile pubblica della classe customers in modo da registrarla all’interno del database. STEP 3 – Creazione del campo nel DB Eseguiamo questa SQL direttamente dal nostro database: ALTER TABLE `PREFISSO_TBL_customer` ADD `vistisu` VARCHAR( 256 ) Sostituiamo PREFISSO_TBL con il prefisso della nostra tabella e assicuriamoci che il campo creato di default sia NULL. STEP 4 – Creiamo la variabile ‘vistisu’ nella classe Customer Apriamo il file classes/Customer.php e inseriamo subito dopo l’apertura della classe: public $vistisu; poi troviamo la variabile statica: public static $definition = array(…. E aggiungiamogli: 'foundus' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 256), nella posizione esatta dove si trova il campo vistisu che abbiamo creato prima nella tabella (solitamente ultima posizione). Avremo qualcosa del genere: …. 'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), 'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate', 'copy_post' => false), 'vistisu' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 256), ), ); Spiegazione: Aggiungiamo la variabile $vistisu alla classe customers per far si che prenda il valore che inseriamo nell’input di testo da front-end. L’inserimento della stringa nella variabile statica $definition ci permette di andare a scrivere nel DB attraverso una funzione SQL di prestashop. TYPE_STRING indica che è una stringa, ‘isString’ è un controllo per verificare che il contenuto del campo input che abbiamo creato sia una stringa e size=> indica la lunghezza massima che abbiamo definito al campo vistisu nel DB. ULTIMO STEP – Creazione campo nel back end sezione “Clienti” Apriamo il file: Controllers/admin/AdminCustomersController.php Cerchiamo $this->fields_list = array(… Aggiungiamo: ‘vistisu’ => array( 'title' => $this->l('Come ci conosce?'), 'width' => 70, ), Appena dopo una qualsiasi chiusura ), del campo. In questo modo nella tab clienti dell’admin ci apparira la classica tabella con tutti i nomi degli utenti registrati e la colonna “Come ci conosce?” nella posizione dove l’abbiamo inserita. Più o meno è quello che ho fatto io.
- 3 replies
-
- 1
-
-
- campo personalizzato
- custom field
- (and 8 more)
-
Hola a todos, he creado unos campos para una librería online que estoy construyendo y me encuentro con que los datos grabados en la base de datos no se visualizan correctamente en la ficha de producto del back-office y sí en la ficha de producto de la tienda Base de datos En la tienda: Ficha de producto, donde aparece la palabra "array" en vez de los datos grabados. Código de informations.tpl para crear el formulario para estos dos campos: <!-- ************ COLACION ***************--> <div class="form-group"> <label class="control-label col-lg-3" for="reference"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='Tipo de edicion y paginas.'} {l s='Allowed special characters:'} |.-_#\/"> {$bullet_common_field} {l s='Colación'} </span> </label> <div class="col-lg-5"> <input type="text" id="tapa" name="tapa" value="{$product->tapa|htmlentitiesUTF8}" /> </div> </div> <!-- ************ EDICION ***************--> <div class="form-group"> <label class="control-label col-lg-3" for="reference"> <span class="label-tooltip" data-toggle="tooltip" title="{l s='Numero edicion y año.'} {l s='Allowed special characters:'} |.-_#\/"> <!--{$bullet_common_field} {l s='Reference code'}--> {$bullet_common_field} {l s='Edición'} </span> </label> <div class="col-lg-5"> <input type="text" id="edc" name="edc" value="{$product->edc|htmlentitiesUTF8}" /> </div> </div> En Product.php he prescindido del la validación para que se grabasen los datos: 'tapa' => array('type' =>self::TYPE_STRING, 'lang'=>true, 'size' => 128), 'edc' => array('type' =>self::TYPE_STRING, 'lang'=>true, 'size' => 128), ¿Alguna sugerencia? Gracias por leer.
- 4 replies
-
- backoffice
- ficha de producto
-
(and 1 more)
Tagged with:
-
Hello everyone, I apologize in advance for my English translated by Google translate ... Context : Some products in my catalog are only available for professionals or for individuals or for everyone, but this condition must do when displaying products in a category (which can be seen by everyone or not). That is why the solution to hide a category custom group can not work in my case. In order to implement this solution I created a custom field in the product table "group_customer" and runs it through an override product.php the class and the view in the admin. On this side everything works perfectly, and can handle some necessary conditions produc.tpl. But not being developer I'm stuck with regard to product display (product-list.tpl) custom group in the desired category. I do not know if I should intervene at the SQL query getProduct or from the controller via parameters in my condition custom group and value in the product. I would really like to understand how to proceed in order to mount competence in that area. To sum up : > custom field "group_customer" in detail product as a possible value: 'all', 'private', 'professional'; > customer group: Visitor (1) - Guest (2) - Private (3) - Business (4); My conditions when displaying: $ GroupCustomerLogin == FrontController::getCurrentCustomerGroups(); if ($ groupCustomerLogin == 1,2,3) { $ GroupCustomerProduct == 'all', 'private'; } Elseif ($ groupCustomerLogin == 4) { $ GroupCustomerProduct == 'all', 'professional' } Can pass in the result to see that the products concerned ... your help is welcome :-) Thank you in advance for your generous support. Best regards.
-
- group customer
- getProduct
-
(and 3 more)
Tagged with:
-
Bonjour à tous ! Je sollicite l'aide de la communauté car je ne trouve pas la solution à mon problème qui est le suivant : J'utilise sur un site e-commerce les champs de personnalisation de prestashop (custom fields) pour réaliser des personnalisation sur des fiches produit. Elles servent notamment à l'ajout de champs textes basique. J'utilise en parallèle le plugin "Configurateur par étapes" qui utilise quand à lui les attributs de prestashop pour constituer un produit personnalisé. Le module permet de configurer le prix du produit par le biais d'une série de questions, et les champs de personnalisation servent quant à eux à apporter des indications complémentaires sur la prestation. Le problème est actuellement que par défaut le module utilise son propre fichier « product.tpl », et n'affiche pas par défaut les champs de personnalisation de prestashop, j'ai donc corrigé cela en copiant collant le bloc correspondant depuis le template par défaut, à la suite de quoi l'affichage des champs se fait bien sur la fiche. En revanche, le gros problème est que ces champs de personnalisation ne sont pas récupérés lors de l'ajout au panier. Une fois que l'on clique sur l'ajout au panier on retrouve donc bien la prestation ainsi que les réponses aux questions du module, mais on ne retrouve pas le détail des champs de personnalisation comme cela devrait être le cas. Je suppose donc qu'une étape est manquante dans le système d'ajout au panier du module pour récupérer les champs de personnalisation et les intégrer au produit dans le panier, cependant ne maitrisant pas assez le process d'ajout au panier je n'arrive pas à cibler le bout de code à implémenter dans le module (classes / controlleur / js) c'est pourquoi je sollicite votre aide à tous ! PS. Oui, j'ai déjà demandé de l'aide au support du module, mais non, ils ne savent répondre que ça ne fait pas parti du module (hors c'est logiquement une fonctionnalité de base de prestashop..., plutôt bad pour un module censé apporter un plus à votre site, et non être restrictif...) Merci d'avance pour votre aide à tous !
-
I am able to display my custom field in Feature Value Add/Edit form by overriding AdminFeaturesController and overriding initFormFeatureValue() function. I want to do the same for Feature Add/Edit form but cannot find function to override. I tried renderForm() function but didn't work. Which file/class/controller/function should I look into to override Feature Add/Edit form to display my custom field?
- 6 replies
-
- adminfeaturescontroller
- form
-
(and 4 more)
Tagged with:
-
Hi, I have added two custom field in order-carrier tpl page, id_is,name_is. It is saving this field values in ps_cart,ps_orders tbl in five steps checkout..but when Order process type is "one page checkout" it is not saving...any solution? 1. add field to table ps_cart and ps_orders. 2. define field in cart and order classes. 3. edit parentordercontroller.php put in _processCarrier() $this->context->cart->id_is = (Tools::getValue('id_is')); $this->context->cart->name_is = (int)(Tools::getValue('name_is')); 4. edit paymentmodule.php put in validateOrder() $order->id_is = $this->context->cart->id_is; $order->name_is = $this->context->cart->name_is; please reply.
-
Hi, I have searched around several places to get the new custom field on product list and home featured page, but in vain. I used this http://nemops.com/prestashop-products-new-tabs-fields/ tutorial to create this field in database and back office. Also, I did receive the expected value for the field in product detail page (Front end) using below code; product.php added below one liner under class ProductCore extends ObjectModel public $custom_field; product.tpl <p class="custom_field"> <a href="{$product->custom_field|escape:'htmlall':'UTF-8'}">My Field</a> </p> In order to make use of this field in product listing, I tried the below code in product-list.tpl, but the custom field is blank, though it holds value in database and works very well in product detail page. This code did not work in homefeatured.tpl as well. <p class="custom_field"> <a href="{$product.custom_field|escape:'htmlall':'UTF-8'}">My Field</a> </p> I know I am missing something here. Can someone shed light on this please?
- 5 replies
-
- home featured page
- product list page
-
(and 1 more)
Tagged with:
-
I have some custom fields in products like Director, Actors, Original Name, and others... How can i use them with the search module??
- 7 replies
-
- Product Search Module
- Custom Field
-
(and 1 more)
Tagged with:
-
I'm developing a module and extended AdminFeaturesController.php to display my custom field Add/Edit Feature Value, but it is showing following error in popup: Notice on line 719 in file D:\xampp\htdocs\prestashop16\tools\smarty\sysplugins\smarty_internal_templatebase.php(157) : eval()'d code [8] Undefined index: name I think it is due to I override the function initFormFeatureValue() in my AdminFeaturesController.php file and added a new field. Here is the code for that: public function initFormFeatureValue() { $this->setTypeValue(); $row = Feature::getFeature($this->context->language->id, (int)Tools::getValue('id_feature')); p($row); $this->fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Feature value'), 'icon' => 'icon-info-sign' ), 'input' => array( array( 'type' => 'select', 'label' => $this->l('Feature'), 'name' => 'id_feature', 'options' => array( 'query' => Feature::getFeatures($this->context->language->id), 'id' => 'id_feature', 'name' => 'name' ), 'required' => true ), array( 'type' => 'text', 'label' => $this->l('Value'), 'name' => 'value', 'lang' => true, 'size' => 33, 'hint' => $this->l('Invalid characters:').' <>;=#{}', 'required' => true ), array( 'type' => 'select', 'label' => $this->l('Parent Feature Value'), 'name' => 'parent_id_feature_value', 'options' => array( 'query' => FeatureValue::getFeatureValues(1), //$row['id_feature']), 'id' => 'id_feature', 'name' => 'name' ), 'required' => true ), ), 'submit' => array( 'title' => $this->l('Save'), ), 'buttons' => array( 'save-and-stay' => array( 'title' => $this->l('Save then add another value mamu'), 'name' => 'submitAdd'.$this->table.'AndStay', 'type' => 'submit', 'class' => 'btn btn-default pull-right', 'icon' => 'process-icon-save' ) ) ); $this->fields_value['id_feature'] = (int)Tools::getValue('id_feature'); // Create Object FeatureValue $feature_value = new FeatureValue(Tools::getValue('id_feature_value')); $this->tpl_vars = array( 'feature_value' => $feature_value, ); $this->getlanguages(); $helper = new HelperForm(); $helper->show_cancel_button = true; $back = Tools::safeOutput(Tools::getValue('back', '')); if (empty($back)) $back = self::$currentIndex.'&token='.$this->token; if (!Validate::isCleanHtml($back)) die(Tools::displayError()); $helper->back_url = $back; $helper->currentIndex = self::$currentIndex; $helper->token = $this->token; $helper->table = $this->table; $helper->identifier = $this->identifier; $helper->override_folder = 'feature_value/'; $helper->id = $feature_value->id; $helper->toolbar_scroll = false; $helper->tpl_vars = $this->tpl_vars; $helper->languages = $this->_languages; $helper->default_form_language = $this->default_form_language; $helper->allow_employee_form_lang = $this->allow_employee_form_lang; $helper->fields_value = $this->getFieldsValue($feature_value); $helper->toolbar_btn = $this->toolbar_btn; $helper->title = $this->l('Add a new feature value'); $this->content .= $helper->generateForm($this->fields_form); } Any idea why it is showing this error? Also, it is not populating my custom field.
- 1 reply
-
- smarty
- custom field
-
(and 2 more)
Tagged with:
-
Hi friends, Using this tutorial on this page Adding new tabs and fields to Prestashop products’ back office, I was able to add a new field for author for products in my Prestashop. I was also able to display it on product page by adding Product.php to override/classes/ and inserting this code below: class Product extends ProductCore { /** @var string Custom Product Field */ public $custom_field; } I then added {$product->custom_field} to product.tpl to display the new field. My problem now is that the same code does not work when added to product-list.tpl and the homefeatured.tpl module files. Can any one explain how to achieve this? Thank you.
-
Buongiorno, avrei un problema da proporvi. Vorrei aggiungere un campo personalizzato all'interno di tutti i prodotti che prenderà il nome di: "Tempi di Consegna" e vorrei sapere se è possibile farlo. Ho cercato un po' in giro ma non ho trovato niente, magari voi potreste darmi una mano. Grazie e buona giornata.
- 3 replies
-
- custom field
- campi personalizzati
-
(and 2 more)
Tagged with:
-
Hi all, I added custom fields to Prestashop Product class (using override folder), everything works fine: I can use and update those fields in the backend and show them on the frontend but I have problem when I try to use those field for setting up the rewrite url on seo/url tab, I am able to add the rule but when I try to open a product page detail on the frontend I receive a 404 error page. For example I set the rule: {categories:/}{id}-{my_custom_product_field}-{rewrite}{-:ean13}.html it saves the rule properly but gives error 404 on the frontend If i set a rule using standard fields it works fine. Any hints? Best Regards, Riccardo.
- 1 reply
-
- custom field
- seo
-
(and 1 more)
Tagged with:
-
Hello, it would be great if someone could help me. I'm tried for few days with no success. Message just doesn't appear in order. What I'm trying to do is move "comment" field from 3. Address (image 1) to 5. Payment (before or after client selects Bank Wire payment method (image 2 and 3) to let buyer enter Name, Number and Sort code (it is for transferring money to clients bank account). Other way is add 3 text input fields, that will display details in the order after confirming, it is better, but i think harder to do? I'm copying from order-adress.tpl: <div id="ordermsg" class="form-group"> <label>{l s='If you would like to add a comment about your order, please write it in the field below.'}</label> <textarea class="form-control" cols="60" rows="6" name="message">{if isset($oldMessage)}{$oldMessage}{/if}</textarea> </div> To payment-execution.tpl line 52, the field appears, but does not work. Please help! 1. 2. 3.
-
- input field
- text input field
- (and 5 more)