-
Posts
7,479 -
Joined
-
Last visited
-
Days Won
146
Everything posted by kongondo
-
[SOLVED] Add class to FieldtypeTable before outputting it
kongondo replied to dotnetic's topic in API & Templates
Try this: $inputfield->class .= ' your-classes';// @note the space -
I believe so :-).
-
OK. I only tested with one repeater and the sort order worked (i.e. sorted by the values in the float). I'm still not getting your setup though. How many Categories can be selected per repeater item? A screenshot would also help.
-
Do you mean you are no longer using a page field but a Select Options field? I.e., the category field in the repeater in your person template, is that a Select Options field rather than the original page field you had? If that's the case, two things: In your code, I don't know what $category is. In an Options field you cannot use an object as a search value You will need to search for a string within the Options field 'title' subfield, like so: $category='Category 1'; $people = $pages->find("template=person, results.category.title=$category, sort=-results.value"); If my assumption above is wrong (i.e., you are still using a page field), then you probably have a typo somewhere?
-
Ah, I see, thanks. I have the discount GUI sorted but not yet implemented (looks similar to shopify), but no harm in considering an alternative. So, yeah, I'm happy to look at some screens ?
-
Uh, I'm not sure I follow. The new Padloper can already do all the things I listed above as achieved :-). We already have a fully functioning discounts class. I've edited my post above to be more clear.
-
Is this a personal site? You can use the API to upload images as well as resize them.
- 17 replies
-
- 1
-
- images foreach
- images
-
(and 1 more)
Tagged with:
-
Definitely! Good point.
-
News Update - 10 October 2018 I know many of you are eagerly awaiting the next version of Padloper. I thought I'd give you a couple of updates regarding progress. First, I'd like to thank you for the feature requests and your support. As previously stated, it will not be possible to accommodate all requests and those that may be accommodated may have to wait till other releases. OK, to the update. The following have so far been achieved. FieldtypeProducts A new Fieldtype for storing products including their variants, if any. This allows for easy retrieval and storage of data and and API that makes it easy to filter, search, manipulate, update, etc product details. So..: $foo = $products->find("colour=red,quantity<10"); $bar = $product->first(); echo $bar->size; echo $bar->price; // etc Discounts We have a new discounts class that allows for 4 types of discounts each with generic and specific requirements. Percentage discount Fixed amount discount Free shipping discount Buy X Get Y discount In turn, as applicable, the discounts are subject to generic conditions including customer country,named customers, customers subscribing to your newsletter, global usage, customer usage limits, customers who abandoned carts, start/expiration dates, etc. There are also discount-specific conditions including whether to apply discount to entire order, specific products or specific categories/collections, minimum requirements (purchase amount or quantity of eligible products in cart), etc. Import/Export Products This class allows for importing products into your shop as CSV, JSON or arrays. It is 98% done. It will also allow for exporting products as CSV (and maybe in future, as JSON, if there is demand). MarkupPadloper This is WIP to eventually replace PadRender. This allows for retrieving products, product tags, product categories, etc, either as ready-to-render (i.e. includes the markup) vs retrieving the raw product details so one can use their own markup, anywhere, anyhow, to output products. Other A bit of work on customer notifications (including email templates) and FieldtypeOrders for orders plus some other stuff. I got a lot to do, so I better get cracking! ? Thanks for reading.
- 270 replies
-
- 25
-
Great! Your illustration reminded me to edit my previous illustration because to the casual eye it would look like the categories under each person were child pages rather than page fields within the person pages ?
-
That's perfectly fine. It doesn't matter and it is not an issue. Devs do this all the time. That's OK. By the way, you'll find that 'all PW fields' are in a sense custom DB tables :-). By this is meant that there is no field that is actually required (yes, even the Title field, although by default it is marked as a required field in templates :-)). I get your point though - you don't want to create a custom field. Definitely! At its most basic usage, a page is basically an entry (a row) in a database table called 'pages'! :-). Yep. I suggest you read this classic post: OK, some code (untested). Example code to use in your Results page template file. // results page // will hold our output $out = ''; // get categories {limit and use pagination if you have lots of categories} $categories = $pages->find("template=category,limit=10"); // make sure we got categories if($categories->count()) { foreach($categories as $category) { // @note: use limit if you have lots of 'people'. // assumes the page field in the 'people' template is called 'category' $people = $pages->find("template=person,category=$category"); // skip category if it has no 'people' OR you can just output below 'no people/users', etc if(!$people->count()) continue; $out .= "<h2>{$catergory->title}</h2>"; // list users under this category // newish pw api rather than another foreach here. // @see: https://processwire.com/api/ref/wire-array/each/ $out .= '<ul>'; $out .= $category->each(function($c) { // append any applicable data you wish here; e.g. $c->bio (if people have a textarea biography field, etc) return "<li>$c->title</li>"; }); $out .= '</ul>'; } } // print out the output echo $out; That should result in something akin to: <h2>Category 1</h2> <ul> <li>Person 1</li> <li>Person 2</li> <li>Person 3</li> </ul> <h2>Category 2</h2> <ul> <li>Person 1</li> <li>Person 3</li> </ul> <h2>Category 3</h2> <ul> <li>Person 2</li> </ul>
-
Have a look in the file system for the 'created' image thumbs (/site/assets/files/1234/, where 1234 is the ID of the page with the images. Were the 250 by 250 image thumbs created correctly or they are not viewable/blank? Also, what size are the images you are uploading?
- 17 replies
-
- images foreach
- images
-
(and 1 more)
Tagged with:
-
What does echo $page->images->count() return;?
- 17 replies
-
- 1
-
- images foreach
- images
-
(and 1 more)
Tagged with:
-
Could be your server is running out of memory maybe? No white screens or errors? Just guessing. See this thread as well.
- 17 replies
-
- images foreach
- images
-
(and 1 more)
Tagged with:
-
Just to clarify my post above, @ampersand83, my answer is in reference to bulk adding/editing tags. In the upcoming version, media will be edited in a modal in its original page. Hence, you will be able to use any tags input as normal.
-
It doesn't look like they are massive (size), so, maybe yes, one or two more. I'm happy with the dark theme, so I am biased ?.
-
Welcome to the forums @ratna, Sounds painful! ? You can use them for anything. Routers, Containers, Pages, Settings, etc. With access control and/or published state and/or (in)existence of a template file, url (permalink) will throw a 404 or can be forced to redirect. Also, a page does not necessarily have to be viewed in its own template file. So, your results can be output anywhere...in your home template file, in another page, etc. Back to you main question. Some people say reading this helped ? Your Page tree could look like below. Note, to avoid confusion and possible overwriting of system variables ($user and $users are API variables), I'm using Person and People respectively. |-- People |-- Person 1 |-- Category 1 {this is not a page in the page tree; it is a page field} |-- Category 2 { -ditto all below -} |-- Person 2 |-- Category 1 |-- Category 3 |-- Person 3 |-- Category 1----------< |-- Category 2 | | |-- Categories | |-- Category 1 -----------------^ |-- Category 2 |-- Category 3 We use People as a container for each person (what you called user). People can have a template called 'persons' with a matching template file 'persons.php'. We can use that to display all persons. Person can have a template named 'person' with a matching template file called 'person.php'. The template person can have several ProcessWire fields, other than title. For relational data purposes, we create a multi-page field called 'categories' which can only contain 'category' pages. We add that to the 'person' template. Now you can choose what categories a user will have ?. The category pages can have a template called 'category' and matching template file...you know the drill by now. Same goes with their parent, 'Categories', with a template 'categories'. With the above setup, you can search and list users by category and vice versa, search for categories and list the users under them. Hope this helps.
-
Hi @ampersand83, Many thanks for the purchase. Welcome to the forums as well :-). Predefined tags in ProcessWire are relatively new. Updating Media Manager to include the feature is planned, although it may not make it in the next (soon) release.
-
Glad you got it sorted ?
-
MathParser adds Intelligence to your Number Inputfields
kongondo replied to bernhard's topic in Modules/Plugins
Great! I forgot to clean up some copy-paste comments here ? -
File a report here please.
-
It doesn't work ?
-
MathParser adds Intelligence to your Number Inputfields
kongondo replied to bernhard's topic in Modules/Plugins
Nice one @bernhard, A couple of thoughts: Always safer to deal with IDs rather than names. If I have a float field called 'price' and tomorrow I decide to change its name to 'unit_price', MathParser code would not find it (unless of course one is using the autoload feature, in which case it might still throw the warning about field does not exist). The superuser would be forced to change the config. I've noticed assets (MathParser.js, MathParser.css and math.js) are loaded in all Page Edits, even in ones where it is not required or where there are no compatible fields. Maybe there's no way to get around this? We started on the premise that we are lazy ?. So why not take lazy to its logical conclusion? Below, I present lazy max! I've changed the module config textarea inputs to ASM Selects. The descriptions are just dummy text. Only compatible fields (float, integer, decimal [do we have a Fieldtype like this?]) are listed for selection. I don't have a Gitlab account, so I've attached a zip file with the php files to this post. Having said above. The module did not work for me (even before the changes I made). Shouldn't it be auto-triggering? Demo MathParser-kongondo-edits.zip -
...Or if you use _init.php, define $homepage there and it will be available in all your template files :-).
-
Moderators Note Just a quick update. We've consulted and agreed that the topic remain locked as per the reasons expressed by @horst above. Thanks.