Author Topic: I can not add a new field to my table orders  (Read 686 times)


  • Beginner
  • *
  • Posts: 16
  • Skype Name: tazcabe
I can not add a new field to my table orders
« on: June 27, 2014, 18:17:32 pm »
Hi good afternoon, I'm trying to add a new field to the table of orders, but unfortunately not and could. That's why I come to ask for help from experts.

Start by specifying the versions I'm using:

Joomla! 2.5.13
Virtuemart 2.0.20b

The name of my table is:


The field I added is called:


This field already initialized in the file:
\ Administrator \ components \ com_virtuemart \ tables \ orders.php

 / ** @ Var int branch ID * /

sucursal_id $ var = 0;

In the model orders add a method which builds me a list that is constructed with the data in a table that I have in my database:

administrator \ components \ com_virtuemart \ models \ orders.php

and the code is as follows:

/*Obtiene sucursales*/

   function getSucursales() {
      $db = JFactory::getDBO();
      $query = "SELECT `id` AS `value`, `nombre_de_la_sucursal` AS text
                  FROM `#__rednovo_sucursales`";
      $options = $db->loadObjectList();
      array_unshift($options, JHTML::_('select.option',  '0', '- '. JText::_('COM_VIRTUEMART_SELECT_SUCURSAL') .' -' ));
      return $options;

   /*End Obtiene sucursales*/

Finally in my view orders


add the model

$ Mf_model = VmModel :: getModel ('orders');
$ SucursalList = $ mf_model-> getSucursales ();

and generated the list

$ Selected_option = isset ($ this-> orderslist-> sucursal_id)? $ This-> orderslist-> sucursal_id: 0;
$ This-> lists ['sucursalList'] = JHTML :: _ ('select.genericlist', $ sucursalList, 'nombre_de_la_sucursal', 'class = "inputbox"', 'value', 'text', $ selected_option, false, false);

and I add a column to the list

<!-- Se imprime el selec con el array de Sucursal -->
    <td style="position:relative;">                  
      <?php echo $this->lists['sucursalList'];?>
      <?php echo '<br>'; ?>                  
<!--  End Sucursal -->

doing this optengo a screen like the image I attached in

How could I do, so that the branch field is updated with the value of pressing the select button to update order?

[attachment cleanup by admin]