Author Topic: Add field in ask question POPUP  (Read 7072 times)

simsar78

  • Beginner
  • *
  • Posts: 9
Add field in ask question POPUP
« on: March 05, 2012, 15:20:16 pm »
Hello,
i nedd to add a custom field in a ask question POP-UP.

I have custom this file:  FORM.PHP , mail_html_question.php and mail_raw_question.php

In the FORM.PHP i have insered this lines:

<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_phone')  ?> : <input type="text" class="validate[required,minSize[4],maxSize[12]]" value="<?php echo $this->user->phone ?>" name="phone" id="phone" size="20"  validation="required phone"/></label>
</br>

<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_city')  ?> : <input type="text" class="validate[required,minSize[4],maxSize[6]]" value="<?php echo $this->user->city ?>" name="city" id="city" size="10"  validation="required city"/></label>
</br>


i have added this line in languages file:

COM_VIRTUEMART_USER_FORM_phone=" Phone number"
COM_VIRTUEMART_USER_FORM_city="City"

in the pop-up i see the filed and is possible enter a text but in the email i no look the field.

What another file i need to modify ???

Thank You

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10431
  • VirtueMart Version: 3+
Re: Add field in ask question POPUP
« Reply #1 on: March 05, 2012, 17:58:34 pm »
askquestion/view.html.php

function renderMailLayout() {
   $this->setLayout('mail_html_question');
   $this->comment = JRequest::getString('comment');

COPY:
$this->comment = JRequest::getString('comment');

an change to yours

Sharack

  • Beginner
  • *
  • Posts: 8
Re: Add field in ask question POPUP
« Reply #2 on: October 21, 2012, 14:36:16 pm »
ive got the same problem and do not understand what i have got to do...
could you plz explain this code and what exactly i have to change?

askquestion/view.html.php

function renderMailLayout() {
   $this->setLayout('mail_html_question');
   $this->comment = JRequest::getString('comment');

COPY:
$this->comment = JRequest::getString('comment');

an change to yours

My change:

Form.php:

<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_PHONE')  ?> : <input type="text" class="validate[required,minSize[4],maxSize[64]]" value="<?php echo $this->user->phone ?>" name="phone" id="phone" size="30"  validation="required phone"/></label>
         <br />   

mail_raw_question:

echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user->name, $this->user->email, $this->user->phone) . "\n";

mail_html_question:

  <?php
                echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user['name'], $this->user['email'], $this->user['phone']) . "<br />";
                echo $this->comment. "<br />";
                ?>
view.html.php:

$this->setLayout ('mail_html_question');
      $this->comment = JRequest::getString ('comment');
      $this->phone = JRequest::getString ('phone');

i am not very good in cooding, so sry for that question.

Greetings,

Sharack

Sharack

  • Beginner
  • *
  • Posts: 8
Re: Add field in ask question POPUP
« Reply #3 on: October 22, 2012, 14:34:53 pm »
Hey Team,

so, i think i got my first fault:

view.html.php:

$this->setLayout ('mail_html_question');
      $this->comment = JRequest::getString ('comment');
      $this->comment= JRequest::getString ('phone');

now the mail shows me the telefonnumber, but i cant see the message anymore.... 

plz help me.. this should not be very difficult?

ssduzel

  • Beginner
  • *
  • Posts: 1
Re: Add field in ask question POPUP
« Reply #4 on: October 22, 2012, 22:38:42 pm »
hi,
i think i solved it.
i added this to "components/com_virtuemart/views/askquestion/view.html.php"
$this->phone = JRequest::getString ('phone');

then i added this bold line to "components/com_virtuemart/views/askquestion/tmpl/mail_html_question.php"
echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user['name'], $this->user['email']) . "<br />";
                echo $this->phone. "<br />";
                                    echo $this->comment. "<br />";

then it is done :)

Sharack

  • Beginner
  • *
  • Posts: 8
Re: Add field in ask question POPUP
« Reply #5 on: October 23, 2012, 00:03:49 am »
thanks! it works :) thanks a lot :)

Sharack

  • Beginner
  • *
  • Posts: 8
Re: Add field in ask question POPUP
« Reply #6 on: November 01, 2012, 21:43:03 pm »
Could someone tell me, why "ort" is not showing on the email?

Here are my change:


Form.php:

<label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_NAME')  ?> : <input type="text" class="validate[required,minSize[4],maxSize[64]]" value="<?php echo $this->user->name ?>" name="name" id="name" size="30"  validation="required name"/></label>
         <br />
         <label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_EMAIL')  ?> : <input type="text" class="validate[required,custom[email]]" value="<?php echo $this->user->email ?>" name="email" id="email" size="30"  validation="required email"/></label>
         <br />
      <label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_PHONE')  ?> : <input type="text" class="validate[required,minSize[4],maxSize[64]]" value="<?php echo $this->user->phone ?>" name="phone" id="phone" size="30"  validation="required phone"/></label>
         <br />   
            <label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_ORT')  ?> : <input type="text" class="validate[required,minSize[4],maxSize[64]]" value="<?php echo $this->user->ort ?>" name="ort" id="ort" size="30"  validation="required ort"/></label>
         <br />   
              <label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_PLZ')  ?> : <input type="text" class="validate[required,minSize[4],maxSize[64]]" value="<?php echo $this->user->plz ?>" name="ort" id="plz" size="30"  validation="required plz"/></label>
         <br />   
         <label><?php echo JText::_('COM_VIRTUEMART_USER_FORM_ADRESS')  ?> : <input type="text" class="validate[required,minSize[4],maxSize[64]]" value="<?php echo $this->user->adress ?>" name="adress" id="plz" size="30"  validation="required adress"/></label>
         <br />   

