Jump to content

strandoo

Members
  • Posts

    141
  • Joined

  • Last visited

Everything posted by strandoo

  1. Hi all. I'm building a product search page with a filter consisting of selects and checkboxes. It's based on Ryan's excellent Skyscraper demo, but I'm trying to add multiple checkbox fieldtypes. I've got it working, but it's not very elegant and I'm sure there's a better way to do it. Given the following checkboxes: [x] Adidas (15) [ ] Asics (10) [x] Nike (20) If only Adidas is checked, 15 shoes will be found; if both Adidas and Nike, 35 shoes will be found. The form field: foreach($pages->get("/brands/")->children() as $brand) { $selected = $brand->name == $input->whitelist->brand ? " checked='checked' " : ""; echo "<label><input $selected type='checkbox' name='brand[]' value='{$brand->name}'> {$brand->title}</label>"; } Here's what I've got for the select, based on the Skyscraper search: $selector = ''; ... if($input->get->brand) { $brands = $input->get->brand; $selector .= "brand="; foreach($brands as $brand) { $value = $brand; $selector .= "$value|"; $input->whitelist('brand', $value); } $selector .= ", "; } ... $selector = "template=product-page, limit=24, " . trim($selector, ", "); This sort of works (although pagination doesn't work because I don't know how to do the whitelist part -- bonus question!). The correct results are returned, but an echo of the selector string looks weird: "template=product-page, limit=24, brand=adidas|nike| " (there's a trailing pipe character that I don't know how to remove). Is there a better way to do this? Thanks in advance.
  2. Thanks for the suggestions. I did do a fresh install with the default theme to a subfolder on the same server. No extra modules, no new pages. Same thing: fast/normal when logged into the admin; sloooooow when not. I did get another warning about 'Warning: set_time_limit() has been disabled for security reasons', so I'll probably contact the hosting company and see if they can suggest anything. I'd like to be able to set a time limit, just to rule that out; I can do it in htaccess for php5, but I can't figure out how to do it for php 7. I can work around the issue by reverting to php 5, but that's not great.
  3. Hello. I've come across strange behaviour under the following situation. Maybe someone can explain what's happening? PW 3.0.42 running on a FastHost php 7 server. Initial page loads have about a 6 second latency! At first I thought I had some bad code, but I stripped everything back to the most simplest of pages, still with a huge loading delay. Once I log in as a superuser, the pages load normally (150-200ms). This was happening on at 3 sites. All pages had a latency of about 6 sec. until I logged in to the admin panel. I also have one or two PW 3 sites running on an older php5.6 account, which runs normally. I downgraded one of the php 7 sites to php 5.6 and the pages loaded normally. One more thing that may or may not be related: I did get an error "WARNING: SET_TIME_LIMIT() HAS BEEN DISABLED FOR SECURITY". That took me down a path of setting the max_execution_time in .htaccess. Which also inspired me to downgrade from php7 to 5. The curious thing is how signing in as a superuser solves the problem. Thanks. - Paul
  4. Ok, I got it. It turns out it's because this particular site is still using php v5.3.x which doesn't like the "Array Initialization Construct: []" I've worked around it by using "array(" instead: $result = $MailChimp->post("lists/$list_id/members", array( 'email_address' => $page->email, 'status' => 'subscribed', )); Cheers, Paul
  5. Hi @benbyf. Well, I first got the error when I tried to install the module, so I never got far enough to enter a List ID (or any other settings). I then commented out lines 73-76 (and 82-85 when I got the same error) and was able to install the module and insert API and List ID. But when I uncommented the lines, I get the same error.
  6. Hi. I'm trying to install the WireMailChimp module, but I'm getting an error when I install: "parse error (line 73 of /Users/paul/Sites/pw-projects/site/modules/WireMailChimp/WireMailChimp.module)" I'm using PW 2.7.2. Any ideas why?
  7. (Slaps forehead) Thanks godmok. I read that page and looked through the list of options, but somehow missed that. Cheers.
  8. Hi. I've got a client that wishes to see all the page links in the rendered pagination, without the separator (...). Is this possible? I know the page links may get reeeeally long, but that's what he wants. I know there are optional arguments that can be passed to renderPager(), but I can't see one for removing the separator. Any suggestions folks?
  9. Thanks ukyo, that was quick! That looks pretty straightforward and it makes perfect sense. I'll give it a shot.
  10. Hello all. I'm planning a site that will include 5 languages. Processwire looks perfect for this. From what I can tell, the 'normal' behaviour is to have different urls for each language. But rather than having 5 parallel 'sites', each with a different language, my client needs to have each of the 5 languages displayed on the same page. The site is mostly in english, but news posts will be multi-lingual and appear together on one page, one after another. Is this possible? Does anyone have any suggestions for the best way to achieve this? Thanks in advance.
  11. UPDATE: I just tried Kiwi Chris's code and it worked fine for me. I had previously used $this->contact->get($field->name->title) instead of this $this->contact->get($field->name)->title which worked.
  12. Hi Kiwi Chris. Did you ever solve this? I've got the same problem and have tried similar things with no luck. Any enlightenment would be useful. thanks.
  13. Thanks, Robin S! I'm using neither Page Fields nor the FormBuilder, but (relatively new) Options Field Type. But I just did a test with a Page Field to get my head around your code, and I think I get it. I've also read up on the Options field type and will take a stab at putting something together. Thanks for pointing me in the right directions.
  14. Hi Folks, I've got a site with some contact and quote forms which get sent to my client and get saved as pages so the client has a record of the submitted forms. He'd like to analyse some of the form data. So for instance, there's a field that asks 'where did you hear about us?' with select options like 'Advertisement', 'Google', 'Recommendation', 'Magazine', etc. I'd like provide a page so the client could see how many respondents chose 'Google' vs 'Advertisement', etc. A simple tally would be fine, but then I could calculate percentages, maybe chart the results, etc. My first thought was to use $pages->count('selector') to count the pages with a certain answer. I'd know what percentage that was by comparing it to the total of saved pages for that form. But would I need to do this for each question? Is there a better way to tally/count all the answers for a given field?
  15. Hi. I've just been trying out Padloper on a local demo site. It works fine with the 'ShippingFixed' module, but I've tried changing the the shipping module to 'PadProcessShipping' and I'm getting the following error when I add some items to my cart and load my checkout page: Error: Exception: Method PadProcessShipping::calculateShippingCost does not exist or is not callable in this context (in /Users/paul/Sites/processwire-2.7/wire/core/Wire.php line 358) Here's my Checkout page code: $checkout = $modules->get("PadOnePageCheckout"); //$checkout = $modules->get("PadCheckout"); //$checkout->setShippingModule("ShippingFixed"); $checkout->setShippingModule("PadProcessShipping"); echo $checkout->render(); Any ideas? I couldn't find a lot of documentation about the shipping module, but I really need to be able to customise my shipping zones. Thanks. Paul (other than that, I'm lovin' Padloper so far!)
×
×
  • Create New...