Jump to content

Batyr

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by Batyr

  1. Thank you @gebeer for this awesome tutorial. I have an issue with PUT request. In the step 4.1 test the PUT request, it didn't work, although i entered Basic Authentication method: username: myapiuser and my the password as my own set key. Any help is greatly appreciated! Thank you in advance!
  2. Hi everybody, I also have the same problem, I developed my website locally and the uploading pictures part worked just fine. After a certain period of time when I wanted to add a new child of the page and upload image it won't work. It shows nothing. BUT when I edit the pages that I have already created locally before submitting to the server, it works just FINE!, at work my boss wants me to add more items, but I can't do it since the image upload is not working. I saw the error in Chrome Dev tools. It says 404 Not Found, basically the image is not found, but when I enter the file with FileZilla the image is there. Any help is greatly appreciated. Thanks in advance!
  3. Thank you @Soma you made my day!
  4. Hi @flydev Thank you, this is indeed a great solution. But for my case I used another tactic, using the search technique, so my PHP code looks like this: <ul class="row shop list-unstyled" id="grid"> <?php // search.php template file // look for a GET variables named 'min', 'max' and sanitize it $min = $sanitizer->text($input->get->min); $max = $sanitizer->text($input->get->max); // did $min and $max have anything in it? if($min and $max){ // Send our sanitized query 'min', 'max' variable to the whitelist where it will be // picked up and echoed in the search box by _main.php file. Now we could just use // another variable initialized in _init.php for this, but it's a best practice // to use this whitelist since it can be read by other modules. That becomes // valuable when it comes to things like pagination. $input->whitelist('min', $min); $input->whitelist('max', $max); // Sanitize for placement within a selector string. This is important for any // values that you plan to bundle in a selector string like we are doing here. $min = $sanitizer->selectorValue($min); $max = $sanitizer->selectorValue($max); // Search the title and body fields for our query text. $selector = "price>=$min , price<=$max"; //if($user->isLoggedin()) $selector .= ", has_parent!=2"; // Find pages that match the selector $items = $pages->find($selector); // did we find any matches? if($items->count) { $count = "Görkezilen baha boýunça jemi $items->count sanysy tapyldy"; ?> <!-- product --> <p class="shop-results space-left"><strong><?=$count;?></strong> </p> <?php foreach ($items as $match): ?> <li class="col-sm-6 col-md-3 col-lg-3 product m-product" data-groups='["bedroom"]'> <div class="img-bg-color primary"> <h5 class="product-price"><?=$match->price;?> manat</h5> <a href="<?=$r->url;?>" class="product-link"></a> <!-- / product-link --> <img src="<?=$match->image->first()->url;?>" alt="<?=$match->image->description;?>"> <!-- / product-image --> <!-- product-hover-tools --> <div class="product-hover-tools"> <a href="<?=$match->url;?>" class="view-btn" data-toggle="tooltip" title="Giňişleýin gör"> <i class="lnr lnr-eye"></i> </a> <!--<a href="shopping-cart.html" class="cart-btn" data-toggle="tooltip" title="Add to Cart"> <i class="lnr lnr-cart"></i> </a>--> </div><!-- / product-hover-tools --> <!-- product-details --> <div class="product-details"> <h5 class="product-title"><?=$match->title;?></h5> <!--<p class="product-category">Hemme zat içinde</p>--> </div><!-- / product-details --> </div><!-- / img-bg-color --> </li> <!-- / product --> <?php endforeach; } } else { ?> <!-- product --> <?php foreach ($result = $page->children() as $r): ?> <li class="col-sm-6 col-md-3 col-lg-3 product m-product" data-groups='["bedroom"]'> <div class="img-bg-color primary"> <h5 class="product-price"><?=$r->price;?> manat</h5> <a href="<?=$r->url;?>" class="product-link"></a> <!-- / product-link --> <img src="<?=$r->image->first()->url;?>" alt="<?=$r->image->description;?>"> <!-- / product-image --> <!-- product-hover-tools --> <div class="product-hover-tools"> <a href="<?=$r->url;?>" class="view-btn" data-toggle="tooltip" title="Giňişleýin gör"> <i class="lnr lnr-eye"></i> </a> <!--<a href="shopping-cart.html" class="cart-btn" data-toggle="tooltip" title="Add to Cart"> <i class="lnr lnr-cart"></i> </a>--> </div><!-- / product-hover-tools --> <!-- product-details --> <div class="product-details"> <h5 class="product-title"><?=$r->title;?></h5> <!--<p class="product-category">Hemme zat içinde</p>--> </div><!-- / product-details --> </div><!-- / img-bg-color --> </li> <!-- / product --> <?php endforeach; }?> <!-- sizer --> <li class="col-sm-6 col-md-3 col-lg-3 shuffle_sizer"></li> <!-- / sizer --> </ul> <!-- / products --> and Javascript: var limitSlider = document.getElementById('range-slider'); noUiSlider.create(limitSlider, { start: [ 0, 10000 ], step: 1, behaviour: 'drag', connect: true, range: { 'min': 0, 'max': 10000 } }); var limitFieldMin = document.getElementById('range-slider-value-min'); var limitFieldMax = document.getElementById('range-slider-value-max'); limitSlider.noUiSlider.on('update', function( values, handle ){ (handle ? limitFieldMax : limitFieldMin).value = values[handle]; }); The range filter area in my page is: <div class="range-filter"> <form action="<?php echo $pages->get('template=shop-right')->url;?>" method='get'> <div class="column filter-button"> <button type="submit" class="btn btn-xs btn-default-filled btn-rounded">Saýhalla</button> </div> <!--/ filter-button --> <div class="column range-values"> <input type="text" class="value" name="min" size="6" id="range-slider-value-min" value=""> <input type="text" class="value" name="max" size="6" id="range-slider-value-max" value=""> </div><!-- / range-values --> </form> </div><!-- / range-filter --> So whenever I press button 'sort' which is 'sayhalla' in my example, all the values are posted and results are returned as a result. Your case is super as well, it works perfectly but for my template it is better to implement it this way. I tried to implement yours too, but no success. Thank you again!
  5. Hi Guys, Recently I was working on my new project and I need to implement price range filtering. I am using noUiSlider which came with the template that I have purchased. How can I pass values of minimum and maximum values using ajax? I am using foreach loop as shown in code in the code <ul class="row shop list-unstyled" id="grid"> <!-- product --> <?php $result = $pages->get("/sadakalar")->children();?> <?php foreach ($result as $r): ?> <li class="col-sm-4 col-md-3 col-lg-3 product m-product" data-groups='["bedroom"]'> <div class="img-bg-color primary"> <h5 class="product-price" data-price="<?=$r->price;?>"><?=$r->price_range->max;?> manat</h5> <a href="<?=$r->url;?>" class="product-link"></a> <!-- / product-link --> <img src="<?=$r->image->first()->url;?>" alt="<?=$r->image->description;?>"> <!-- / product-image --> <!-- product-hover-tools --> <div class="product-hover-tools"> <a href="<?=$r->url;?>" class="view-btn" data-toggle="tooltip" title="Giňişleýin gör"> <i class="lnr lnr-eye"></i> </a> <!--<a href="shopping-cart.html" class="cart-btn" data-toggle="tooltip" title="Add to Cart"> <i class="lnr lnr-cart"></i> </a>--> </div><!-- / product-hover-tools --> <!-- product-details --> <div class="product-details"> <h5 class="product-title"><?=$r->title;?></h5> <!--<p class="product-category">Hemme zat içinde</p>--> </div><!-- / product-details --> </div><!-- / img-bg-color --> </li> <!-- / product --> <?php endforeach; ?> <!-- sizer --> <li class="col-sm-4 col-md-3 col-lg-6 shuffle_sizer"></li> <!-- / sizer --> </ul> <!-- / products --> Here is the code of my range slider: Values of min and max values are stored inside of <span> <!-- filter-by-price widget --> <div class="widget"> <h5 class="widget-title">Baha boýunça saýhalla</h5> <div id="range-slider" class="noUi-target noUi-rtl noUi-horizontal"> </div><!-- / range-slider --> <div class="range-filter"> <div class="column filter-button"> <button type="submit" class="btn btn-xs btn-default-filled btn-rounded" id="filter">Saýhalla</button> </div> <!--/ filter-button --> <div class="column range-values"> <p>$<span class="value" id="range-slider-value-min"></span> - $<span class="value" id="range-slider-value-max"></span></p> </div><!-- / range-values --> </div><!-- / range-filter --> <!-- / filter-by-price widget --> And lastly here is my javascript of which handles the changes in noUiSlider: <script> var limitSlider = document.getElementById('range-slider'); noUiSlider.create(limitSlider, { start: [ 100, 5000 ], limit: 10000, behaviour: 'drag', connect: true, range: { 'min': 0, 'max': 10000 } }); var limitFieldMin = document.getElementById('range-slider-value-min'); var limitFieldMax = document.getElementById('range-slider-value-max'); var dataString = limitFieldMin + limitFieldMax; limitSlider.noUiSlider.on('update', function( values, handle ){ (handle ? limitFieldMax : limitFieldMin).innerHTML = values[handle]; }); </script> So what I want to do is, whenever user slides the range filter, it automatically throws the filtered products. I have also attached the picture of my website. Any help is greatly appreciated. Thank you in advance!
  6. Hi @kongondo Sorry for late congratulations, but it's better late than never, so Merry Christmas! I should have thought about it, damn those projects without holidays I have figured it out, I didn't specify my email so It was using default email processwire@localhost, then when I have entered my own email it started to work! Thank you! and Merry Holidays!
  7. Hi, I wanted to use Comments module in my project and stumbled upon a problem. Whenever I submit comment with a star rating, it redirects me to unknown page as #CommentForm and my websites preloader is keep turning but nothing is actually happening. Can you please give me a hand on this. What should I do in order to fix this. On my template I added comments field, but submitted comments are not shown. Is there anyway to make comments work on my page? Than you in advance
  8. Yes, sorry for my language, I couldn't explain it in a better way I have tried both ways, Like yours as well but still I can see the html code in my email. so I omitted the html tags and did it like this if ($v->validate()) { $reCaptcha = new \ReCaptcha\ReCaptcha($googleSecretKey); $resp = $reCaptcha->verify($input->post->{'g-recaptcha-response'}, $_SERVER["REMOTE_ADDR"]); //if google-recaptcha validation passes if ($resp->isSuccess()) { $name = $input->post->name; $email = $input->post->email; $message = $input->post->message; $message = "There is a message from {$name} with the email {$email} The message is: '{$message}'"; //here we send the form to $contactFormRecipient wireMail($contactFormRecipient, $input->post->email, "Pak Nesil | " . $input->post->name, $message); //here we set a flash-message to notify the user that the form was successfully sent $session->flashMessage = 'Thank you for your message! We will get in touch with you shortly.'; //save in session that the form is sent $session->sent = true; //finally redirect user to contact-page $session->redirect($pages->get($contactPageID)->url); } else { //self explain $session->flashMessage = 'Error while validating you are not a robot!'; } } } So it worked for me, otherwise gmail shows all the html markup which is annoying.
  9. Thank you @SamC I have figured it out, I am not using a module, I didn't quite get the module version of it so I tried the classic way of @giannisok, I mixed the google recaptcha keys. I fixed them and it all worked correctly, Thank you, I jut have one little question in my mind, how to get the beautiful message to the email, because as I can see the html code cannot be rendered and the messages come all mixed up and unwieldy
  10. Yeah I put the tick and went through all of its procedures one by one. Still no luck. I have tried it almost 100 times, still nothing. Here is my _contact-controller.php code //here we check whether the 'name' field exists inside post variables (which means the form is posted) if ($input->post->name) { //if fields validation passes if ($v->validate()) { $reCaptcha = new \ReCaptcha\ReCaptcha($googleSecretKey); $resp = $reCaptcha->verify($input->post->{'g-recaptcha-response'}, $_SERVER["REMOTE_ADDR"]); //if google-recaptcha validation passes if ($resp->isSuccess()) { //This is the HTML message $message = ' <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Contact Form | ' . $input->post->name . '</title> </head> <body> <p>' . $input->post->message . '</p> </body> </html>'; //here we send the form to $contactFormRecipient wireMail($contactFormRecipient, $input->post->email, "Contact Form | " . $input->post->name, $message); //here we set a flash-message to notify the user that the form was successfully sent $session->flashMessage = 'Thank you for your message! We will get in touch with you shortly.'; //save in session that the form is sent $session->sent = true; //finally redirect user to contact-page $session->redirect($pages->get($contactPageID)->url); } else { //self explain $session->flashMessage = 'Error while validating you are not a robot!'; } } } ?>
  11. Thank you @SamC for the great help. Now it seems that when I enter all the information I get an error from Google ReCaptcha. Whenever I enter all the right credentials it throws me "Error while validating you are not a robot!" I tried to re-entering the information so many times but no luck.
  12. Hi @SamC Thank you for your help, I put namespace Processwire on both, contact.php and _contact-controller.php it all worked. I just had some design problems thus my page won't load properly. I guess I have to take more attention to frontend as well Thank you again!
  13. Hi @SamC thank you for your reply. I just have it on my header.php file. Here is the 49th line <div class="form-group <?php echo $v->errors('name') ? 'has-error' : '';?>">
  14. I always get call to a member function errors(), on a non-object. Cannot solve it. Any help appreciated
  15. Hi @giannisok Thank you for the tutorial, I have one problem which I got stuck for couple of days and cannot solve: When I run my contact page, I get this I can't seem to get it work, I used many tactics and followed your code line by line, but couldn't find any solution. I would be glad if you give me a hand on this. Below is my code of contact.php file:
×
×
  • Create New...