-
Posts
1,424 -
Joined
-
Last visited
-
Days Won
18
Everything posted by Juergen
-
module Comments fieldtype with star rating
Juergen replied to dotnetic's topic in Module/Plugin Development
I have found an error: The voting system doesnt work because the field "field_commentsrating_votes" is not present. It seems that this field will not be produced during the installation. Only the standard field " field_comments_votes" from the standard comments without rating is present. SQLSTATE[42S02]: Base table or view not found: 1146 Table '7232549db11.field_commentsrating_votes' doesn't exist -
Question: Has anyone tried to add a user image to the comments? In my case people can upload a user image to their profile if they want. Now I also offer the possibility to add a comment to products (if you are a registered user or not). My goal: If the user is logged in and he has a profile image added to his profile, this image should be shown next to his comment. If the user is not logged in or has no profile image than a avatar should be displayed instead. I have checked the database columns for the comments and there is no column which stores f.e. the user id if a user was logged in. My idea was to add a new column for user identification that stores f.e. the user id so the user is identified as a registered user and the profile image could be added via the id (because the user is identified). Has anyone tried to achieve the same or has an better idea. I use a custom output for my comments so I can add everything I want. SOLVED: The user id will be stored. In my case an unregistered user has always the id "40" and a registered user has its own id. The value can be displayed in the comments by calling it inside the foreach loop with this name: created_users_id. Example: foreach ($comments as $comment) { $userid = $comment->created_users_id; } With the id it is possible to find and load the image of the user. Best regards Jürgen
-
Its quite awesome how many items (products) are included on this site. A lot of hours of content entering.
-
PHP string replacement is what I would do. I dont think that you really need an extra module for such a simple thing. I always try to avoid JS for output manipulation because its not cacheable and depends on that JS is activated by the user. So your solution seems to me as the best way for this purpose.
-
Hello @ all, I have made my own custom comment form with Twitter Bootstrap markup in the template where the comment form is located. Unfortunately I am not able to store the entered data in the db. I have searched the forum and found some hints but it doesnt work. Here is my code that should be executed if there are no errors: $c = new CommentRating(); $c->text = $commentsvalue; $c->cite = $namevalue; $c->created = time(); $c->email = $emailvalue; $c->title = $ratingtitle; $c->rating = $ratingvalue; $c->user_agent = $_SERVER['HTTP_USER_AGENT']; $c->ip = $_SERVER['REMOTE_ADDR']; $c->created_users_id = $user->id; $c->sort = count($this->comments)+1; //$c->parent_id = (int) $data->parent_id; $c->status = 1; // just for testing $c->commentsrating->add($c); $c->save(); I use the modified version of the comment field with star rating (https://processwire.com/talk/topic/10829-comments-fieldtype-with-star-rating/ Therefore I call a new instance with the name "CommentRating" and not "Comment". After that i add all fields that should be stored in the db. Then I try to add it to my field "commentsrating" which is the comment field in my template. Here I always get the error for this function: Fatal error: Call to a member function add() on null in .... on line 307 Has anyone an idea how to store the values via API from the template correctly? Best regards EDIT: Nevermind, I did it this way https://processwire.com/talk/topic/696-quick-guide-to-the-comments-system/?p=41520
-
Another problem: If fields are declared as "required" and the fields are not filled out there will be no error message. The modal window will be closed and you have no hint that something is missing. PS.: I use Reno theme and latest dev version of PW.
-
Creating new responsive theme based on Foundation
Juergen replied to formmailer's topic in Themes and Profiles
Thats true, but it saves much time. What I like on such frameworks is, that all the files are reachable via cdn for free (maxcdn, cdnjs.com,...). This makes the loading of huge amount of data very fast.- 10 replies
-
- getting started
- responsive
-
(and 2 more)
Tagged with:
-
Creating new responsive theme based on Foundation
Juergen replied to formmailer's topic in Themes and Profiles
Bootstrap 4 is coming soon (http://blog.getbootstrap.com/) - the alpha release is out there.- 10 replies
-
- getting started
- responsive
-
(and 2 more)
Tagged with:
-
Only to mention: This only works if the number of files is set to 1. If it is unlimited (0) only the PW short syntaxes for files (more than 1) work. I ran also into this mistake and I wondered why I didnt got a result. Maybe you have to use an foreach loop if you have more than 1 file (I have not tried it).
-
You are right - thanks for the hint.
-
And I have never heard about that
-
Is there a possibility to get the size of the file? Usually I get the filesize like this: $file = "path-to-the-file"; $filesize = (filesize($file) * .0009765625) * .0009765625; // bytes to MB $filesize = round($filesize, 2);//rounding But in this case it is not possible to use the path to the file.
-
Yep I use it on frontend. I will try your suggestion. Thanx
-
This opens the file automatically if the page is called. What should be the command to open it only when a link is clicked?? Best regards
-
Got the error too, but it is really only by pushing the saving button.
-
I think you are right - I will create fields for that! Thanks
-
Hello BernhardB, thanks for your response. I create an array of the address entered in the Google map address field. $location = $page->veranstaltungmap->address;//this is the google map address field $location = explode(",", $location);//cut the address into pieces and create the array //create each part of the address with schema.org markup $street = '<span itemprop="streetAddress">' . $location[0] . '</span>, '; $postalcode = '<span itemprop="postalCode">' . $location[1] . '</span>'; $locality = '<span itemprop="addressLocality">' . $location[2] . '</span>, '; $region = '<span itemprop="addressRegion">' . $location[3] . '</span>, '; $country = '<span itemprop="addressCountry">' . $location[4] . '</span>'; As you can see I added a lot of schema.org markup to the various part of the address. This only works if the address is in the correct syntax (street + number, postal code, locality, region, country). If there is one part missing the schema.org part will not be fitting to the output. I hope it is a little bit clearer now. But you gave me a hint: I could query the google api and take this array and its content for creating schema.org markups. I didnt know that this exist - I hope there are no limitations in the amount of queries!!
-
In the description I read: but is it normal that it changes the entered address after geocoding to a certain format?? In my case it changes Plus-Kauf-Straße 1, 4061 Pasching, Oberösterreich, Österreich to Plus-Kauf-Straße 1, 4061, Österreich after pressing the save button - so it shortened the entered address. This is a problem because I have included a lot of schema.org markup and I have created an array from the whole address, where I can pick up the different parts of the address separately. If the address is in another format I run into problems. So this is only if geocoding is on. Best regards
-
Sorting children based on 2 instead of 1 field
Juergen replied to Juergen's topic in API & Templates
Parse Error: syntax error, unexpected '"' (line 45 of /home/.sites/24/site1275/web/site/templates/inc/productitems/productsblogitem.inc) It also doesnt work if the quotes are set correctly - but the error message ist not visible anymore. -
Sorting children based on 2 instead of 1 field
Juergen replied to Juergen's topic in API & Templates
No error anymore, but it doesnt grab the lowest price of the offer (3 €). It only grabs the lowest standardprice (5 €). -
Sorting children based on 2 instead of 1 field
Juergen replied to Juergen's topic in API & Templates
Yes but I got the following error message: Error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? field='offertprice', value='', selector: 'has_parent=2392, template=productpricelistitem, sort=-standardprice,offertprice' (in /home/.sites/24/site1275/web/wire/core/Selectors.php line 283) -
Source: https://support.google.com/webmasters/answer/2620865?hl=en I understand "You must create a separate url element for each URL" that each page in the sitemap has to include the language tags.
-
Hello @ all, I have created a product page where all products and their lowest price should be visible. Example: Product 1 has -standardprice 1 (fe. small size) -> 5€ -standardprice 2 (fe. medium size) -> 10€ -standardprice 3 (fe. large size) -> 15€ Same product but 3 price variation for different sizes. In addition there is also a special offer price availiable for this product: -offerprice 1 (fe. a second hand used product with a special price ) -> 3€ My aim is to output the lowest price of all in the template. In this case the offerprice of 3€; Every price is a own page, therefore I use this piece of code to find the child pages and sort it by the prices: $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice"); This piece of code sorts all the prices by the standardprice. My problem: How can I sort them combined with standard and offerprice? ? $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice AND offerprice"); This piece of code doesnt work. Is there a possibility to sort children combinded with 2 fields? Best regards Jürgen