Inicio > programacion > Nuevo campo en el form del producto [VirtueMart – Joomla]

Nuevo campo en el form del producto [VirtueMart – Joomla]

En el ejemplo agregare un campo que sea El costo en que el proveedor lo adquirio. este campo sera llamado Cost_product.

En PhpMyAdmin vamos a la tabla #_vm_product y metemos la siguiente consulta SQL:

ALTER TABLE #_vm_product ADD cost_product DOUBLE;

# = sufijo que este antes de “vm”

Archivos y lineas a editar:
[ PATH & FILE ] => homepath/administrator/components/com_virtuemart/HTML/product_product_form.php
[ LINES ] => 304 aproximadamente XD

[ PATH & FILE ] => homepath/administrator/components/com_virtuemart/classes/ps_product.php
[ LINES ] => 290 (Array $fields) and 493 (Array $fields) $d[‘$cost_product’]); al final de los dos arrays

Abrimos el product_product_form.php y agregamos en la linea 304 el siguiente code:


<table class="adminform">


<!--        AGREGAR CAMPO        -->

     <tr class="row1">
      <td width="20%" ><div style="text-align:right;font-weight:bold;">
        <?php echo "cost_product"; ?>:</div>
      <td width="20%" >
		<input type="text" class="inputbox"  name="cost_product" value="<?php $db->sp("cost_product"); ?>" size="10" maxlength="100"/>
<!--        TERMINA AGREGAR CAMPO       -->

guardamos y ahora vamos al archivo ps_product.php y vemos que se encuentran 2 arrays llamados $fields, son los que actualizan e ingresan nueva informacion a la BD, agregamos nuestra variable del campo en este caso es la linea 250 y 493:

$d['$cost_product']); // Linea agregada

La agregamos al final y quedaria asi:

$fields = array ( 'vendor_id' => $vendor_id,
						'product_parent_id' => vmRequest::getInt('product_parent_id'),
						'product_sku' => vmGet($d,'product_sku'),
						'product_name' => vmGet($d,'product_name'),
						'product_desc' => vmRequest::getVar('product_desc', '', 'default', '', VMREQUEST_ALLOWHTML),
						'product_s_desc' => vmRequest::getVar('product_s_desc', '', 'default', '', VMREQUEST_ALLOWHTML),
						'product_thumb_image' => vmGet($d,'product_thumb_image'),
						'product_full_image' => vmGet($d,'product_full_image'),
						'product_publish' => $d['product_publish'],
						'product_weight' => vmRequest::getFloat('product_weight'),
						'product_weight_uom' => vmGet($d,'product_weight_uom'),
						'product_length' => vmRequest::getFloat('product_length'),
						'product_width' => vmRequest::getFloat('product_width'),
						'product_height' => vmRequest::getFloat('product_height'),
						'product_lwh_uom' => vmGet($d,'product_lwh_uom'),
						'product_unit' => vmGet($d,'product_unit'),
						'product_packaging' => (($d["product_box"] << 16) | ($d["product_packaging"]&0xFFFF)),
						'product_url' => vmGet($d,'product_url'),
						'product_in_stock' => vmRequest::getInt('product_in_stock'),
						'attribute' => ps_product_attribute::formatAttributeX(),
						'custom_attribute' => vmGet($d,'product_custom_attribute'),
						'product_available_date' => $d['product_available_date_timestamp'],
						'product_availability' => vmGet($d,'product_availability'),
						'product_special' => $d['product_special'],
						'child_options' => $d['child_options'],
						'quantity_options' => $d['quantity_options'],
						'product_discount_id' => vmRequest::getInt('product_discount_id'),
						'cdate' => $timestamp,
						'mdate' => $timestamp,
						'product_tax_id' => vmRequest::getInt('product_tax_id'),
						'child_option_ids' => vmGet($d,'included_product_id'),
						'product_order_levels' => $d['order_levels'],
						'cost_product' => $d['cost_product']); // Linea Agregada

y ya podran agregar el precio neto en que el proveedor compro el producto o consultar/cambiar


