Author Topic: Create new fields in administration area in virtuemart 2  (Read 2972 times)

mdelreal

  • Beginner
  • *
  • Posts: 17
Create new fields in administration area in virtuemart 2
« on: December 07, 2012, 17:28:13 pm »
Hi,

I created a new fields in the area of administration. I have added to the file:

/ www / administrator / components / com_virtuemart / views / product / tmpl / product_edit_dimensions.php because wanted in that tab. (I added also in the database)

In principle works well, appearing on the administrative side, but I've realized I'm missing something because the changes are not recorded in the database

Anyone know what I need?

Many thanks for your help

Cheers,
Manuel

mdelreal

  • Beginner
  • *
  • Posts: 17
Re: Create new fields in administration area in virtuemart 2
« Reply #1 on: December 11, 2012, 01:20:10 am »
No one???  :(


bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: Create new fields in administration area in virtuemart 2
« Reply #2 on: December 11, 2012, 11:33:02 am »
?? Did you try custom fields?
What are you trying to do?
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

mdelreal

  • Beginner
  • *
  • Posts: 17
Re: Create new fields in administration area in virtuemart 2
« Reply #3 on: December 13, 2012, 22:26:25 pm »
Hello bytelord,

First of all thank you for the answer

No, I have not tried the custom fiels because i need a specific format and for me it¡s easier manage so the fields.

What I have done is to add the fields in the database and in the file / www / administrator / components / com_virtuemart / views / product / tmpl / product_edit_dimensions.php, and from the product page call those fields and it works great well, I can locate where I want. The problem is that when I change the administrator data are not stored in the database ... and I'm doing it directly in the database that I have linked via ODBC with Access

Surely I can in some file enlist these fields so that I run the stored procedure

thank you very much
Manuel

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10435
  • VirtueMart Version: 3+
Re: Create new fields in administration area in virtuemart 2
« Reply #4 on: December 13, 2012, 22:43:28 pm »
mdelreal,
it's best to use custom fields.

Every time you update it will delete them when you hack the core.

what are you trying to do?

You can do anything with a custom plugin

mdelreal

  • Beginner
  • *
  • Posts: 17
Re: Create new fields in administration area in virtuemart 2
« Reply #5 on: December 14, 2012, 22:25:29 pm »
I know you use custom fields can be easier, but does not help, I need a particular format to display products. I mean an example of a product http://www.kairel.com/llaveros-de-metal/llavero-metal.html

I have many new fields and I have to arrange it on the web in a way, with both custom fiels I have no control over the design.

Another reason is that it is an online catalog, for example putting a price range is this version of VM is complicated.

thanks
Manuel

bytelord

  • Nikos
  • Global Moderator
  • Full Member
  • *
  • Posts: 2369
Re: Create new fields in administration area in virtuemart 2
« Reply #6 on: December 14, 2012, 22:33:30 pm »
Hello,

But you can control custom fields by creating new positions, place your where you want and style it as you wish with CSS by adding a div class or more...
http://forum.virtuemart.net/index.php?topic=111107.msg372786#msg372786
http://forum.virtuemart.net/index.php?topic=99225.0

So, use custom fields without cart variation ... or with :)

Regards
Production: Joomla 2.5.8 | VM 2.0.14 | PHP 5.3.13
Testing     : Joomla 2.5.8 | VM 2.0.16 | PHP 5.3.8
Testing     : Joomla 2.5.8 |    VM 2.1   | PHP 5.3.8

- Don't Forget to mark thread as solved when it is solved!
- Please do not PM with support questions, use the forum!

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10435
  • VirtueMart Version: 3+
Re: Create new fields in administration area in virtuemart 2
« Reply #7 on: December 14, 2012, 23:01:47 pm »
mdelreal,

You can do a lot with the position, and some styling.

Here is my default_customfields.php  I separate them by position



<?php foreach ($this->product->customfieldsSorted[$this->position] as $field) {
         if ($field->layout_pos == warranty) {
         echo $field->display;
         }
       }
       ?>
      
      <?php foreach ($this->product->customfieldsSorted[$this->position] as $field) {
         if ($field->layout_pos == discount10) {
         echo $field->display;
         }
       }
       ?>
      
Look at this position here
        <?php
       if (!empty($this->product->customfieldsSorted[$this->position])) {
if ($this->product->product_weight == 0){ $bwidth = "width49";}
else {$bwidth= "width90";}

       foreach ($this->product->customfieldsSorted[$this->position] as $field ) {
      if ($field->layout_pos == banners) {
          ?><div class="wrap"></div><div class="font15 left10 red shadow top10 center width90" id="saleBanner"><div class="<?php echo $bwidth ?>"><?php echo $field->display ?></div><?php if ($this->product->product_weight == 0) { ?>
                  <div class="width49"><?php echo JText::_('COM_VIRTUEMART_FREE_SHIP'); ?> <?php if ($this->product->min_order_level >1){ echo JText::_('COM_VIRTUEMART_FREE_SHIP_QUAN') .$this->product->min_order_level ;} ?></div><div class="wrap"></div>
               <?php    }?>   </div><div class="wrap"></div>
          <?php
      }
       } }
       ?>
      
if you notice, i use a totally different style for the position   banners

THEN: for example,   in productdetails/default.php

I use this for the a string field that's a single <li>   inside of a <ul>
<?php
if (!empty($this->product->customfieldsSorted['discount10'])) {
   $this->position='discount10';
   echo '<li class="redtext">';
   echo $this->loadTemplate('customfields');
   echo '</li>';}
?>

You can do just what you want to without hacking the core