VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: mdelreal on December 07, 2012, 17:28:13 PM

Title: Create new fields in administration area in virtuemart 2
Post by: mdelreal 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
Title: Re: Create new fields in administration area in virtuemart 2
Post by: mdelreal on December 11, 2012, 01:20:10 AM
No one???  :(

Title: Re: Create new fields in administration area in virtuemart 2
Post by: bytelord on December 11, 2012, 11:33:02 AM
?? Did you try custom fields?
What are you trying to do?
Title: Re: Create new fields in administration area in virtuemart 2
Post by: mdelreal 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
Title: Re: Create new fields in administration area in virtuemart 2
Post by: PRO 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
Title: Re: Create new fields in administration area in virtuemart 2
Post by: mdelreal 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
Title: Re: Create new fields in administration area in virtuemart 2
Post by: bytelord 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
Title: Re: Create new fields in administration area in virtuemart 2
Post by: PRO 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