php - undefined index (opencart) -


i'm trying add new input text in opencart, view payment_method.tpl added

<label><?php echo $text_comments; ?></label> <textarea name="comment" rows="8" style="width: 98%;"><?php echo $comment; ?></textarea>   <label><?php echo $text_referred; ?></label> // code  <input type="text" name="referred" value="<?php echo $referred; ?>" /> 

in controller payment_method.tpl added

if (!$json) {                 $this->session->data['payment_method'] = $this->session->data['payment_methods'][$this->request->post['payment_method']];                 $this->session->data['comment'] = strip_tags($this->request->post['comment']);                 $this->session->data['referred'] = $this->request->post['referred']; //my code             }    

and

if (isset($this->session->data['referred'])) {             $this->data['referred'] = $this->session->data['referred']; //variable         } else {             $this->data['referred'] = '';         } 

in model order.php

$this->db->query("insert `" . db_prefix . "order` set invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "',  referred = '" . $this->db->escape($data['referred']) . "', 

my error logs show

2014-09-21 12:57:42 - php notice:  undefined index:  referred in /home/dlars/public_html/tempdir/vqmod/vqcache/vq2-catalog_controller_checkout_payment_method.php on line 212 2014-09-21 12:57:42 - php notice:  undefined index:  referred in /home/dlars/public_html/tempdir/vqmod/vqcache/vq2-catalog_model_checkout_order.php on line 4 

i gather whatever on view isn't being posted controller, i'm not sure else can define referred. thought oc whatever defined inside view, it's posted controller?

someone please help

thanks in advance

the problem here obvious. new referred input not passed via http ajax request. caused in different template - checkout.tpl. open up, scroll end , search js callback:

$('#button-payment-method').live('click', function() { 

here find line

data: $('#payment-method input[type=\'radio\']:checked, #payment-method input[type=\'checkbox\']:checked, #payment-method textarea'), 

and change to:

data: $('#payment-method input[type=\'radio\']:checked, #payment-method input[type=\'checkbox\']:checked, #payment-method textarea, #payment-method input[type=\'text\']'), 

now value should passed via ajax request , should set referred indexes.


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -