-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
Your welcome, yeah some more search options would be great. Yes, that would be a great addition and fun to do module. I don't know when I will have time, but would like to participate. I would also first have to try and look at the current shop module and maybe start with something simple first and extend further step by step.
-
Thanks apeisa, you rock! I haven't got the time to take a lock at new version. I'll at weekend. I got a little snippet you might find useful, and consider implement it. public function ___executeSearch() { $this->fuel->breadcrumbs->add(new Breadcrumb('../', 'Orders')); $this->setFuel('processHeadline', $this->_("Order search result")); $id = (int) $this->input->post->searchquery; $result = new PageArray(); $result = $this->pages->find("template=sc-order, id=$id, include=all"); $result->import($this->pages->find("template=sc-order, sc_payid=$id, include=all")); $out = ''; if(count($result) > 0) { $out .= "<h2>" . sprintf( _n("found %d order", "found %d orders", count($result)), count($result) ) . "</h2>"; $out .= "<ul>"; foreach($result as $order) { $date = date($this->config->mydateFormat,$order->created); $out .= "<li><a href='../edit/?id={$order->id}'>#$order->id, #$order->sc_payid, $order->title, $date</a></li>"; } $out .= "</ul>"; } else { $out .= '<p>'.$this->_("No orders found").'</p>'; } return $out; } // i didn't use PW field style, but simple form markup on top of order overview $out .= "<form action='./search/' method='post'>"; $out .= "<label>Payment ID: </label><input type='text' name='searchquery'/> "; $out .= "<input type='submit' name='submit' value='suchen'/>"; $out .= "</form>";
-
Edit: oh hi and welcome gcplan, glad you found us! I think you'll have no problems to make a custom integer fieldtype/inputfieldtype module, that would check for a certain range and output an error when saved. It's possible to create field setting you would be able with 2 integer fields to enter a upper-lower bound. You could even implement jquery script to check on runtime before saving. Jut have a look at how the PW integer,float,text fieldtype/inputfieldtypes are done. I think you'll have no problem if you're fluent in php. PW makes it very easy to do what ever you like in that regard.
-
AAA, BBB BUUUMMMM my head explodes. What? I don't get it.
-
Progress on ProcessWire 2.2 and overview of multi-language support
Soma replied to ryan's topic in Multi-Language Support
Cool apeisa, just was thinking about this after writing the post. The translatable default text in templates could be used as keys like. Then having an _front-end_ english pack installed would do the trick. Acceptable solution I think. -
Progress on ProcessWire 2.2 and overview of multi-language support
Soma replied to ryan's topic in Multi-Language Support
I'm currently using translation in my front-end and I was thinking about the matter and how it really works. So if I decide to go and change a single letter or word in the default text code in a template, all translation originating from this phrase will get obsolete and need to be translated/entered again. Since it isn't key based translation, I'm not sure again, if it's still a good/the best choice when doing heavy multiple language site development. I feel it could get frustrating, when once all languages are in place and you spot a typo or decide to change the word or phrase, all languages need to be updated again as well even if it isn't needed. What are your thoughts about this particular problem? -
Thanks apeisa! Glad you found it.
-
Wasn't there a related issue where it turned out it had to do with some strange php security module, that wouldn't allow certain/multiple post vars. I'm not sure and couldn't find it.
-
Yes, that's certainly a good new way to do variations. Then it would be a little different dealing with the product id, as with child pages it's easy. So the id in the cart saved will match that variation. That sounds great! Yes the dependency of the orders management module on certain fields will make it a little harder to make it flexible, but it may could be handled as "custom-fields". Then those are only informational and there could be some sort of standard output of those on order detail page. Also what I have implemented is a little search field to search for a payment,order id. Just as an simple process function. I think it also would be cool to have a per year or month, day filter in the overview. Just as example. You're right. We should wait until things are more settled. It's also easier to see as you move along. I'm sure it will be great! I don't want to bother or interupt. I think once you got the most basic version finished, it will be a lot easier for me or others to help coding and extending if needed.
-
Really nice to see this taking shape, thanks apeisa! I'm currently looking into your new version and at what I've done to your previous version. Also looking at what I've done with the current shop I'm still working on. It got delayed because of missing content, images etc. There's a couple things I'm thinking about the different parts and how they could be extended or made flexible/configurable in some parts. Module Cart Looks good and somehow still the needed basic functionality. I'm asking if it would be possible to include variations ( simple child-pages approach ) into the cart model? This would only require to change the following functions: - getTotalSumFromItems() - renderCart() // though I've done the cart rendering in a template I created "sc-cart". In my version I just done it like this: // see if variant page has price field // if not choose from parent product page if($product->sc_prize) $total_price = $item->qty * $product->sc_price; else $total_price = $item->qty * $product->parent()->sc_price; ... Maybe I could make a fork and try to implement those myself? What you think? Also I see something for "shipping costs" is needed in the cart rendering, and of course in the order management. What have you planed on this? Maybe it would in some cases be useful to have some discount based on the total cost, and no shipping costs after a minimum of total costs too. Those are thing commonly need in shops as I see it. Checkout Module As with the previous version, I see you still only basic fields for the order form. I think it would require some more in most cases. - Having a gender is questionable but definately something to consider. Event it not needed at the end it would be there. - I would see having a "prename" "lastname" instead of full name - Instead of address having a textarea, I think it would be better to have "address" for street, "zip", "city" and "country" separate Regarding the order template and complete order, I think there will be some more fields needed. - 1 field for the "payment_id" as some payment services generate a payid in addition to the order_id, that comes from the shop. - Depending on the payment service, there's possibly some more fields that could be useful, like payment card type used, last 4 digits of card, if the order wasn't successfull theres error codes provided. I have no idea as of now how this would be doable in the current model. I think some sort of basic set of fields that would serves for all payment types would make sense? Or would it be possible to make configurable to add custom fields to the order, so it would be dynamicly handled depending on a config and saved into a text field serialized? I have hard time seeing through this. Also how do you plan doing the validation on the order form? I currently have the whole shipping-address-completeorder-to-payment process handled in 1 template with custom validation class. In my current shop, once the process is complete I save order using shop API with status "not-complete". Also in same template it handles the return from the payment service, changing the state of the order to "complete". But because the payment method I use is on demand, with authorisation for the payment, I need to have a status "payed" once it's payed and "processed" once it's shipped and done. --- Basicly I'm trying to get a clearer view of what module should provide what function. How could hook-able functions being useful here and for what? Also I really would like to bring in my experience from the current shop I'm doing, which seems to have little different requirements than yours. And see if it could be done without touching the module codes. But I have a hard time doing so still
-
Awesome! Yeah first! Now going to look at video.... Edit: Looks really great! Thank you for this preview! For sure very useful. Now my question. Would it be any way possible to have to be able define multiple "block" templates (with different fields each) for the repeater field? Then when adding a new item, it would ask for the block template to select first. Pretty much the same as it is now, just with variable templates. I can imagine it would require something complete different concept/codewise. It's just what I kinda "expected" from (the) repeatable page element, so I don't have to use child pages anymore. It can be very handy to be able to define "blocks" that can be chosen from, to build a page. TItle, Video, Text-Image, Linklist, Text. Do you see a good way to add such "variable blocks" feature to PW through a module, much similar like this one? Maybe they're also just invisible childpages that are editable and sortable via the parent page's block field. Just blah blah, I don't really know what all need to be considered. Have you implemented this repeater using hidden pages?
-
Only new file and copied over? Have you tried rewrite the line of code that causes the issue from scratch? You laugh, but I got an situation where it just wouldn't work with a selector, turned out there was a hidden char not visible at all even in "showinvisible" mode.
-
Strange as trying to track it down, I can't really tell why you get this error as to my understanding it isn't where it looks for if there's a "!=" in a selector string in PW. Here is the selector class: https://github.com/ryancramerdesign/P21/blob/dev/wire/core/Selector.php
-
elmr, I just tested for empty textfields in my local pw2.1 install, and it works fine. There must be something strange going on, like apeisa said. Edit: Maybe try a table database repair? Not sure what that error is all about. Waiting for Ryan is always the last resort Edit: Possibly also try to check if you got mal formed code, or any hidden chars. Even if you think its ok, it good to write new code in another file and try. The error suggests that you use a selector that isn't matched like "*=, %=, = ..."
-
yup it seems to work. ehrm paranthesis would be for things like ("body='no, I can'") ?
-
Just tested and it works fine in 2.2. Also if you use "youtube_id=, limit=10" you should use "youtube_id='', limit=10". Otherwise it assumes the limit is the value to be checked and won't work (in my local install) I don't think it's any different in 2.1. Would have to test. You can just use "youtube_id!='', limit=10" and it should work fine, I remember using it even in 2.1. Maybe Ryan got some more insights.
-
Edit: I think it's not possible Edit: or is it "color=null" ? Hmm
-
For text fields, yes color=0 will also work. [Edit: Maybe not the best one]. Thanks apeisa! I got another one also possible: $pages->find("color=''");
-
Ok, then Pete's example should work. Can you provide more informations what you're trying to do? What kind of textfield? Make sure there's really no value. Can you show some code?
-
Just wondering, are you using the ColorPicker module for this field? Just because you mention color as example. If that's the case it returns "FFFFFF" as default value, if nothing else yet saved. Considering it, it may not the best default value for a colorfield.
-
You mean why "$page->children()->children()" didn't work? ("$page->parent->parent" actually works to get the grandparent of a page.) Well it's simply that "children()" returns a 1 dimensional page array, so it works only with 1 explicit parent. As it would have to do a multidimensional page array which doesn't exists as far as I know. So a simple loop is needed here like diogo provided. Though I would do it with some check and a little simpler. Also there's a typo in the example of diogo. $channels = $pages->get(5766)->children(); foreach($channels as $channel) { if($channel->numChildren){ // has any children? echo "<h3>" . $channel->title . "</h3>"; foreach($channel->children() as $videopage) { echo "<p>" . $videopage->title . "</p>"; echo "<p>" . $videopage->videourl . "</p>"; // or whatever you need } } } Remember you could also add selectors to children("string"). Or if you want just to get all videos, you can use the ones diogo showed, but I'm not sure it will work or return a page array with only using "$pages->get("template=video")". I think something is missing, usually "get()" returns a single page. Following is the best method to use. You could limit it to the "Video" branch, so it doesn't need to scan whole site. $videos = $pages->get("/videos/")->find("template=video"); foreach($videos as $vid){ ... Or what I think diogo wanted to write is something like this. $videos = $pages->find("template=video"); But this will search through whole site structure. Something you might want to limit.
-
Thanks for bringing this up! Good to know, for sure something useful and needed in some projects.
-
Just tried again, and this time I turned on debug . Ok why didn't I do that before... idiot. Warning: Unknown: open(/Applications/XAMPP/xamppfiles/htdocs/.../site/assets/sessions/sess_529b6c6c041378cc9f28b165bf8bd0d3, O_RDWR) failed: Permission denied (13) in Unknown on line 0 Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/Applications/XAMPP/xamppfiles/htdocs/.../site/assets/sessions) in Unknown on line 0 So it seems I've to set the permissions again. It's working!! Whow. What would you suggest setting the permission in this case on macos? Doesn't it change when I upload these folder to ftp?
-
Ryan, url is /processwire/ and when submited still same url. It does only show login error when I enter a false password. Really strange, it works great on real server, just not on my local one. I use XAMP, and got many PW installs working normal. I transfer files import db and the site is working normal, just can't login.
-
Nice work on this apeisa. I've looked at the code. Since I worked with the first incarnation of you shop module. It's good you simplified a lot and made it more structured. It's a shame I won't be able to use your new version in my current shop project as is, as my version now has some special features/functions I implemented, some of which are very specific to the project including product variation and multilanguage. But anyway good to see you progress on this, as I'm sure it will be also helpful to other people and projects. One thing that struck me is, why did you move some cart "functionality" to the checkout module? Like the cart form, update, remove stuff. Just wondering, as I got it tied with the cart and not the checkout process. To me the cart page, is still something that belongs to the cart and not the checkout process, but maybe I'm wrong here. I haven't got the time to go through all, but here's some I got implemented in the cart. Ajax: I got it progressively implemented in my shop, using jquery ajax and have the cart return json in case of an ajax product add. I ended up having the ready function like this: public function ready() { if (!($this->page->template->name == "sc-cart")) return false; // insert product if($this->input->post->product_id) { $product_id = (int) $this->input->post->product_id; $qty = (int) $this->input->post->qty; $this->addProductToCart($this->pages->get($product_id), $qty); // if requested through ajax, requested through script.js ajax call if($this->config->ajax){ $response = array(); $response['cart_count'] = $this->getCurrentCartCount(); $response['qty'] = $qty; $response['product_title'] = $this->pages->get($product_id)->parent()->title .", ". $this->pages->get($product_id)->title; echo json_encode($response); exit(); } else { // normal http request $this->session->redirect("./"); } } // update cart if($this->input->post->update) { $this->updateCart($this->input->post->items); $this->session->redirect("./"); } // remove item from cart if($this->input->get->remove) { $product_id = (int) $this->input->get->remove; $this->addProductToCart($this->pages->get($product_id), 0); $this->session->redirect("./"); } // go to checkout page if($this->input->post->checkout) { $this->updateCart($this->input->post->items); $this->session->redirect("../checkout"); } } "$this->pages->get($product_id)->parent()->title" As you can see here is something that comes from the variation implementation I got, it gets the title from the product from the parent page, as the variations are done through child pages. So I also got a function getCurrentCartCount(); to return total number of items in cart: public function getCurrentCartCount() { $sid = session_id(); $result = $this->db->query("SELECT items FROM {$this->className} WHERE status = 'in_progress' AND session_id = '$sid' ORDER BY last_modified LIMIT 1"); if($result->num_rows == 0) { return 0; } else { list($items) = $result->fetch_array(); $items_array = json_decode($items); $count = 0; if(!empty($items_array)){ foreach($items_array as $item) { $count += (int) $item->qty; } } return $count; } } Here's a sample of my ajax script that enables add to cart through progressive enhancement. // cart ajax progressive enhancement $('form.add-to-cart').submit(function(){ var cart_url = $(this).attr('action'); var prod_data = { "submit": 1, "product_id": $(this).find("input[name='product_id']:checked").val(), "qty": $(this).find("input[name='qty']").val() } $.ajax({ url: cart_url, type: 'POST', data: prod_data, datatype: "json", success: function(data){ // parse returned data string var resp = $.parseJSON(data); if(resp.qty < 1) { showMessage("success", "Der Artikel <b>'" + resp.product_title + "'</b> wurde entfernt."); } else { showMessage("success", "Der Artikel <b>'" + resp.product_title + "'</b> wurde Ihrem Warenkorb hinzugefügt."); } updateCartCount(resp.cart_count); }, error: function(data,status,error){ showMessage("error", "Fehler: Etwas ist falsch gelaufen. Artikel konnte nicht hinzugefügt werden. Error: " + error); } }); return false; }); To have the price being variable, I just had to adapt everywhere where it looks for the price or outputs cart stuff. I've done it so: The product ID will be always be one of the child pages. So either 1 or more variation. So even if it's a product with no variations, it is created via the main product page and at least 1 (the first) variation. This can simplify a lot, as it's always the same and only needs little adaption. // see if variant has price field // if not choose from parent page if($product->sc_prize) $total_price = $item->qty * $product->sc_price; else $total_price = $item->qty * $product->parent()->sc_price; $total_sum = $total_sum + $total_price;