Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#26 2019-05-16 08:16:36

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Custom list of choice

Yes!

but I can not find how to fill the field in javascript as for the contact module for the Cart module

Offline

#27 2019-05-16 08:18:48

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Custom list of choice

With your last code for contact module, In mail we receive:
Capture-d-cran-2019-05-16-01-17-25.png

Offline

#28 2019-05-16 08:27:20

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom list of choice

Nico3939 wrote:

With your last code for contact module, In mail we receive:
https://i.ibb.co/f9CwS49/Capture-d-cran-2019-05-16-01-17-25.png

Nice smile


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#29 2019-05-16 08:33:09

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom list of choice

Nico3939 wrote:

Seems to work with contact module.

But cart module has no field as:

<p class="contact-field_12">

This code inserts the radio button before the field named 'paiement'. I have added a line to hide that at the same time.

function ttg_scripts($style, $path) {
   echo'
      <script>
         $("input[name=paiement]").before(\'<br><input type="radio" name="gender" value="red" onclick="moveNumbers(this.value)"> Red<br>   <input type="radio" name="gender" value="green" onclick="moveNumbers(this.value)"> Green<br>   <input type="radio" name="gender" value="blue" onclick="moveNumbers(this.value)">Blue\');
         $("input[name=paiement]").hide();
      </script>
   ';
}

But I think that this code should only be used when one is on the cart page. So I'm adding my page_match function:

function page_match($gallery) {
   if (substr($_SERVER["REQUEST_URI"], 0, strlen($gallery)) == $gallery) {
      return 1;
   }  else {
      return 0;
   }
}

function ttg_scripts( $style, $path ){
   if ( page_match('/backlight/cart') ) {
      echo '
      <script>
         $("input[name=paiement]").before(\'<br><input type="radio" name="gender" value="red" onclick="moveNumbers(this.value)"> Red<br>   <input type="radio" name="gender" value="green" onclick="moveNumbers(this.value)"> Green<br>   <input type="radio" name="gender" value="blue" onclick="moveNumbers(this.value)">Blue\');
         $("input[name=paiement]").hide();
      </script>	
      ';
   }
}

Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#30 2019-05-16 08:41:09

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Custom list of choice

Thanks very much the first is Ok  Great !

For the second there an error:

Something went wrong
Unexpected error: syntax error, unexpected '<' in perso-checkout.php on line 11

Offline

#31 2019-05-16 08:45:45

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom list of choice

Nico3939 wrote:

Thanks very much the first is Ok  Great !

For the second there an error:

Something went wrong
Unexpected error: syntax error, unexpected '<' in perso-checkout.php on line 11

Oh, I forgot the echo '...'; Fixed above.

And you still need you moveNumbers function....


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#32 2019-05-16 08:56:23

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Custom list of choice

Congratulation !

A GREAT THANKS Daniel for all !!!

So now, all works like a charm

Thanks to you, we now have the possibility to use radio and drop-down fields in the contact form and in Cart Checkout

You are amazing, how do you do to know all that!

Thank you again for all
Nico

Offline

#33 2019-05-16 09:30:29

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Custom list of choice

Hey Nico, great that this works for you smile  I'll put this all into a blog post so others can use this as well. Great idea, Nico!


Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#34 2019-05-16 09:30:32

Nico3939
Member
From: France
Registered: 2016-10-05
Posts: 235
Website

Re: Custom list of choice

That's my Cart Checkout page:

Capture-d-cran-2019-05-16-02-26-32.jpg

And the mail the client or me received:

Capture-d-cran-2019-05-16-02-26-57.jpg



Yoooohoo!

Thanks Daniel, you're a BOSS!

Offline

Board footer

Powered by FluxBB