-
Posts
1,306 -
Joined
-
Last visited
-
Days Won
13
Everything posted by Juergen
-
Does no one have a hint why the values of the fields will not be changed after the cronjob had been triggered? Here is the complete module code: <?php class AddCronJob extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Add Cron jobs for various functions.', 'version' => 100, 'summary' => 'Executing cron job tasks depending on time set', 'singular' => true, 'autoload' => true ); } public function init() { $this->addHook('LazyCron::every30Seconds', $this, 'RunOfferPages'); } public function RunOfferPages(HookEvent $e) { $currentdatetime = time(); // Get timestamp for current date $pricelistpages = wire("pages")->find("template=products"); //get the parent page with the product template $pricelistpages->setOutputFormatting(false); foreach ($pricelistpages as $pp) { $pp->setOutputFormatting(false); // without this we can't save the page later on $childpages = $pp->children("template=productpricelistitem"); //get the children with the productpricelistitem foreach ($childpages as $p) { $p->setOutputFormatting(false); // without this we can't save the page later on $offerend = $p->getunformatted(offerend); if ($offerend) { if (($p->afterofferend == "1") AND ($offerend < $currentdatetime)) { $p->pricetype = "1"; //set back price type to standard price $p->offertprice = ""; //delete offerprice $p->offerstart = ""; //delete offerdate start $p->offerend = ""; //delete offerdate end $p->save(); //save the price page } } } $pp->save(); //save the productpage } } }
-
Cron job stops working for now For testing purposes I added Ryans example code directly in a template to show if cron job triggers. // create your hook function function myHook(HookEvent $e) { echo "30 Minutes have passed!"; } // add a hook to your function: wire()->addHook('LazyCron::every30Minutes', null, 'myHook'); It outputs nothing, if this code is directly in a template, so it seems that cron job doesnt work at all. The template is not cached!!!!
-
It works now, I have changed the code to: foreach($pricelistpages as $pp) { //start foreach $pp->setOutputFormatting(false); // without this we can't save the page later on $childpages = $pp->children("template=productpricelistitem"); foreach($childpages as $p){ $p->setOutputFormatting(false); // without this we can't save the page later on $this->message("Kind"); if($p->offerend){ if(($p->afterofferend == "1")AND(($p->offerend)<$currentdatetime)){ //set back to standard price after offerend $p->pricetype = "1";//set back price type to standardprice $p->offertprice = "";//delete offerprice standardprice $p->offerstart = "";//delete offerdate start $p->offerend = "";//delete offerdate end $p->save();//save the price page } } //end foreach } $pp->save();//save the productpage } } As you can see I inserted $p->setOutputFormatting(false);
-
Hello @ all, I have a product page and several price pages as children. Here is the structure: - Product -- Price 1 -- Price 2 -- Price 3 -- etc Product is the parent page and the price pages are all children. The product page is linked and you can call it directly over an URL. The children pages (sub pages) are part of the product page, but you cannot call it directly with a link. Goal: I want to use lazy cron to change some values in the children pages (fe set another price at a date in the future) I have a module where I have place all the code, but there were no changes in the children pages after lazy cron is triggered. Here is my code: public function init() { $this->addHook('LazyCron::everyMinute', $this, 'RunOfferPages'); } //RUN CRONJOB //OFFER PRICES public function RunOfferPages($event) { $currentdatetime = time(); // Get timestamp for current date $pricelistpages = wire("pages")->find("template=products"); foreach($pricelistpages as $pp) { $children = $pp->children("template=productpricelistitem"); foreach($children as $p){ if($p->offerend){ if(($p->afterofferend == "1")AND(($p->offerend)<$currentdatetime)){ //set back to standard price after offerend $p->pricetype = "1";//set back price type to standardprice $p->offertprice = "";//delete offerprice $p->offerstart = "";//delete offerdate start $p->offerend = "";//delete offerdate end $p->save();//save the price page } } } $pp->save();//save the productpage } } I guess this line of code doesnt grab the children: $children = $pp->children("template=productpricelistitem"); I have used cron for parent pages and it works, the problem is only at children pages. It seems that they wont be affected with these lines of code. Has someone an idea how to make it work on childpages - I cannot call them directly to trigger the cron job because they are only a part of the parent page. Thanks in advance
-
Thanks Wanze and LostKobrakai, I changed the path to /home/.sites/24........ (absolute path) and now it works. It was a path problem. Why it works in the past with the old path - ?? Problem solved! Best regards
-
Hello Stefan, I am using the latest dev 2.7.2 and PHP 5+. The var-folder is in the root, but this was not a problem at all. Here are some screenshots of uploaded files in the past, which are still located in the folder: As you can see the files are still there. As I pointed out - the folders have permission 777 (only for testing) so they are writeable in any case and they are still there. Best regards Jürgen
-
Another problem: Cannot upload files with the latest version 1.0.1 of secure files. I have detected that upload of files is no longer possible with this field type in my case. I cannot point out the exact time when this problem starts because I havent upload secure files for a longer time. In the meantime I have updated PW more times. The upload has worked in the past but now I get the error message, that the folder doesnt exist or is not writeable. I store all the files in the folders var/securefiles and these folders exist: All folders has the permission 777 for testing purposes My settings of the input field: And this is what I got if I had tried to upload a file: Help would be appreciated Best regards
-
Oh, I have installed it a longer time ago, so I have forgotten that it is not in the Modules directory right now. Adding a "add new page" feature would be awesome!!!!
-
Thanks for the changes! BTW if you have time, it would be great if you add update information to the module so it would be fetched by PW updates. At the moment FEEL doesnt appear under this section and I have to look manually if an update is available or not. I hope it is understandable what I mean Best regards Jürgen
-
How to use pw to create a guestbook like functionality ?
Juergen replied to adrianmak's topic in General Support
I dont know what you exactly need in your guestbook but why dont you use the comment field as a guestbook? You can style it in the way you want with overrides. -
Hello @ all, General question: CKEditor provides the ability to upload images directly in the editor. On a page I have 2 image upload fields - one should be for uploading images via the editor, the second one is for an image gallery. By clicking the upload button in the editor the 2 upload buttons will be displayed - the one of the gallery and the other one for the editor images. I only want that the upload button for the editor images will appear and not the one for the gallery. Is that possible. Best regards
-
If area size is used to control the dimensions it would be difficult to create an error message. If specific sizes are used for portrait and landscape format it should be no problem. With php you can check if the image is in portrait format or landscape format and therefore you can output the specific message. "The size of the uploaded image is lower than the allowed size of 400px/600px. Please upload a larger image". And no I dont think that this procedure is complicated for clients. This is what I did at the moment. But my goal is that the images in the lightbox view should have approx. the same size. I dont want one picture with 400x400px and another with 400x600px in the lightbox view. I want to achieve more consistency. That was the reason for this posting.
-
It would be great to add this module as part of the core image field: https://processwire.com/talk/topic/8079-imagefocusarea/ It is very useful especially if you are dealing with portrait images of person (fe teammembers). Best regards
-
New bug? If the image field is loaded via Ajax then the click of the focus-link will be redirected to the homepage instead of opening the image in modal frame. For explaination: I have an image focus area field inside a fieldset. I have decided to show the content of the fieldset only if i click on the fieldset and the content will be shown afterwards via Ajax. In PW you can choose under the fieldset setting tab when to show the content (open, open only if there is content inside,...). If I choose to show the content via Ajax the image focus area field doesnt allow to set a focus area. After clicking the link I will be always redirected to the homepage. If I change the fieldset status to something without Ajax (fe always open) the image focus area field work as expected. Maybe this could be a bug if other users have the same problem. Best regards
-
It would be great if the minimum dimensions of uploaded images could be set differently for portrait and landscape format and not only in general. In my case I have added a lightbox on the frontend for the uploaded images. So if an image is in landscape format it should has a minimum width of 600px (and a proportional height of approx. 400px). If I upload an image in portrait format it should has a minimum height of 600px (and a proportional width of approx. 400px). The reason is that all images should have approx. the same size for the lightbox view. I run into troubles if I add minimum dimensions of height and width at 600px, because a portrait format in the dimensions of height:600px and width:400px will be abortet, because the min. dimension for the width is set to 600px in this case. For the lightbox view the size of the image would be ok. At the moment it is only possible to add height and width minimum dimensions for the image in general. So a sepearate setting field for portrait and landscape formate would be great. Best regards Jürgen
-
I dont know which JS causes FEEL not to work properly. I deleted some JS which works with onload property and my aim was not to make FEEL work - it was a positive side effect. So I didnt take care of the JS names and functions - I only deleted some of them.
-
Maybe there was an JS conflict that makes FEEL working not properly. I have deleted some JS files that I dont need anymore and now FEEL works as expected.
-
After installing it crashes my site. I always get an error 500 (frontend and backend) Error: Exception: You do not have permission to edit this language (in ......./web/wire/modules/LanguageSupport/ProcessLanguageTranslator.module line 79) I was logged in as superuser. What can I do? Best regards Edit: I deleted the files via FTP and now I can login as usual and the frontend will be displayed as expected
-
I will try that tomorrow and post the result here. Thanks for your effort Best regards
-
Yes this file is also added at the end en m\u00f6chten?"}</script><script src="/site/modules/FrontEndEditLightbox/FrontEndEditLightbox.js"></script></body></html>
-
Maybe I have done something wrong, but the edit link will not be displayed, because it is set to "display:none!important" inside the added <feel>-tag. Jquery is loaded. Also the other files (modal.js and fredi.js) are loaded as well. Link is included in the template via echo $page->feel(array( "text" => "Edit this page", "class" => "fixed left" ) ); Are there further steps required to make the links appear? Best regards
-
Does no one have this problem too?? Rendering of form in frontend doesnt grab the settings made in backend. I have upgraded to 2.6.22 dev but same result.