Jump to content

kongondo

PW-Moderators
  • Posts

    7,529
  • Joined

  • Last visited

  • Days Won

    161

Everything posted by kongondo

  1. And this?
  2. Not sure if this helps? https://processwire.com/api/ref/wirefiletools/compile/ In $options, see skipIfNamespace
  3. Hi @MarcoPLY, First, apologies I have not had the time to resolve your other issue. I agree. Yes it is possible and that is the approach I have taken and currently working on. All orders have 'payment status' and 'fulfilment status'. Padloper will ship with some common status and shop admins will be able to create custom ones. Examples include: Payment Status: abandoned, paid, pending, refunded, etc Fulfilment Status: pending, cancelled, shipped, delayed, invoiced, exchanged, etc. Some will be set automatically, e.g. order paid will set 'paid' status. I'll write more about this later but it is possible to filter abandoned carts like this: // all abandoned carts $abandonded = $pages->find("template=order,payment_status=$abandonedStatus"); // by specific user $abandonded = $pages->find("template=order,order.payment_status=$abandonedStatus,order.customer_id=1100"); // by cart amount $abandonded = $pages->find("template=order,order.payment_status=$abandonedStatus,order.total_price>100"); // by cart quantity $abandonded = $pages->find("template=order,order.payment_status=$abandonedStatus,order.total_quantity>5"); Remember we will have a possibility to create discounts for customers who abandoned their carts. This is how we'll be able to identify them (depending on the point at which they abandoned their carts). Customers/Users Regarding users, I'll be seeking feedback from your guys. My current thinking is that all customers are users. There will be an option to require login for all purchases, or both login (registered users) and guest checkouts allowed. For registered users will be able to login and manage their account, track past orders, etc. As mentioned in the previous posts, they will stay in the frontend all the time. For guest checkouts, we still need to store at the very least their names and email addresses as well as postal addresses if shipping a physical item to them. In both cases, we do not store credit card details. I don't want to go there, at least now. This is where I need the input of devs. How would you like customers to be handled? I thought about creating a separate customers 'system' but the idea seemed a bit silly since ProcessWire can already handle users. Registered users will have a role, e.g. customer or registered-customer whereas guest customers will have role 'guest-customer'. Guest customers will not be able to login since they will not know their login name. I'm not sure whether the system should auto-generate a cryptic name or base it on their first and last names. We'll also generate a secure password for them. They just won't get sent this information. For registered customers, they'll be able to change their passwords (we'll use the Login/Register module). Any thoughts? Data protection issues? Security?
  4. True. Did you manage to check their docs? Are they silent on the issue?
  5. It sounds to me as if your struggle is not with ProcessWire, but with JavaScript, specifically, JavaScript + Ajax, rather than ProcessWire + Ajax. It doesn't matter what profile is being used in ProcessWire. The only thing that $config->ajax does it to detect whether an Ajax call has been sent. It returns a Boolean; true if Ajax call made to the receiving 'file' (i.e. your template file or page) or false if not. Nothing more. The parameters you send with your Ajax call are up to you. The JS framework/library you use or vanilla JavaScript you use to make the Ajax call are up to you. ProcessWire will not care :-). An Ajax call will hit the server as either a GET or POST request, so you handle it accordingly. The rules for what files/URL you can ping (I can't find the relevant posts at the moment) still apply. If you ping an ADMIN URL, ProcessWire will reject that get/post. If you ping a standalone php file within one of ProcessWire's protected folders, ProcessWire will reject that get/post. So, you can either send your request to the current page and let it include your standalone file or make your standalone file a template file of a template and ping a page that uses that template, etc. Assuming you've sent your Ajax call to a valid 'url', you can handle things server-side like any other input. You validate and sanitize the data. If you have to send user input back to them, make sure you parse it through $sanitizer->entities(). I know you said you are frustrated by the 'Google-about-Ajax' suggestions, but I will tell you the same. A good tutorial/intro to Ajax would probably cost you about 30 minutes of your time :-). If you already have jQuery, use it to make life simpler (I know,... the JS purists here are groaning ;-)). OK, to some quick example if($config->ajax) { # 1. process input variables sent via Ajax $author = $sanitizer->text($input->author);// a parameter/variable 'author' was sent by ajax // validate $author here if(!$author) // error handling here //$email = $sanitizer->email($input->email);// just an example $volumes = (int) $input->volumes;// some integer input # 2. find requested books by the named author $books = $pages->find("template=book,name=$author,volumes>=$volumes,limit=20"); $results = array(); if($books->count) { foreach($books as $book) { $results[$book->id] = array('title'=>$book->title,'year'=>$book->year,'volumes'=>$book->volumes,'co_authors'=>$book->co_authors->explode('title')); } } # 3. prepare output to send back as JSON response to Ajax call if(count($results)) $results['message'] = 'success'; else $results['message'] = 'fail'; # 4. send JSON output back to client browswer echo json_encode($results); exit;// or ProcessWire halt() if applicable } // no ajax else { } You then handle the $results JSON in JavaScript, as you wish. PS: written in browser and not tested.
  6. Use either of the the Go buttons at the bottom in conjunction with the dropdown and then, selecting 'Go back to this page'. This will reload the edit screen BUT not save the data as long as you haven't made any changes directly in phpMyAdmin. Unfortunately, the 'Go back to this page' does not seem to stick if you leave and come back to the edit page. PS: You can also resize columns :-). PS2: For connecting to remote DB, I've not come across anything that beats HeidiSQL. Locally I use phpMyAdmin, but Heidi for all remote connections.
  7. What I saw was this. But that is for paid support I realise.
  8. Maybe I missed it, but Jodit does not seem to be free?
  9. I'm wondering if it's time we considered other editors? Maybe this though is premature...
  10. I have never seen this video before. How did I miss it!? Anyway, watched it in full. Great stuff! Yeah; had that thought when watching the video Forgetting the GUI for a minute, one thing that hit me was that I'd still choose ProcessWire now in 2018 if it was still at version 2.0. You can't beat the underlying architecture, philosophy and approach. Even 8 years later, ProcessWire is still API-centric. It's amazing though how much further along ProcessWire has come since ?
  11. Isn't this already possible? It is a module like any other.
  12. I'm not 100% I understand your question. Maybe you can try combination of $input->pageNum and $pager->getURL()? E.g.: $articles->getURL($input->pageNum()); Note the caveat in the $pager->getURL() method at the above link. Could this topic be of interest?
  13. Thanks for this Jonathan. Since this is a tutorial, maybe new users would like to know, is there a way to programmatically rename the file to something related to the image, rather than renaming it to 'better.png' every time ? ?. By the way, a $p->save('your_single_image_field'); is more efficient since it will only save the field where changes have occurred. Just thought to point this out, in case the page has lots of fields, repeaters, etc. ?
  14. I don't think this is correct. If you are talking about FieldtypeDatetime, dates are stored as datetime. This is not the same as a timestamp ?; there are some 'little' differences. Sorry if I am being pedantic!
  15. I can see it on my install (although I installed it before upgrading to PW 3.0.117). What Theme are you using?
  16. Just throwing one more in there...just in case. Not open source but has served me well in the past, TagScanner: https://www.xdlab.ru/en/ Beyond tagging, renaming and moving based on custom rules makes this very powerful.
  17. Moderator Note Topic locked. Please visit the module's support forum here:
  18. Welcome to the forums @transmontis, It could be a file permissions issue. Do all your urls work fine? CSS files loaded? What does browser dev console report, especially for the missing files?
  19. There is very little difference: http://processwire.com/api/ref/wire-data/set/ This one sets the property value directly. The $key is converted to a string (e.g. $this->myString = 'my value';) $this->$key = $value; This one uses the method set() to set both a key and a value for you. I'm not sure if the $key is manipulated in anyway behind the scenes, e.g make it 'property' friendly. I've had a quick look and couldn't find anything to that effect. $this->set($key, value); You can also do (Set a property using array access) : $this[$key] = $value; Edit: Reading your thread title, there is no right way. All ways are correct and are documented ?
  20. In such cases, I always lcfirst() my properties and also make sure to remove any spaces. $key = lcfirst($sanitizer->fieldName($key));// "Size" to "size" OR "some key" to "some_key"
  21. There is. I've found that *= in in-memory searches works irrespective of case (IIRC).
  22. Hi @Basil. Sorry I missed your post. Just seen it now. Please see the first post In this thread for details. Existing users will be able to buy the new padloper at a discounted price. The discount % hasn't been decided yet :-).
  23. It doesn't matter where it is run from; as long as when the form is sent, there is a process server-side to receive it. You don't have to use Ajax. Ajax is just a method that uses JavaScript. Using Ajax does not exclude the use of PHP. You can use a normal form, no worries. Maybe let's deal with successfully submitting the form first. If you are not using a form, then you need JavaScript to submit the details without using a form (basically mimicking a form submission).
  24. @DxJR Sorry, I haven't had a chance to look at it yet. If you are able to help debug it please, that would help get us there.
  25. Hi @mke Thanks for the clarification and example. That fits into the planned separate pro frontend module. As stated, those who want to build custom frontend will have the full API at their disposal. Something like this (pseudo code, although some API is ready) // assuming user is logged in, they are redirected to My Account area $out = "<span>$user->name</span>"; // your Orders Table [orders API in the works] $orders = $pages->find("template=orders,order.customer_id=$user->id,limit=10"); foreach($orders as $o) { $order = $o->order; /* Date: $order->date; Status: $order->status; etc... */ } // Addresses [customer API 95% done] $customer = $user->customer; /* First Name: $customer->firstName; Last Name: $customer->lastName; Email: $user->email; Address: $customer->address; City: $customer->city; Postal/Zip Code: $customer->code; Region: $customer->region; Country: $customer->country; Phone: $customer->phone; // etc...including if customer is tax exemp and whethey they accept marketing. // Any custom properties added are also available, e.g. $customer->company, etc. */
×
×
  • Create New...