Jump to content

Harmen

Members
  • Posts

    127
  • Joined

  • Last visited

Everything posted by Harmen

  1. Hi, I am not familiar with the specific settings and configurations for the CKEditor, but I've found something: Have you applied this to your field using the CKEditor? Maybe <br /> works? ~Harmen
  2. You're right, but as I said. I did not tested it, and wrote this piece of code in a rush. Thanks for the addition. I think it is, most of the time I use it at the end of operations.
  3. Hi, I think this is not that difficult, you work already with an id which you can use now: You could add a if statement for the very first id in your foreach loop: $id = 0; // set it to zero foreach ($sections as $item) { if ($id == 0) continue else { echo "<li><a href='#section-$id'>$item->title</a></li>"; } $id ++; } NOTE: Haven't tested this As you want to skip the first element, which id is equal to 0, the first rendered <li> will have id 1, so if you add another if statement in your foreach loop for id ==1 you can filter that item out and the rest gets the normal tags. See code below: $id = 0; // set it to zero foreach ($sections as $item) { if ($id == 0) continue else { if ($id == 1){ echo "<li class='yourclassforfirstitem'><a href='#section-$id'>$item->title</a></li>"; } echo "<li><a href='#section-$id'>$item->title</a></li>"; } $id ++; } Haven't tested it so far, but I expect this works (maybe with some adjustments)
  4. New version is launched! I've added some new features/options - Earlier I've launched a version with a new option to import the reference codes of your products and the EAN-numbers too - Added a link to module info which links to this module in the module section of processwire. - If you used this module before and only want to update your data, you don't need to first import your categories, then products etc. You can directly click on the import button you want to use. - Revised this module to make translations available. Also made a dutch translation for this module. Download the .zip file (attached to this post or get it via my github) and add it to your dutch language site translations file. Enjoy the new features! NL-Translations.zip
  5. Hai @manlio, As far as I know this is not available at the moment. Currently the development for multi-language export and maybe import is ongoing for BatchChildEditor. I don't know if there is another way to import your multi-language csv into Processwire yet.
  6. True At that time Tracy Debugger didn't show any errors @adrian. To check if it really had nothing to do with your module I uninstalled it (will install it again, no worries ) and tried to import the images again. Everything worked as expected again. It feels a bit unreal to me, as I tried many things and now it works on the code I wrote at the start of developing this feature.
  7. I will implement the changes. $id_product are integers for the products. I get these from the database. Each products has it own id, and I link the images to the product trought that id. productid is an integer field where I store the integer of that product.
  8. Allright, this is weird. I checked my code again, uploaded it, installed tracydebugger to see if that gives me more info, and suddenly it works! Tried it several times again and it really works. I didn't make any changes in my code but it works for now. Now asking myself: what causes the error... In any case, thanks for your help @kongondo!
  9. Sorry, here's what I got with your piece of code: This confuses me... I think it gives the types of all the $imgfields
  10. Once the module established a connection with the database the following screen shows up: So the ranking is to first import the categories, then products, followed by features and images. If you first click on products, but you've never done a import before the module will give you a message: and you will stay on the same page so you can first import your categories. The code for this 'ranking': if (!$parent->hasChildren()) { if ($this->input->post->importcat) { //button categories $this->session->done = 1; //store in a session categories are imported return $this->processForm21($form); } //When button is clicked to import the products... if ($this->input->post->importprod) { if ($this->session->done >= 1) { //check if categories are imported $this->session->done = 2; //store in session you've imported the products return $this->processForm31($form); } else $this->message(__("First import the categories")); } //When button is clicked to import the features... if ($this->input->post->importfeat) { if ($this->session->done >= 2) { //check if products are imported return $this->processForm41($form); } else $this->message(__("First import the products.")); } //When button is clicked to import the images... if ($this->input->post->importimg) { if ($this->session->done >= 2) { //check if products are imported return $this->processForm51($form); } else $this->message(__("First import the products.")); } } $imgfield refers to this field (which is now empty because I can't perform the import due to the error) Yup, noticed it
  11. Yup, because with the ranking it works, so it has to return an object. I tried to store it in a var because $product_pages->images_product->add($image_path); also didn't work. I've designed this by myself. In my case products cannot be in two or more categories. Each category is totally different. Children can be deleted manually. I've changed it to this: if (!$parent->hasChildren("template=$templatecat")) { //code } and $templatecat is the template the user choose for his/her categories. And I advice to keep this template always the same. Thanks for the tip, will check this later today (Maybe I just should forget this whole idea....)
  12. Hi all, Currently I'm developing a new feature for my module ImportPagesPrestashop. This module imports your categories, products and more from a prestashop database and implement that data in ProcessWire pages. I've made the following structure for this: Products (Parent Page which the user has to choose) Categories (implemented from the database) Products (Implemented from the database) And inside of the product pages several fields for the specifications of the products, description, images and more. So I've build a check inside of my module which doesn't allow you to first import the images and then the products or in another way, but you have to follow this route: Categories Products Specifications Images This is because the products require a category as their parent page and the specifications and images need a product page. Now I want to remove the check if you used this module before, so all pages you need are already there, you only need to update the pages. That's why I have done the following: $parent = $this->parent; if (!$parent->hasChildren()) { //if parent has no children, module isn't used before // set ranking in import // my code } if ($parent->hasChildren()){ //module is used before, so parent has children //no ranking in import, any button can be clicked. No specific path required. //my code } So far so good. It works and I was happy with it, until I tried to import the images of the products. I encountered a error which says this: Error: Call to a member function add() on a non-object (line 986 of / etc etc) So I was like huh, why doesn't this work. I will explain how I perform the import of the images. If the button is clicked, another function is called: if ($this->input->post->importimg) { return $this->processForm51($form); } so function ProcessForm 51 is called, below you can see this function: protected function processForm51(inputfieldForm $form){ ///... some code $this->ImportImages(); //Function is called which performs the import of the images return $this->processFormMarkupImg($imgImported); //return after the import } This function links to the function that performs the import: protected function importImages(){ // some code to get the images and store it in $pictures $pagesWithImages = wire("pages")->find("images_product.count>0"); //find pages with that field for the images foreach ($pagesWithImages as $product_page) { $product_page->images_product->removeAll(); // remove existing images $product_page->save(); } foreach ($pictures as $picture) { $id_product = $picture['id_product']; $product_pages = wire("pages")->get("productid=$id_product"); //get the correct page so the images are placed in the correct product page // ensure output formatting is off $product_pages->of(false); $str_prlink = $picture['product_name']; //make sure end of string ends with alphanumeric $image_name = preg_replace('/[^a-z0-9]+\Z/i', '', $str_prlink); $image_url = $picture['file_id'] . "/" . $image_name . '.jpg'; $image_path = "http://www.website/" . $image_url; try { $imgfield = $product_pages->images_product; $imgfield->add($image_path); //add the images to the field } catch (Exception $e) { } $product_pages->save(); } } This should work because when I perfom this import WITH the ranking in import (first categories, 2nd products etc) it works! I don't get it why this gives an error WITHOUT the ranking in import. So that's why I am asking it over here, hopefully anyone knows how to solve this. Thanks in advance, ~Harmen
  13. True, but why wouldn't it be approved as it works? By the way I am still not done with a complete revised version of my module and add the translation changes to it, so no haste
  14. Great! Will definitely implement this in my module
  15. Maybe something for the roadmap in 2017 to solve this issue . I'll try to revise my module and make a dutch translation for it. If anyone wants to translate the module in another language, feel free to contact me.
  16. I've tried the following $f->description = __("Text"); This worked and I am glad it works but I do have some questions. If I've translated everything to -for example- Dutch, how do I add the translation file to my module? Copy the csv file or json file to my module directory so with the install, you get the translation file too or how does this works? Cheers, ~Harmen
  17. Hey @blynx, Thanks for your reply. I've read the page you linked and I do have a question about your example. I think it is not but the following: Please tell me if I am wrong, can't test it now unfortunately. Regards, ~Harmen
  18. Hi all, Recently I launched a module -ImportPagesPrestashop-, and now I was thinking if it is worthy to translate this module in several languages (starting with a translation in dutch, because I'm from the Netherlands). Is it worth to put the effort into the translation or do you guys think ->English is the best and translations are not needed? Thanks in advance, ~Harmen
  19. Hi all! This module works great and I don't have any errors. I was just wondering if there is any option to send an e-mail with the data filled in the form in a template. So you receive at the end an e-mail with a logo and maybe more adjustments. Or should I add the logo in the module file to the message and maybe style it there too? -EDIT- My contractor haves an alias of a gmail account. So the e-mail adres looks like name@companyname.com but it is from google. Now I want to send the emails to that email address, but he receives nothing. Also not in the spambox. Is it possible that this doesn't work because the emailadress is an alias or is it something else? To present more information, the website I am currently working on was a few years ago moved from a hosting service to another hosting company. Now I noticed that the email in the current hosting application has the wrong records, but the e-mailadresses are still working and don't experience any problems, except for not receiving the contact form e-mail. Does anyone know how this is possible, is it because the records are wrong (but emailaddressess still work fine) or is it a bug in the module? Thanks in advance, ~Harmen
  20. Hi Doc, Glad you can use it. I get your point and I think you are right with this: Maybe you could redirect directly to the first child page or display the 404 page and redirect to the homepage within 2 or 3 seconds automatically.
  21. If you have a header with a navbar or just a navbar this code works for me: <?php $rootPage = wire('pages')->get('/'); $children = $rootPage->children(); foreach ($children as $child) { echo "<li>"; $grandchildren = $child->children(); if(count($grandchildren)){ echo "<span class='pseudo_anchor noselect'>{$child->title}</span>"; echo "<ul class='dropdown_menu'>"; foreach ($grandchildren as $grandchild){ echo "<li><a href='{$grandchild->url}'>{$grandchild->title}</a></li>"; } echo "</ul>"; } else echo "<a class='noselect' href='{$child->url}'>{$child->title}</a>"; echo "</li>"; } ?> This code checks if the childpage has children. If the child has children then the it will be only a span with the child->title. But if it doesn't have children then the url will be active and you can click on it.
  22. Didn't know that. I'm sorry
  23. Your first error is a Compile error -> Check if there is a namespace in that file called processwire. If not then add this: <?php namespace Processwire; ?> For the 2nd error, I don't know at the moment... Are you 100% sure you have the right id's for your pages and everything in your wire folder of processwire is correct? Because for me the wire('pages')->get(pageid) works normal... ~ Harmen
  24. Great work! I think this module could be very handy. And I think if your module has other options than @rot's module you can release it. But if it is exactly the same, I don't know what solution would fit this situation.
×
×
  • Create New...