Jump to content

apeisa

Moderators
  • Posts

    4,632
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by apeisa

  1. I have nasty problem that I am having hard time debugging. I have two modules. First one is called TapuFormsProcessing and it has this method: public function ___getEventPrice() { $price = $this->event->price; return $price; } Other one is autoload module that needs to replace that value if certain circumstances are met. This is singular and autoload and has one hook: public function init() { $this->addHookBefore('TapuFormsProcess::getEventPrice', $this, 'martatPrice'); } This "martatPrice" method is little bit complicated than that - but I have only relevant stuff here: public function martatPrice(HookEvent $event) { if ( ! $this->session->reg_id > 0) return; $page = wire('pages')->get($this->session->reg_id); if ($page->id) { if ($page->price_member > 0 || $page->price_member === 0) { $log = new FileLog($this->config->paths->logs . 'customprice.txt'); $log->save("$page->title ($page->id): $page->price_member ({$this->session->reg_id})"); $event->replace = true; $event->return = $page->price_member; } } } What is weird here is that what goes to log is always right. So the logic (that I have mostly stripped there) works right. But sometimes that replaced method still returns the original price. I am little stuck since I don't know how to debug this. I tried to remove $event->replace and change it to after hook - but then it never modified the return value on TapuFormsProcess::getEventPrice. Not sure if I missed something simple on there? I am using templates cache (but not on these event templates), other one of the modules is symlinked, both modules use session data (though those are always right based on logs)... I don't know if those can affect it, since I don't really now how the hook system works. Of course (and probably) the bug is somewhere else than in hook system - but I have hard time debugging that. This is how TapuFormsProcess() uses it's own method: $price = $this->getEventPrice();
  2. You don't know what it is like here. Always mixing English and Finnish: foreach($blocks as $palikka)
  3. foreach($blocks as $block)
  4. This looks interesting: https://github.com/IcecaveStudios/woodhouse#readme It would be great to see if latest dev (or any other branch) passes all the tests.
  5. I think pw would benefit hugely from well done commercial and/or free profiles.
  6. nn_basic_page_file contains Pagefiles object, which is inherited from WireArray, which is actually an object that PW uses pretty much everywhere. It is neat concept and makes working much faster than with regular PHP arrays. See more from here: http://processwire.com/api/arrays/ So from that link you find all the ways to find files from your field. Some examples: //first, this makes it all nicer: $p = wire('pages')->get(1001); $first_file = $p->nn_basic_page_file->first(); // like wanze showed above $second_file = $p->nn_basic_page_file->eq(1); $random_file = $p->nn_basic_page_file->getRandom(); $specific = $p->nn_basic_page_file->get("filename=myphoto.jpg");
  7. $wire->pages->get(1001)->nn_basic_page_file->pagefiles->delete(); Where do you get that pagefiles? Also, if you use delete(), you need to specify which file you are removing. This might be what you are looking for: $wire->pages->get(1001)->nn_basic_page_file->deleteAll();
  8. http://processwire.com/api/cheatsheet/ $filefield->delete($file) requires actual file object as a paremeter. $filefield->deleteAll() deletes all the files.
  9. apeisa

    Hit 1000+ likes

    Soma is always there willing to help. Really deserved likes!
  10. Not sure, but I think it was 2009 when nik changed to mosaic from lynx...
  11. That should be easily doable with repeater. Or using pages as slider items and just choosing active ones using page field.
  12. One word: super brilliant!
  13. Hi Jacked and welcome to forums. Not sure what is the problem you are trying to solve. But yes, it is minor annoyance that you have to always choose the language when creating users (the default lang should be ticked by default, I think).
  14. Nico, can you provide any examples of what kind of permission/roles would be beneficial in your use cases? I am not keen on complicating permission stuff just because there is only 9 default permissions (I think it is great to have just few).
  15. I had the same error once: try removing the /wire/ folder and uploading it again: http://processwire.com/talk/topic/1492-processwire-23-features/?p=23148
  16. Tyssen, I think that is the cleanest solution, if you want to support multiple categories per product. Multiple urls for same content: yes, possible seo problem, but as far as I know with using canonical url meta tag you can avoid that: http://googlewebmastercentral.blogspot.fi/2009/02/specify-your-canonical.html Of course one url should be the "real one" where others refer.
  17. That is the main drawback actually. I am soon mastering willyc - Klingon - Finnish translations and don't want to Google to mess with it.
  18. See the htaccess file, there is a mention about ~ char.
  19. Polite no to Google translate. It's nowhere close to handle translations without causing more hassle.
  20. Yep. If using id or $config->specificPageId isn't enough, then I think best option would be to create new fieldtype (globalName), which keeps names unique in global space. Then adding the new field as a global (if really wanted for everything). This would be as effective as having it as a core module. Clearly a good place for a module, not to core feature in my opinion.
  21. So you mean instead of: $pages->get(1919); // grab the teams-page You would like to have: $page->get("teams");
  22. Not familiar with PCI compliance, but at least in my understanding as long as you don't collect and/or store credit card information you are on the safe side already. No need to have whole store on 3rd party, just from the point when credit card details (or other payment details) are collected and processed. This of course adds one more step for client (moving to other service for payment), but you can stay away from collecting sensible information. What comes to your needs: I think you should at least try my ecommerce module for it. It already has support for adding payment methods, but also support for additional shipping methods (you could create your own which calculates the shipping cost based on ZIP code). So definitely good fit for PW ecommerce in my opinion. https://www.braintreepayments.com/tour/pci-compliance
  23. Diogo: if I understood right he is using pw to serve json for iPad app.
  24. Why not getting touch with whoever that reserved processwire.de and ask for their plans?
×
×
  • Create New...