mail_raw_question:

<?php
defined('_JEXEC') or die('');

echo JText::sprintf('COM_VIRTUEMART_WELCOME_VENDOR', $this->vendor->vendor_store_name) . "\n" . "\n";
echo JText::_('COM_VIRTUEMART_QUESTION_ABOUT') . ' '. $this->product->product_name."\n" . "\n";
echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user->name, $this->user->email, $this->user->phone, $this->user->ort, $this->user->plz, $this->user->adress) . "\n";

echo $this->comment. "\n";

mail_html_question:

  <?php
                echo JText::sprintf('COM_VIRTUEMART_QUESTION_MAIL_FROM', $this->user['name'], $this->user['email'], $this->user['phone'], $this->user['ort'], $this->user['plz'], $this->user['adress']). "<br />";
                  echo $this->phone. "<br />";
                     echo $this->ort. "<br />";
                      echo $this->plz. "<br />";
                         echo $this->adress. "<br />";
                            echo $this->comment. "<br />";
               
                ?>                 

view.html.php:

function renderMailLayout () {

      $this->setLayout ('mail_html_question');
      $this->phone = JRequest::getString ('phone');
      $this->ort = JRequest::getString ('ort');
      $this->plz = JRequest::getString ('plz');
      $this->adress = JRequest::getString ('adress');
      $this->comment = JRequest::getString ('comment');


Name, email, phone, plz, adress and comment is showing on the email, but "ort" is not showing! could someone tell me my fault?

Plz advise

Greetings,

marco

servlet

  • Jr. Member
  • **
  • Posts: 348
  • Business optimization
    • Фототапети
  • VirtueMart Version: 3.2.2
Re: Add field in ask question POPUP
« Reply #7 on: April 24, 2013, 17:42:05 pm »
after all the received email is broken
it contain:

Quote
body, td, span, p, th { font-size: 11px; } table.html-email {margin:10px auto;background:#fff;border:solid #dad8d8 1px;} .html-email tr{border-bottom : 1px solid #eee;} span.grey {color:#666;} span.date {color:#666;font-size: 10px;} a.default:link, a.default:hover, a.default:visited {color:#666;line-height:25px;background: #f2f2f2;margin: 10px ;padding: 3px 8px 1px 8px;border: solid #CAC9C9 1px;border-radius: 4px;-webkit-border-radius: 4px;-moz-border-radius: 4px;text-shadow: 1px 1px 1px #f2f2f2;font-size: 12px;background-position: 0px 0px;display: inline-block;text-decoration: none;} a.default:hover {color:#888;background: #f8f8f8;} .cart-summary{ } .html-email th { background: #ccc;margin: 0px;padding: 10px;} .sectiontableentry2, .html-email th, .cart-summary th{ background: #ccc;margin: 0px;padding: 10px;} .sectiontableentry1, .html-email td, .cart-summary td {background: #fff;margin: 0px;padding: 10px;}

this is from: views/askquestion/tmpl/mail_html_question.php

Quote
    <head>
   <style type="text/css">
            body, td, span, p, th { font-size: 11px; }
       table.html-email {margin:10px auto;background:#fff;border:solid #dad8d8 1px;}
       .html-email tr{border-bottom : 1px solid #eee;}
       span.grey {color:#666;}
       span.date {color:#666;font-size: 10px;}
       a.default:link, a.default:hover, a.default:visited {color:#666;line-height:25px;background: #f2f2f2;margin: 10px ;padding: 3px 8px 1px 8px;border: solid #CAC9C9 1px;border-radius: 4px;-webkit-border-radius: 4px;-moz-border-radius: 4px;text-shadow: 1px 1px 1px #f2f2f2;font-size: 12px;background-position: 0px 0px;display: inline-block;text-decoration: none;}
       a.default:hover {color:#888;background: #f8f8f8;}
       .cart-summary{ }
       .html-email th { background: #ccc;margin: 0px;padding: 10px;}
       .sectiontableentry2, .html-email th, .cart-summary th{ background: #ccc;margin: 0px;padding: 10px;}
       .sectiontableentry1, .html-email td, .cart-summary td {background: #fff;margin: 0px;padding: 10px;}
   </style>

    </head>

I cant understand where is the problem.
and if I reset edited files the email is still broken
I am using: Joomla 3.7.2 VM 3.2.2
Он-лайн магазин за фототапети http://mishelfoster.com

timdl

  • Beginner
  • *
  • Posts: 7
Re: Add field in ask question POPUP
« Reply #8 on: February 16, 2014, 15:58:12 pm »
askquestion/view.html.php

function renderMailLayout() {
   $this->setLayout('mail_html_question');
   $this->comment = JRequest::getString('comment');

COPY:
$this->comment = JRequest::getString('comment');

an change to yours

is this considered hacking? Can i still update virtuemart, if i add fields this way, without losing my changes?