Jump to content

angelo, italy

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by angelo, italy

  1. Hi, this is an easy way to have beautiful icons in the languages switcher: <?php foreach ($languages as $language) { if (!$page->viewable($language)) continue; // is page viewable in this language? if ($language->id == $user->language->id) { echo "<span style='padding:3px;border-bottom:1px solid #333'> "; } else { echo "<span style='padding:3px'> "; } $url = $page->localUrl($language); $hreflang = $homepage->getLanguageValue($language, 'name'); $lan = $language->title; $it = '<img src="' . $config->urls->templates . 'images/italy.png" style="width:30px"/>'; $en = '<img src="' . $config->urls->templates . 'images/gb.png" style="width:30px"/>'; if ($lan == 'IT') { echo "<a hreflang='$hreflang' href='$url' >" . $it . "</a></span>"; } else { echo "<a hreflang='$hreflang' href='$url'>" . $en . "</a></span>"; }; } ?> Bye!
  2. Hi, I want to share an easy way to use Stripe Payment Links in processwire website: 1) Upload folder 'stripe-php' in site/templates (attached) 2) Upload file init.php in site/templates (attached) 3) Use variables in template 'product': $xxx = $page->prezzo_interno; $session->set(prod, "$page->title"); $session->set(price, $xxx); 4) Insert a form in the template 'product' 5) Copy ApiKey in Stripe Account 5) Create a template 'checkout' and copy Apikey <?php //include './stripe-php/init.php'; include 'init.php'; //require 'vendor/autoload.php'; Stripe\Stripe::setApiKey('xxxxxxxxxxxxxxxxxxxxxxxxxxxx'); header('Content-Type: application/json'); $YOUR_DOMAIN = 'https://www.dominio.it/'; $checkout_session = \Stripe\Checkout\Session::create([ 'shipping_address_collection' => [ 'allowed_countries' => ['IT'], ], 'shipping_options' => [ [ 'shipping_rate_data' => [ 'type' => 'fixed_amount', 'fixed_amount' => [ 'amount' => 500, 'currency' => 'eur', ], 'display_name' => 'Standard', // Delivers between 5-7 business days 'delivery_estimate' => [ 'minimum' => [ 'unit' => 'business_day', 'value' => 5, ], 'maximum' => [ 'unit' => 'business_day', 'value' => 7, ], ] ] ], [ 'shipping_rate_data' => [ 'type' => 'fixed_amount', 'fixed_amount' => [ 'amount' => 800, 'currency' => 'eur', ], 'display_name' => 'Celere', // Delivers in exactly 1 business day 'delivery_estimate' => [ 'minimum' => [ 'unit' => 'business_day', 'value' => 1, ], 'maximum' => [ 'unit' => 'business_day', 'value' => 3, ], ] ] ], ], 'line_items' => [[ # Provide the exact Price ID (e.g. pr_1234) of the product you want to sell 'name' => $session->get(prod), 'amount' => $session->get(price), 'currency' => 'eur', 'quantity' => 1 ]], 'mode' => 'payment', 'discounts' => [[ 'coupon' => '1', ]], 'success_url' => $YOUR_DOMAIN . 'grazie/', 'cancel_url' => $YOUR_DOMAIN . 'pagamento-rifiutato/', ]); header("HTTP/1.1 303 See Other"); header("Location: " . $checkout_session->url); .. and that's it! I hope it could be useful for everybody here! Bye Archivio.zip
  3. I'd like to share how I integrated stripe in PW.. and it works!! ?‍♂️ :-D! FORM in product page: <div style='display:<?php if ($page->Mostra1 == 1) echo "block"; echo "none";?>'> <form action='<?php echo $pages->get('template=create-checkout-session')->url; ?>' method='POST' > </form> <?php $myForm1 = " <form action='{$stripe->url}' method='post'> <button type='submit' id='checkout-button' >Acquista</button> </form>"; echo $myForm1;?> </div> and this is the 'create-checkout-session' template: <?php include 'init.php'; Stripe\Stripe::setApiKey('xxxxxxxxxxxxxxxxxx'); header('Content-Type: application/json'); $YOUR_DOMAIN = 'https://www.xxxxxxxx.it/'; $checkout_session = \Stripe\Checkout\Session::create([ 'shipping_address_collection' => [ 'allowed_countries' => ['IT'], ], 'shipping_options' => [ [ 'shipping_rate_data' => [ 'type' => 'fixed_amount', 'fixed_amount' => [ 'amount' => 700, 'currency' => 'eur', ], 'display_name' => 'Standard', // Delivers between 5-7 business days 'delivery_estimate' => [ 'minimum' => [ 'unit' => 'business_day', 'value' => 5, ], 'maximum' => [ 'unit' => 'business_day', 'value' => 7, ], ] ] ], [ 'shipping_rate_data' => [ 'type' => 'fixed_amount', 'fixed_amount' => [ 'amount' => 1000, 'currency' => 'eur', ], 'display_name' => 'Celere', // Delivers in exactly 1 business day 'delivery_estimate' => [ 'minimum' => [ 'unit' => 'business_day', 'value' => 1, ], 'maximum' => [ 'unit' => 'business_day', 'value' => 3, ], ] ] ], ], 'line_items' => [[ # Provide the exact Price ID (e.g. pr_1234) of the product you want to sell #'price' => 'price_1JyahSFL4ZyLp1tjGGqakV4Z', #'price' => $price, 'name' => $session->get(prod), 'amount' => $session->get(price), 'currency' => 'eur', 'quantity' => 1, ]], 'mode' => 'payment', 'success_url' => $YOUR_DOMAIN . 'grazie/', 'cancel_url' => $YOUR_DOMAIN . 'pagamento-rifiutato/', ]); header("HTTP/1.1 303 See Other"); header("Location: " . $checkout_session->url); I used: $session->set(prod, "$page->title"); >>> 'name' => $session->get(prod), I hope this stuff can be useful for someones!
  4. My fault was to use ' <?php echo $config->urls->templates ?> ? ... so stupid! But now I found this issue: Compile Error: Arrays are not allowed in class constants (line 104 of site/templates/stripe-php/lib/Util/ObjectTypes.php) mmmm SOLUTION: I updated PHP version to 7+
  5. I'd like to use Stripe Checkout in processwire. The client- and server-side code redirects to a prebuilt payment page hosted on Stripe. I create a form in my page: $stripe = $pages->get("/stripe/"); <!-- HEAD--> <h1><?php echo $page->title ?></h1> <?php $myForm1 = " <form action='{$stripe->url}' method='post'> <button type='submit' id='checkout-button'>Checkout</button> </form>"; echo $myForm1; ?> <!-- FOOTER --> then, I created a template/page ----- <?php include '<?php echo $config->urls->templates ?>stripe-php/init.php'; //require 'vendor/autoload.php'; use Stripe\Stripe; Stripe\Stripe::setApiKey('xxxxxxxxx'); header('Content-Type: application/json'); $YOUR_DOMAIN = 'https://www.axxxxxxsamia.it/'; $checkout_session = \Stripe\Checkout\Session::create([ 'shipping_address_collection' => [ 'allowed_countries' => ['IT'], ], 'shipping_options' => [ [ 'shipping_rate_data' => [ 'type' => 'fixed_amount', 'fixed_amount' => [ 'amount' => 700, 'currency' => 'eur', ], 'display_name' => 'Standard', // Delivers between 5-7 business days 'delivery_estimate' => [ 'minimum' => [ 'unit' => 'business_day', 'value' => 5, ], 'maximum' => [ 'unit' => 'business_day', 'value' => 7, ], ] ] ], [ 'shipping_rate_data' => [ 'type' => 'fixed_amount', 'fixed_amount' => [ 'amount' => 1000, 'currency' => 'eur', ], 'display_name' => 'Celere', // Delivers in exactly 1 business day 'delivery_estimate' => [ 'minimum' => [ 'unit' => 'business_day', 'value' => 1, ], 'maximum' => [ 'unit' => 'business_day', 'value' => 3, ], ] ] ], ], 'line_items' => [[ # Provide the exact Price ID (e.g. pr_1234) of the product you want to sell 'price' => 'pricSFL4ZyLp1tjGGqakV4Z', 'quantity' => 1, ]], 'mode' => 'payment', 'success_url' => $YOUR_DOMAIN . '/success.html', 'cancel_url' => $YOUR_DOMAIN . '/cancel.html', ]); header("HTTP/1.1 303 See Other"); header("Location: " . $checkout_session->url); --- BUT... ERROR!! Fatal Error: Class 'Stripe\Stripe\Stripe' not found (line 8 of site/templates/create-checkout-session.php) Any ideas?? ThanksThis error message was shown because: you are logged in as a Superuser. Error has been logged.
  6. I'm having same issue on Aruba servers (Italy) in the installation process, I commented out this lines: # Note that some web hosts don't support this. If you get a (500) error, try commenting out this # SetEnv line below. <IfModule mod_env.c> SetEnv HTTP_MOD_REWRITE On </IfModule> Now It works
  7. Hi @Dzung I installed the WireMailPHPMailer module and solved it. Greetings
  8. Dear friends, the failure of the module depends on the hosting (godaddy). Below is the question solved .. Sending emails through other providers in Godaddy is not allowed, so you need to use the following settings: Port: 25 SMTP authentication: False or None SSL or secure connection: None Server or Host: The relay server to use depends on the type of hosting and script you use. What type is my hosting account? Linux (cPanel) Use localhost, unless: You use a PHP script and the mail () function. You use a Perl script and the binary / usr / lib / sendmail. In these cases, you will not need to specify any relay servers.
  9. Hi I can't get wiremail to work .. Can you show me a solution Thanks so much array(1) { ["SETTINGS"] array(28) { ["default_charset"] string(5) "UTF-8" ["localhost"] string(23) "domain.com" ["smtp_host"] string(17) "smtp.xxxxxxxx.com" ["smtp_port"] int(587) ["smtp_ssl"] string(0) "" ["smtp_ssl_crypto_method"] string(0) "" ["smtp_start_tls"] int(1) ["smtp_tls_crypto_method"] string(31) "STREAM_CRYPTO_METHOD_ANY_CLIENT" ["smtp_user"] string(25) "admin@domain.com" ["smtp_password"] string(12) "RBxxxxxxxgEPlj" ["smtp_password2"] string(0) "" ["clear_smtp_password"] string(0) "" ["allow_without_authentication"] string(0) "" ["realm"] string(0) "" ["workstation"] string(0) "" ["authentication_mechanism"] string(0) "" ["smtp_debug"] int(0) ["smtp_html_debug"] int(0) ["sender_name"] string(16) "Vincenzo xxxxxxx" ["sender_email"] string(25) "admin@domain.com" ["sender_reply"] string(0) "" ["sender_errors_to"] string(0) "" ["sender_signature"] string(0) "" ["sender_signature_html"] string(0) "" ["send_sender_signature"] string(1) "1" ["extra_headers"] array(0) { } ["valid_recipients"] array(0) { } ["smtp_certificate"] string(0) "" } } array(1) { ["RESULT"] array(5) { ["subject"] string(14) "Debug Testmail" ["addSignature"] string(1) "0" ["textbody"] string(39) "This is a test message" ["recipients"] array(1) { [0] array(3) { ["emailaddress"] string(24) "angelo.xxxxxxxx@email.com" ["name"] string(0) "" ["type"] string(2) "to" } } ["send"] string(0) "" } } array(1) { ["ERRORS"] array(1) { [0] string(69) "could not connect to the host "smtp.xxxxxxx.com": Connection refused" } } array(1) { ["DEBUGLOG"] string(144) " Resolving SMTP server domain "smtp.xxxxx.com"... Connecting to SMTP server "smtp.xxxxxx.com" port 587... " }
  10. Hi, I'm not so good in PHP ... In a website I want to sort result using foreach, this is the code: $profi = $pages->get("/professionisti/")->children('limit=4, sort=date'); My question is: if I want to change the order, from the latest to the oldest or from the oldest .. what I have to write? Thanks a lot
  11. I unistalled Front-End Page Editor and now my website is working well ?
  12. I understood my issue and follow instructions in the forum. Now it works. Thanks
  13. I tried to find a post about my issue but I did't find it. Can you help me? thanks Issue is: Note: your current server locale setting isn’t working as expected with the UTF-8 charset and may cause minor issues. Your current locale setting is “C”. Please translate the “C” locale setting for each language to the compatible locale in /wire/modules/LanguageSupport/LanguageSupport.module: • Italiano • English For example, the locale setting for US English might be: en_US.UTF-8
  14. hi, I'm tryng to insert slider into my template without success... ... <div class="col-12"> <div class="animated bounceInDown" style="animation-duration: 3.5s;"><img class="img-responsive" src="<?php echo $slider->render($page->get('slider')); ?>" /></div> ... can you help me??
  15. Hi! I did it, my code is <img class="img-responsive" src="<?php echo $page->headimage->url?>" /> but imags don't appear! If I analyze code in the front using google console I saw this code <img class="img-responsive" src="/processwire-master/site/assets/files/1/"> .. it seems to stop in the folder without getting image's url.. ?
  16. Hi guys... I love pw! I'm trying to update a template of the multilanguagge website. I created a field, i called it "headimage" and I added it to the home template. .. . But I can t see any image!!! Where is the issue?? Thanks my friends
  17. How long? I'm confident in front-end but no php...... ?
  18. thank my friends.I am very fascinated by PW .. a lot! I am confident on front end but little back-end and PHP. Can you show me useful resources to learn PW while I build this site? Thanks again
  19. Hi guys, I've always used WP but I want to swtich to PW. I'm not sure .... I'd like to know if it's possible to create a website for an online photo contest. The participants of the competition could create their own account, in which they upload their photos. The photos uploaded remain visible only to themselves and the judges. From their account they can make the "entrance fee" payment. The judges of the competition can create their own account... entering they see the photos of the participants and vote photos At the main page I imagine the title of the competition, a button to read the regulation, and a button to register. The website should be in Italian and English. Thank you!!
×
×
  • Create New...