Categorías:programacion Etiquetas: , ,
  1. Dante
    julio 17, 2012 en 2:07 pm

    Para meterle una consulta a la tabla, por donde se hace?

  2. septiembre 24, 2012 en 2:26 am

    Your style is so unique in comparison to other folks I have read
    stuff from. Many thanks for posting when you’ve got the opportunity, Guess I’ll just bookmark this site.

  3. octubre 11, 2012 en 2:53 am

    Hi! I’ve been following your weblog for a while now and finally got the bravery to go ahead and give you a shout out from Houston Texas! Just wanted to tell you keep up the great work!

  4. diciembre 16, 2012 en 12:42 am

    Its like you read my mind! You appear to know a lot about this, like you wrote the book in it
    or something. I think that you could do with some pics
    to drive the message home a bit, but other than that, this is magnificent blog.
    An excellent read. I’ll definitely be back.

  5. enero 3, 2013 en 6:36 pm

    Everyone loves what you guys tend to be up too.
    This kind of clever work and exposure! Keep up the very good works guys I’ve included you guys to my own blogroll.

  6. enero 7, 2013 en 7:51 am

    If some one wants to be updated with most up-to-date technologies afterward he must be pay a quick visit this website and be up to date every day.

  7. mayo 6, 2013 en 7:13 am

    May I just say what a comfort to find someone that really
    understands what they are talking about on the internet. You actually know how to bring an issue to light and make it
    important. More people must check this out and understand this side of your
    story. I was surprised you are not more popular because you surely have the gift.

  8. mayo 18, 2013 en 7:51 pm

    Além disso, não é exequível para os indivíduos para passar
    o pace em academias e clubes de saúde por causa de seus compromissos profissionais.
    Então, é a sua preferência em à frente
    lugar para obter uma solução simples e conveniente que é benevolente o suficiente para cumprir o seu propósito sem afetar suas programações.
    Em tais condições, zero poderia ser melhor do que Fort Max

  9. mayo 29, 2013 en 1:50 pm

    Hi, I do think this is an excellent site. I stumbledupon it 😉 I will
    come back yet again since i have book-marked it.

    Money and freedom is the greatest way to change, may you be rich and
    continue to guide other people.

  10. junio 29, 2013 en 2:54 am

    Paragraph writing is also a fun, if you know
    after that you can write otherwise it is difficult to

  11. julio 7, 2013 en 10:18 pm

    I’ve been on the web now for about seven today, and after I happened upon on, I was very delighted to.. In my opinion, if all web site entrepreneurs and blog writers produced top notch content material as you have, the internet will be a lot more useful than at any time before.

  12. julio 8, 2013 en 6:01 am

    Our specially designed program help you to build a
    strong foundation before you progress to more challenging ab
    workouts. Lots of people who do Pilates find that, while they get fantastically toned
    abs from the exercise, it also helps them become more flexible
    and generally fit. Perform the exercise constantly and as soon as
    a particular level of fitness is attained, this may be the time to raise the amount of exercise activities.

  13. julio 11, 2013 en 12:15 am

    7 Weeks to 50 Pull-Ups: Strengthen and Sculpt Your Arms, Shoulders,
    Back, and Abs by Training to Do 50 Consecutive Pull-Ups by Brett Stewart – In this book you follow a 7
    week program to help you build up your muscles in the toughest
    format. It is important that you exhale, not inhale which others get often
    confused about. Upon ending your workout, Sports Tracker
    will display a summary of the stats behind your workout, prompting you to
    sign in to your Sports Tracker account and upload your workout details.

  1. agosto 31, 2014 en 3:17 pm
  2. septiembre 4, 2014 en 3:19 pm
  3. septiembre 4, 2014 en 3:36 pm
  4. septiembre 5, 2014 en 7:19 am
  5. septiembre 12, 2014 en 5:13 am
  6. octubre 2, 2014 en 8:56 am
  7. octubre 11, 2014 en 2:44 pm
  8. octubre 18, 2014 en 2:00 pm
  9. noviembre 11, 2014 en 7:24 pm
  10. diciembre 29, 2014 en 6:27 pm
  11. octubre 1, 2015 en 8:25 am
  12. noviembre 4, 2015 en 7:28 am
  13. octubre 14, 2016 en 1:54 am


Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de

Estás comentando usando tu cuenta de Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s

A %d blogueros les gusta esto: