Jump to content

Jason Huck

Members
  • Content Count

    132
  • Joined

  • Last visited

Everything posted by Jason Huck

  1. Well, I don't understand why, but saving the title in a discrete operation separate from other fields seems to work. In other words, this works for everything except the title: $product->of(false); $product->foo = 'bar'; $product->baz = 'yadda'; // ...etc... $product->title = 'hmm'; // does not work $product->save(); Whereas this seems to work for everything including the title: $product->of(false); $product->foo = 'bar'; $product->baz = 'yadda'; ...etc... $product->save(); $product->setAndSave(title', 'hmm'); // works fine
  2. Hi kixe, Yes, I am turning output formatting off prior to the changes, and saving after making them. It does make me wonder if there is some other part of the routine that is overwriting the changes, though, so maybe I will separately set the title at the very end -- in its own save operation -- to see if that makes any difference. Thanks, Jason
  3. We have a routine that imports product data from an external source and adds, updates, or deletes pages as needed. We've realized that existing page titles aren't being updated. The page name and other fields get updated, including a custom field that we set up to be identical to the title field. The title field is a TextLanguage field. There is currently only the default language (English). Is there some special step you have to take for page titles, multilingual or otherwise? I've done similar things in the past and don't ever recall having this issue. I've tried each of these to no avail: $product->title = $productTitle; $product->set('title', $productTitle); $product->title->setLanguageValue(wire('languages')->get('default'), $productTitle); $product->title->setLanguageValue(wire('languages')->get('english'), $productTitle); Thanks, Jason
  4. Perfect! Exactly what I needed. Thank you!
  5. I'm customizing some search results and have to explicitly reset the values for the start and total on each page. I've got it all working except I'm not sure how to detect when I'm on e.g. /page2/. I tried $input->urlSegment1, but it's empty. I'm sure there's an easy way to grab the current page value when pagination is in use? Thanks!
  6. Just to follow up, I discovered that there was no entry in the fieldgroups_field table linking the missing field to the admin template. I manually added a record there, re-saved my custom page, and now it's working as expected. I am concerned about how the db got into this state in the first place, but I don't think this module is to blame. Thanks, Jason
  7. I have used this module successfully in the past, but am having trouble getting it to work properly in PW 3.0.123. The module installs without error and I can create an admin page (using the admin template and the correct "Process."), but the FieldTypeAdminCustomPagesSelect field never shows up on the page. (The field is defined in the fields table.) I manually entered a value in field_acp_template to try and circumvent the issue, but it's not finding the template file. What else should I check? Any ideas? Thanks! Jason
  8. My company is hiring two full time positions that might be of interest to members of this forum as we build out our UX team. Among other things, we will be migrating a number of sites over to ProcessWire, developing a UI pattern library, and establishing a continuous improvement process for them. Lots of front end work but also some API development, PDF generation, and other fun stuff. These are multilingual sites (currently English, German, and Chinese, more languages to come) for a global company, but these positions are on site in our Cincinnati, Ohio corporate HQ. For more information, or to apply, see the following links: Web Developer http://www.michelmancareers.com/Opportunities/Americas/?gnk=job&gni=8a7880665cc36d5a015cc69d9b170b1e Digital Designer http://www.michelmancareers.com/Opportunities/Americas/?gnk=job&gni=8a7880665cc36d5a015cc69aa93008dc Thanks, Jason
  9. This seems to work just fine with PW 3.x, by the way. Thank you to the author!
  10. @gRegor I never did get it working on that project. It's still running PW 2.7.x. It wasn't that critical so I just let it go.
  11. Just to close this out, there turned out to be multiple, unrelated issues. The 404 on the front end was due to a coding error on my part. The upload issue on the back end was due to missing support for iconv and imagick. All sorted now.
  12. Also: - The host uses both nginx and varnish in front of Apache. I do not have access to the nginx config, and only realized it was in the mix by inspecting the response headers from the server. - The host also uses varnish. I have access to a varnish folder, the only contents of which is a text file where you can exclude domains from caching. I added the domains for this host, but I still see varnish headers in the response. The response is a "miss", though, so I don't think caching is an issue. - ProcessWire is fielding the AJAX request and the code I have in place to handle it gets executed without (server-side) errors. It subscribes the user to a MailChimp mailing list (verified at Mailchimp), sets a cookie, and returns a JSON response. - Even though setcookie returns 1, the cookie doesn't get set in my browser. The standard PW cookies do get set, though. I've tried explicitly setting various access control headers in .htaccess, but it's not a cross-origin request. My best guess currently is that nginx and/or varnish have security settings which are interfering. I've asked the provider for assistance but haven't had much luck yet.
  13. Trying to deploy a PW site to a client's hosting provider. Everything works as expected in development, but on the production host, certain AJAX requests fail. Here's what I'm seeing: 1) I have form on every page which is submitted via AJAX POST to the current page. No matter which page you POST to, it always returns a PW 404 page. 2) AJAX image uploads on the back end return a 200 or 302 for the original request, then spawn a GET request for the homepage. In trying to troubleshoot this, I have found that the host has both suhosin and mod_security installed. They've provided me with a local php.ini to test configuration changes. I've added the following to .htaccess (temporarily): # account-specific php.ini file <IfModule mod_suphp.c> suPHP_ConfigPath /home/[username] <Files php.ini> order allow,deny deny from all </Files> </IfModule> # disable mod_security <IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule> In the php.ini file, I've set the following directives: suhosin.simulation = On always_populate_raw_post_data = -1 I've also set a specific directory for uploads: upload_tmp_dir = /home/[username]/tmp GD support is included. PW doesn't log any errors, even with $config->debug set to true. This is PW 2.7.3 on PHP 5.6.28. What else should I check?
  14. Option 1 is more or less what I assumed I would have to do. My data set is around 560 pages, and they are all created/updated in bulk via a custom import script, so I may end up just populating the natural sort field as part of that routine. Option 2 isn't really an option in this case, because the contents of my sort field are highly irregular, and those SQL tricks rely on the sort field containing strings of predictable length and/or composition. Thanks for the input -- I wanted to be sure I wasn't missing something in the API.
  15. That would be a nice addition, though in my particular use case, I think I'd need support within the selector itself, e.g. something like one of these: $pages->find('...etc...,sort=title', ['sortmethod' => NATURAL_SORT]); $pages->find('...etc...,sort=title,sort.method=natural'); ...otherwise, I'd only be sorting the returned PageArray, and not the entire set, so it couldn't be used for pagination.
  16. Whether truly at the database level or not, I was hoping there was a built-in PW method to apply that sorting algorithm. Otherwise I will probably have to create a separate field just for sorting, and add a hook when new pages are created that retrieves the entire result set, sorts it manually, and updates that field with each page's position in the entire set. That's the only way I can think of that will allow me to later retrieve a filtered subset that remains in the correct order. If there's another approach I should consider, I'm all ears. Thanks!
  17. What's the easiest way to retrieve a PageArray -- with an offset and a limit, for use in paginated search results -- that is sorted by title using PHP's SORT_NATURAL instead of alphabetically? I was hoping there was a config setting or API method that would handle it for me, but if there is, I haven't stumbled across it yet.
  18. Hmm, guessing I'd have to create "votes" to do that. Probably better off not using the API for this, and just doing the whole thing right in the database.
  19. Anybody know if there's a way to set upvotes and downvotes via the API? I'm not using the voting features, but I'm importing a nested comment structure and thought I would temporarily use those fields to store legacy IDs. I tried the expected $c->upvotes = $value, both before and after save, but they don't get stored in the database.
  20. Actually I can't get this working even in PW 2.7.x. When I tried to install it, I got the following untrapped, fatal error: Error: Class 'WebmentionItem' not found (line 78 of [path to webroot]/site/modules/Webmention/ProcessWebmentionsManager/ProcessWebmentionsManager.module) I manually removed the Webmention folder from the modules folder and refreshed modules. Now if I put the folder back, I get an ISE, and this error is logged: Error: Class 'ProcessWebmentionsManager' not found (line 407 of [path to webroot]/wire/core/Modules.php) Suggestions welcome.
  21. I had to set this project aside for a while, but recently came back to it. In the meantime, I had upgraded the site to PW 3.x and had hopes that this issue would magically disappear. It didn't, and subsequent attempts to further optimize the import routine didn't help. At the moment, though, I can consistently eliminate the timeouts by temporarily enabling debug mode while performing the import, e.g.: $config->debug = true; $import = importProductData($filepath); $config->debug = false; I have no idea why this works, but so far, it does. I'll have to see if the timeouts return if the data set gets larger, but it's already quite a bit larger than it was back in August when I was last working on it.
  22. Your web server should be configured to have a single canonical domain to avoid fragmentation of SEO and analytics, and your sitemap should use it. If the "www" version of the domain is canonical, requests for sitemap.xml will be redirected to that domain and the generated links should match. The module simply uses the value of $page->httpUrl. ProcessWire's .htaccess file includes directives for Apache to set a canonical domain, but they are commented out by default. Look around line 123: # ----------------------------------------------------------------------------------------------- # 13. OPTIONAL: Redirect users to the 'www.' version of the site (uncomment to enable). # For example: http://processwire.com/ would be redirected to http://www.processwire.com/ # ----------------------------------------------------------------------------------------------- # RewriteCond %{HTTP_HOST} !^www\. [NC] # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  23. Makes sense to use the same list for both purposes, as long as it's configurable. For instance, in a current project we have to handle requests for .pdf files that are now served via a PW-powered download page.
  24. How would you distinguish between a literal question mark and its current use to make the previous character optional? Would it have to be escaped, or is that syntax changing in v2? I configurable list of allowed extensions would ultimately be safer and more flexible. People create all sorts of crazy URLs, and we don't know what someone might need to allow/disallow.
×
×
  • Create New...