Jump to content

orioltestart

Members
  • Posts

    16
  • Joined

  • Last visited

Profile Information

  • First Name
    Oriol
  • Last Name
    Testart

orioltestart's Achievements

Newbie

Newbie (1/14)

1

Reputation

1

Community Answers

  1. When you mean style is the product? I mean. Hoodie with Style 1 = Product X? or there are more levels? I recommend you this because the breadcrumbs gonna look great Hoodie>Style1... But hey, I'm new on PrestaShop as well as you, just trying to help you because I'm waiting answer on another thread
  2. Like Code Profiler? http://doc.prestashop.com/display/PS16/PrestaShop's+developer+tools On your server, open the /config/defines.inc.php file. Find this line (around line 43): define('_PS_DEBUG_PROFILING_', false); In this line, change "false" to "true". Save your changes.
  3. Mmmmm, I guess I didn't catch the problem. I mean: Home |-----Hoodie | |-------Style 1 | |-------Style 2 |-----T-Shirt | |-------Style 1 | |-------Style 3 ... That wont work?
  4. As dioniz says, you should create a category for each brand and then create the subcategories. Why it's not an option?
  5. Hi people, I hope you could help me, I need to upload a file (xml) and process it with a module. I've been trying to use the HelperForm creating the form like this: public function renderForm() { $default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $fields_form[0]['form'] = array( 'legend' => array( 'title' => $this->l('Importar Productos'), 'image' => '../img/admin/cog.gif' ), 'input' => array( array( 'type' => 'file', 'name' => 'my-name', 'multiple' => false, 'label' => $this->l('Elija un archivo de importacion'), 'lang' => true, 'id' => 'my-name' ) ), 'submit' => array( 'title' => $this->l('Guardar'), 'class' => 'button' ) ); $token=Tools::getAdminToken($this->className.intval(Tab::getIdFromClassName($this->className)).intval($this->context->cookie->id_employee)); $helper = new HelperForm(); $helper->module = $this; $helper->name_controller = $this->name; $helper->token = $token; $helper->currentIndex = AdminController::$currentIndex.'&configure='.$this->name; $helper->languages = Language::getLanguages(); $helper->default_form_language = $default_lang; $helper->allow_employee_form_lang = $default_lang; $helper->submit_action = 'submit'.$this->name; // $helper->fields_value['BETTERPRICE_EMAIL'] = Configuration::get('BETTERPRICE_EMAIL'); return $helper->generateForm($fields_form); } After that I render that form on the template. The question is: where does the file go after the upload? It goes on a controller method? I've tried to override processAdd() and processUpload() with d("HELLO"); and non of those executes that. I have serious doubts about what method executes and when does it on the controller or in the module.php or what where should locate the action of the form -> how does i set the href (on BO the url goes different, what parameters are required..) Hope somebody could help me, Thanks!
  6. I really don't know how to do it in the proper way, actually I have the same doubt. I guess that you could add the buttons in the template directly (or create the whole form with an action). I guess the best option would be creating the form with the FormHelper but I don't know how to render it in the desired place and with the desired handler. Then begins my doubts, the action must be handled by the module.php or by the controller? Its as simple of creating an postProcess() method? Where should I put that? Controller/Module And the renderForm() method when it's called? I have to assign the result on the $smarty variable? But if so, I have to put the renderForm in the Controller, it will work? Sorry for that many questions, I don't want to steal your thread. Hope someone could help us! Thanks!
  7. Well, finally I made a Controller with its own page and can handle the error signs with jquery. Now the problem becomes when I try to do an AJAX call. I've been reading for a while about how to do that and I literally copied the same steps and didnt work. I did the following. First, I've created a new file inside mymodule/ajax/ajax.php which just have to send "HELLO". <?php include_once(_PS_ROOT_DIR_.'/config/config.inc.php'); include_once(_PS_ROOT_DIR_.'/init.php'); echo "HELLO"; ?> Then I've created the javascript file which its the following $.ajax({ url: '{$ajax}categorias_ajax.php', type: 'GET', data: 'ajax=true' }) .done(function (data, textStatus, jqXHR) { console.log(data); }) .fail(function (jqXHR, textStatus, errorThrown) { console.log(errorThrown); }); Okay, nevermind, I solved the problem trying to explain it. I mark the topic as SOLVED. Thanks rocky!!
  8. Thanks for your help, actually the objective it's not the modal box, I just want the warning sign to the user. It can be made with modals or with wells, for me it doesn't matter. For example, when you try to delete a category and it appears a form on the top of the page asking you where you wanna put the products that belong on the target category. And if I press cancel the category doesnt get deleted. Something like that. Just trying to realize which is the best way to do that.
  9. Well, that would work i guess. The problem is: For now I got all the algorithms which run after the hook triggers on the .php file on the top of the module being executed on the server, I dont have any front-view to put the JS and actually i don't know how to i add this. Maybe would be better if I make a controller? Prestashop should have some methods to create forms I guess. I saw the method renderForm() on controllers examples and I don't get how to use it or what will produce it. Sorry if it sounds stupid, its my first time developing with Prestashop and some things looks weird to me. Thanks!
  10. Hi everyone, How could i show a prompt to the user before the Hook is executed. The idea would be like: I wanna add a new Category which will add some more subcategories because of a module. I want that before you can add that new category, a modal or simply a prompt asks you if you are sure, and aware the user of what it will produce. There is an easy way to do that? I have to make a new Controller or i can do it with context variable? Thanks!!
  11. Hola amigos, Estoy desarrollando un pequeño modulo para modificar varias categorías al mismo tiempo cada una con sus subcategorais y todo ello controlado por una ultima categoría de "Control". Esta categoría de control es la que decide las subcategorias que van a tener el resto de productos. Pese a que tienen diferente ID puedo mantener la consistencia. El problema que tengo es que no puedo propagar del mismo modo la foto asignada a la categoría de control a las otras categorías. La idea seria algo así. $category->id_image = $params['category']->id; Pero pese a que se actualiza la instancia con el valor correcto (La id de la categoría que le corresponde la foto). Cuando hago el save() no se actualiza correctamente y la foto no se propaga. Igual no entiendo muy bien como funcionan las imágenes en las categoría. A ver si puedes ayudarme. Gracias!!
  12. Hey people, I'm developing a simple module which pretends to mantain the control of all the products with categories. When user adds new category on "Control", it gets created below all the others lvl 3 categories with different id but the same name. The problem becomes when I try to use the same image used on the "Control" class on all subclasses created. I've been trying things like: $category->id_image = $params['category']->id; Bcoz of this on Category.php /** @var string id_image is the category ID when an image exists and 'default' otherwise */ public $id_image = 'default'; This attribute gets updated when I prepare it before upload but when I save it dissapear and I'm wondering why. If somewone could just answer why it happends or some possible solution would be awesome! Thanks!!
  13. I've found the problem.. https://www.prestashop.com/forums/topic/273915-solved-category-add-by-code/ Edit: I've tried to add the names and the links_rewrite with all the languages and i don't have any error now. The problem is that the categories are added on the DB with no id_parent and doesnt show up in the categories tree view
  14. Hi everyone, I've been working on a little module which gets executed when you add a new category and adds news categories below him. I'm getting Property Category->name is empty Can somebody help me? It's my first module. Here is the code: public function hookActionCategoryAdd($params) { $type = array("Category1", "Category2", "Category3"); if ($params['category']->calcLevelDepth() == 3) { foreach ($type as $nom) { $category_to_be_added = new Category(); $category_to_be_added->name = $nom; $category_to_be_added->is_root_category = 0; $category_to_be_added->link_rewrite = $nom; $category_to_be_added->level_depth = $params['category']->level_depth+1; $category_to_be_added->id_parent = $params['category']->id_category; if ($category_to_be_added->add(true, false, false)) { continue; } else { return false; } } } else { return false; } }
  15. Buenos dias, Estoy intentando automatizar la importación de productos/categorias de otra BD para empezar a usar PrestaShop para la gestión y veo que cuando quiero importar nuevas categorías a través de CSV se asigna por defecto los grupos de Visitante/Cliente/Invitado e ignora el resto. No hay ningún campo que te permita modificar eso? Saben si hay algún modulo o alguna modificación que me permita hacer eso? Simplemente escoger el grupo igualmente a través de CSV. Muchas gracias!
×
×
  • Create New...