Author Topic: Ask question form included on flypage AJAX  (Read 39172 times)

klutzon

  • Full Member
  • ***
  • Posts: 319
  • Knuckles the Echidna
    • Rage3D
Re: Ask question form included on flypage AJAX
« Reply #30 on: March 09, 2010, 23:01:06 pm »
Hi there rb,

Got your "Ask-a-question AJAX flypage" mod, and it works very well, thank you very much! :) I have a request though, if you could help (since I've been trying the last hour and I can't seem to get what I'm doing wrong) I'd appreciate it.

What I would like is to display the ask-a-question form on the flypage without having to click to reveal / hide it. That way, I can put the form in a MagicTab along with all other details. So for example, I'll have tabs for "Product Desc", "Related Products", "Additional Files" and "Ask a Question", and I'd like the form to appear in the tab without needing to click on anything to reveal it. What should I modify in the flypage-ask-inline.tpl.php to achieve this effect?

Thanks for the assist in advance! :D

rb

  • Advanced
  • Hero Member
  • *****
  • Posts: 1503
Re: Ask question form included on flypage AJAX
« Reply #31 on: March 10, 2010, 00:36:35 am »
hey klutzon, if you go back and read the first 2 pages of this thread, you'll see that "jjj2" has posted a solution showing this Ajax/inline "Ask a question" form within MagicTabs.

The hide/show is controlled by 4 statements:
1. When the form is first shown, it is hidden by this CSS statement:
Code: [Select]
div.ask_inline {
display:none;
You can remove this (or comment it out as jjj2 did).

2. When the user clicks "Ask a question ...", the form is revealed by that actual link:
Code: [Select]
<a class="button" href="" onclick="document.getElementById('ask_inline').style.display='block';return false;"><?php echo $ask_seller_text?></a>If you haven't already, remove that and make it your tab title.

3. After the email is sent, this JavaScript line re-hides the form:
Code: [Select]
document.getElementById('ask_inline').style.display='none';Again, remove or comment out. jjj2 left it in, I guess so that the user sees it disappeared, confirming in the user's mind that the email was sent.

4. If the user starts to fill out the form, and then changes his/her mind and clicks "Cancel", this action re-hides the form:
Code: [Select]
<input type="button" name="cancel" class="button" value="<?php echo $VM_LANG->_('CMN_CANCEL'); ?>"  onclick="document.getElementById('ask_inline').style.display='none'; return false;">You may wish to replace that with an HTML form "Reset" button.

klutzon

  • Full Member
  • ***
  • Posts: 319
  • Knuckles the Echidna
    • Rage3D
Re: Ask question form included on flypage AJAX
« Reply #32 on: March 10, 2010, 07:01:54 am »
Thank you rb, I didn't see jjj2's post as a solution to my problem, I didn't see the key words I was after associated with his post, but now that I've gone through the code he posted I can see it's to do what I'm looking.

I will go through his code, as well as yours, and see if I can sort this out. I'll be back to report... :)

mbit

  • Full Member
  • ***
  • Posts: 323
Re: Ask question form included on flypage AJAX
« Reply #33 on: March 30, 2010, 16:55:03 pm »
i am using a theme already, i followed the instructions and tryed to add a new tab next to once that exist already.
by editing the template.tmp.php in line78 i created a copy of the previous  if-tab :
Code: [Select]
<?php if( !empty( $ask_seller_text )) { ?>
<div id="tabs"> <a class="button" href="" onclick="document.getElementById('ask_inline').style.display='block';return false;"><?php echo $ask_seller_text?></a>
</div>
<?php ?>
which gave me a new tab but when i click in it , it goes me in main page. i tryed adding the line : <?php include("flypage-ask-inline.tpl.php"); ?> but no result :/ any ideas how i can make it work ?


Thanks in advance,

Mbit

[attachment cleanup by admin]

rb

  • Advanced
  • Hero Member
  • *****
  • Posts: 1503
Re: Ask question form included on flypage AJAX
« Reply #34 on: March 30, 2010, 18:33:18 pm »
I can't tell for sure what you're doing with that small snippet of code, but it sort of looks like you've replaced the code that opens a tab with the code one would use to show the inline "Ask" form on a page without tabs.  The original code hid the inline form.  But if you're using it with tabs, then the tab code hides it.

mbit

  • Full Member
  • ***
  • Posts: 323
Re: Ask question form included on flypage AJAX
« Reply #35 on: March 30, 2010, 18:56:55 pm »
its not the original code because its a another template , not the default . the code that makes the tabs seems to be this one
Code: [Select]

<div id="vmj_product_details_tab">
<?php if( trim(str_replace"<br />""" $product_description)) != "" ) { ?>
<div id="tabs"><a rel="p_description" class="selected"><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_DESC_TITLE'?></a></div>
<?php ?>
<?php if( trim(str_replace"<br />""" $product_reviews)) != "" ) { ?>
<div id="tabs"><a rel="reviews"><?php echo $VM_LANG->_('PHPSHOP_REVIEWS'?></a></div>
<?php ?>
<?php if( trim(str_replace"<br />""" $related_products)) != "" ) { ?>
<div id="tabs"><a rel="related"><?php echo $VM_LANG->_('PHPSHOP_RELATED_PRODUCTS')?></a></div>
<?php ?>
<?php if( !empty( $recent_products )) { ?>
<div id="tabs"><a rel="recent"><?php echo $VM_LANG->_('VM_RECENT_PRODUCTS'?></a></div>
<?php ?>

as i told you i copied from above and created
Code: [Select]

<?php if( !empty( $ask_seller_text )) { ?>
<div id="vmj_tabs"> <a class="button" href="" onclick="document.getElementById('ask_inline').style.display='block';return false;"><?php echo $ask_seller_text?> </a>
</div>
<?php ?>
but not working cause i dont know enough of coding.. any advices are welcome,

thanks in advance

rb

  • Advanced
  • Hero Member
  • *****
  • Posts: 1503
Re: Ask question form included on flypage AJAX
« Reply #36 on: March 30, 2010, 20:43:39 pm »
I'm still unable to figure out what you have coded.  Four different suggestions:

1. Ask your template provider for assistance as they provide the code you are trying to modify.

2. Start over.  Then make a new tab for the "ask question" form, just like the other tabs.  Then copy the contents of the "inline form" into your tab and modify from there.

3. Hire a commercial programmer.

4. There's lots of free PHP tutorials on the web.  See if you can learn how to customize this to your specific needs.

mbit

  • Full Member
  • ***
  • Posts: 323
Re: Ask question form included on flypage AJAX
« Reply #37 on: April 06, 2010, 14:05:19 pm »
i tried your forth option.. the results made the form show up but didnt  make it to hide  :( i tried also to ask the developer but he wants 20$ for 2 lines pff  >:(
i took some screenshot to show u whats going on. If is go from tab description to tab Ask a question about this product
 everything is ok if i go back the form is still there under the description :( . Also if i go from recently viewed product to Ask a question about this product the recently items are shown and back words form still there. i attack the code & the screenshot if anyone has some time and any idea is welcome!


Code: [Select]
<div id=" product_details_tab">
<?php if( trim(str_replace"<br />""" $product_description)) != "" ) { ?>
<div id=" tabs"><a rel="p_description" ><?php echo $VM_LANG->_('PHPSHOP_PRODUCT_DESC_TITLE'?></a></div>
<?php ?>
<?php if( trim(str_replace"<br />""" $product_reviews)) != "" ) { ?>
<div id=" tabs"><a rel="reviews"><?php echo $VM_LANG->_('PHPSHOP_REVIEWS'?></a></div>
<?php ?>
<?php if( trim(str_replace"<br />""" $related_products)) != "" ) { ?>
<div id=" tabs"><a rel="related"><?php echo $VM_LANG->_('PHPSHOP_RELATED_PRODUCTS')?></a></div>
<?php ?>
<?php if( !empty( $recent_products )) { ?>
<div id=" tabs"><a rel="recent"><?php echo $VM_LANG->_('VM_RECENT_PRODUCTS'?></a></div>
<?php ?>



<?php if( trim(str_replace"<br />""" $ask_seller ))  != "" ) { ?>
<div id=" tabs"> <a class="button" href="#" onclick="document.getElementById('p_description').style.display='none';document.getElementById('ask_inline').style.display='block';return false;"><?php echo $ask_seller_text ?> </a>
</div>
<?php ?>
</div>



<div style="clear:both;"></div>
<div style="border:1px solid #BBBBBB; margin-bottom: 1em; padding: 10px">
<?php if( trim(str_replace"<br />""" $product_description)) != "" ) { ?>
<div id="p_description" class=" tabcontent">
<?php echo $product_description ?>
</div>
<?php ?>

<?php if( (include "flypage-ask-inline.tpl.php" ) !="") { ?>
<style>
div.ask_inline {
display:none;
}
</style>

<?php ?>
<?php if( trim(str_replace"<br />""" $product_reviews)) != "" ) { ?>
<div id="reviews" class=" tabcontent">
<?php echo $product_reviews ?>
   <br/><br/>
   <?php echo $product_reviewform ?>
</div>
<?php ?>
<?php if( trim(str_replace"<br />""" $related_products)) != "" ) { ?>
<div id="related" class=" tabcontent">
<?php echo $related_products ?>
</div>
<?php ?>
<?php if( !empty( $recent_products )) { ?>
<div id="recent" class=" tabcontent">
<?php echo $recent_products?>
</div>
<?php }?>

</div>

[attachment cleanup by admin]

rb

  • Advanced
  • Hero Member
  • *****
  • Posts: 1503
Re: Ask question form included on flypage AJAX
« Reply #38 on: April 06, 2010, 15:42:37 pm »
mbit, I looked at your code and it appears quite jumbled to me, so sorry, I'm unable to assist you beyond my 4 suggestions above.

mbit

  • Full Member
  • ***
  • Posts: 323
Re: Ask question form included on flypage AJAX
« Reply #39 on: April 06, 2010, 18:02:20 pm »
is there a way to reveal the form with php?  ???
i am trying something like this but not working :/
Code: [Select]
<?php echo("<document.getElementById('ask_inline').style.display='block';return false;>")?>

this is closer than anything else so far, it reveals me a button when i choose the tab which get me to another page in order to complete the form. Is there a way to reveal the form inside the tab??

Code: [Select]
<?php echo $ask_seller;
 ?>


thanks in advance

studio16

  • Beginner
  • *
  • Posts: 43
    • Studio 16 Online Marketing
Re: Ask question form included on flypage AJAX
« Reply #40 on: May 26, 2010, 11:56:36 am »
Hi,

The script works fine only problem is when logged in the email input field is prefilled with java script instead of the emailaddress. Probably the emailcloack plugin of Joomla kicking in:

 <script language='JavaScript' type='text/javascript'> <!-- var prefix = 'ma' + 'il' + 'to'; var path = 'hr' + 'ef' + '='; var addy40464 = 'info' + '@'; addy40464 = addy40464 + 'studio16' + '.' + 'info'; document.write( '<a ' + path + '\'' + prefix + ':' + addy40464 + '\'>' ); document.write( addy40464 ); document.write( '<\/a>' ); //-->\n </script> <script language='JavaScript' type='text/javascript'> <!-- document.write( '<span style=\'display: none;\'>' ); //--> </script>Dit e-mailadres is beschermd tegen spambots. U heeft Javascript nodig om het te kunnen zien. <script language='JavaScript' type='text/javascript'> <!-- document.write( '</' ); document.write( 'span>' ); //--> </script>


any ideas?
Studio 16 Websolutions
Online marketing & Webdesign
www.studio16.info
- SEO marketing / search engine optimization
- SEA marketing / Google Adwords
- Email marketing

Reincha

  • Jr. Member
  • **
  • Posts: 137
Re: Ask question form included on flypage AJAX
« Reply #41 on: July 20, 2010, 20:07:11 pm »
Is it possible to add simple captcha to this? something like a one word answer to a question?

gkovacs

  • Beginner
  • *
  • Posts: 1
Re: Ask question form included on flypage AJAX
« Reply #42 on: November 25, 2013, 11:25:01 am »
Hi!

When i click on send button, i've got this message:
"Your product question was not emailed due to an internal error"

Any help?