VirtueMart Forum

VirtueMart 2 + 3 => Product creation => Topic started by: PRO on March 07, 2012, 18:04:25 pm

Title: Custom Field Types (Explained)
Post by: PRO on March 07, 2012, 18:04:25 pm
still working

This thread will layout all types in the custom field list.

Custom Field Codes for Coders

S = String
I =Integer
P =Property (was Parent, which was a group!)
B= Bolean (True)
D = Date
T = Time
M =Image
V =Cart Variant
A =Generic Child Variant
X=Editor
Y=Textarea

For example
<?php if ($field->field_type == S){
My Special String Output
} ?>
Title: Re: Custom Field Types (Explained)
Post by: PRO on March 08, 2012, 16:12:17 pm
Using The Custom Field Type "String" for an extra field.

Warranty Display Example
1st Setup a Custom field type "string" called "warranty" like in the picture below.
Next Go Into a product, and apply the custom field "warranty" to the product.
Fill In the warranty text. 2 years, 3 years etc.

NEXT:: You need to create a position in your product details view for the warranty text.
<div id="warranty-text"><strong>This is the Warranty Div</strong>
<?php if (!empty($this->product->customfieldsSorted['warranty'])) {
   $this->position='warranty';
   echo $this->loadTemplate('customfields'); } ?></div>



[attachment cleanup by admin]
Title: Re: Custom Field Types (Explained)
Post by: PRO on March 08, 2012, 17:21:22 pm
Use the Custom field "IMAGE" to display a NON-cart Variant.

Free Shipping Icon on product page example.

1st Create a Custom field type "image" and name it "shipping icon" like the image below.
Next, upload your free shipping icon in "shop media files"
Go to edit product, and apply the custom field. Choose the image in the dropdown.

[attachment cleanup by admin]
Title: Re: Custom Field Types (Explained)
Post by: PRO on March 08, 2012, 19:13:18 pm
Using a String for external images


Create a Custom field  type "string" named "external"
In Edit Product apply the field. Paste the url to the image in the field.
This below is the code for displaying the image.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[external] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
            <img src="<?php echo $field->display ?>" alt="<?php echo $this->product->product_name ?>"  />
<?php } ?>
          <?php } ?> <?php } ?>
        </div>


Using a String to Link to related articles, installation instructions etc.


Create a Custom field  type "string" with the name "Installation Instructions" or whatever you want the anchor text to be.
Assign it to the position "link"
In Edit Product apply the field. Paste the url
This below is the code for displaying the link.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[link] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
             <a href="<?php echo $field->display ?>" ><?php echo JText::_($field->custom_title); ?></a>
<?php } ?>
          <?php } ?> <?php } ?>
        </div>
Title: Re: Custom Field Types (Explained)
Post by: kg on March 29, 2012, 17:20:18 pm
Hi
Thank you for this post.

It seems the list is not complete:
S = String
I=Integer
P=Parent
B=Boolean
D=Date
T=Time
M=Image
V=Cart Variant
A=Generic Child Variant
G=Plugin
X=Editor
Y=Text Editor


When I look in the code, it seems there is a type "E" and that is a Plugin with VM-Custom

// kg
Title: Re: Custom Field Types (Explained)
Post by: Da_Hobit on April 08, 2012, 10:13:43 am
thnx BanquetTables.pro for this great post !

with the products i use the custom fields this script works like a charm, but when i have a product without the custom fields i get the following error:

Warning: Invalid argument supplied for foreach() 

i guess i need to alter the code with a check if that custom field exists or not... but don't know it , can you help ?
maybe with :  if ($field != null) { 

thnx !  - my appologies when this reply is in the wrong topic -


 to 'open the link' in a new tab, just add "target="_blank" to a href code:
<a href="<?php echo $field->display ?>"target="_blank"><?php echo JText::_($field->custom_title); ?></a>

Title: Re: Custom Field Types (Explained)
Post by: PRO on April 08, 2012, 20:56:47 pm
is the foreach error in

default_customfields

or 

default.php
Title: Re: Custom Field Types (Explained)
Post by: Da_Hobit on April 08, 2012, 23:23:34 pm
default.php
Title: Re: Custom Field Types (Explained)
Post by: PRO on April 09, 2012, 11:45:11 am
This is how the ontop is done

<?php  if (!empty($this->product->customfieldsSorted['ontop'])) {
   $this->position = 'ontop';
   echo $this->loadTemplate('customfields');
    } // Product Custom ontop end
    ?>
Title: Re: Custom Field Types (Explained)
Post by: totallnet on May 19, 2012, 20:41:49 pm
Hi all

Is it possible to create Top Ten and Most Sales in custom fields too ??
I dont need to show in products page but only in my custom search ...

Thanks in advance

Kazuo
Title: Re: Custom Field Types (Explained)
Post by: gldproducts on June 05, 2012, 16:33:42 pm
Using The Custom Field Type "String" for an extra field.

Warranty Display Example
1st Setup a Custom field type "string" called "warranty" like in the picture below.
Next Go Into a product, and apply the custom field "warranty" to the product.
Fill In the warranty text. 2 years, 3 years etc.

NEXT:: You need to create a position in your product details view for the warranty text.
<div id="warranty-text"><strong>This is the Warranty Div</strong>
<?php if (!empty($this->product->customfieldsSorted['warranty'])) {
   $this->position='warranty';
   echo $this->loadTemplate('customfields'); } ?></div>

Pardon me, but what page do you add the code to?
Title: Re: Custom Field Types (Explained)
Post by: lipes on June 06, 2012, 16:23:01 pm
one question. In the Category i got this php code inserted in
<div class="product floatleft ... >
Code: [Select]
<div class="spacer">
<?php $custom_title null; foreach ($product->customfields as $field) {
if ($field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if ($field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?>
<?php }  ?>

When the products (In Category browsing) got any Custom Field image works good... but when the product doesnt have any custom field image gives me this msg:
Warning: Invalid argument supplied for foreach() in D:\Ampps\www\Teste2\templates\teste2\html\com_virtuemart\category\default.php on line 197
Title: Re: Custom Field Types (Explained)
Post by: PRO on June 06, 2012, 18:04:31 pm


if (!empty($product->customfields)) {


}
Title: Re: Custom Field Types (Explained)
Post by: lipes on June 06, 2012, 18:17:55 pm
yep now its showing the image CF in the Category with products... it's working with:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>
Title: Re: Custom Field Types (Explained)
Post by: jbmd on June 07, 2012, 15:28:23 pm
Please, is there any way how to make plugin "custom text input" obligatory (required)?
Title: Re: Custom Field Types (Explained)
Post by: cspub on June 11, 2012, 23:38:47 pm
I'm having a hard time trying to do something basic and not sure if the custom fields and cart variant is the way to go. Please advise.
We have products, say shirts. Most of the shirts can add monogramming. THere are 3 types of monogram and each has a different cost. We want to add drop down that says Monogram. From there they select the monogram type they want and it add the cost to the product.

Then they need to pick monogram font and color and enter text for monogram. Do i do this with custom fields? If so how do i group so that it is a drop down?
Title: Re: Custom Field Types (Explained)
Post by: cspub on June 13, 2012, 07:17:15 am
i have cart variant and add price to product. when you go to cart then it shows the added price as a discount and subtract.
Title: Re: Custom Field Types (Explained)
Post by: PRO on June 13, 2012, 14:21:27 pm
i have cart variant and add price to product. when you go to cart then it shows the added price as a discount and subtract.


wrong thread, this thread is NOT about cart variants
http://forum.virtuemart.net/index.php?topic=90833.0
Title: Re: Custom Field Types (Explained)
Post by: Mole_LR on July 25, 2012, 00:35:38 am
Hello!

What I have to do if I want to display product CustomFields into pdf? I'm trying to modify standard Joomla pdf plugin to print normally all information about the product - name, description, prices, images and CustomFields! All, except CustomFields, prints to pdf normally, but I can't make that CustomFields shows into pdf..

Thank You!
Title: Re: Custom Field Types (Explained)
Post by: Parsimonious on July 28, 2012, 23:38:21 pm


Using a String to Link to related articles, installation instructions etc.


Create a Custom field  type "string" with the name "Installation Instructions" or whatever you want the anchor text to be.
Assign it to the position "link"
In Edit Product apply the field. Paste the url
This below is the code for displaying the link.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[link] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
             <a href="<?php echo $field->display ?>" ><?php echo JText::_($field->custom_title); ?></a>
<?php } ?>
          <?php } ?> <?php } ?>
        </div>

I'm not understanding what I need to do. I created a custom custom field type: string, gave it a title, added it to a product, pasted the url in the empty box under value (i verified my url is valid). Now I don't know what to do to make it show in the front end. Do I have to put the code somewhere? If so where?
Title: Re: Custom Field Types (Explained)
Post by: PRO on July 29, 2012, 15:53:38 pm
http://forum.virtuemart.net/index.php?topic=97419.0
Title: Re: Custom Field Types (Explained)
Post by: RevoLion on August 06, 2012, 23:38:38 pm
Hi BanquetTables.pro,

Is there any documentation any where on how to add a date picker as a cart attribute in VM 2.0. I saw that "date" is a selection as a custom field and I need it to be a custom field. I tried adding it, but all it did was display todays date instead of allowing a customer to pick the date they want their greeting card delivered by.

Thanks for any help,
Jeremy
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 07, 2012, 13:26:09 pm
no , I dont know of one
Title: Re: Custom Field Types (Explained)
Post by: RevoLion on August 07, 2012, 18:19:24 pm
What would be the best way to go about this?
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 08, 2012, 18:34:35 pm
Hello,
thank you very much for this tutorial

Could you please tell me how to do to put a custom field to upload pdfs and than show automaticly an icon on the product page that we can clic to download the pdf?

Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PolishedGeek on August 08, 2012, 18:51:58 pm
@Amorino -

There's not a file upload Custom Field per se. However, you can do this by using Custom Field Type = editor, and using that to paste in a URL to the PDF, or a linked icon. You'll have to upload your PDFs first of course. Then you can place the PDF links into the product area the way I describe.
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 08, 2012, 18:56:26 pm
Hello PolishedGeek,
thank you for your answer
in the Virtuemart 1. it was so simple by adding the file in the media

There is no way to do it again with Virtuemart 2?

Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PolishedGeek on August 08, 2012, 19:06:12 pm
VM2 is a very different world than 1.1...... in many ways a better world, in other ways, not so much. Perhaps BanquetTables Pro knows another method and can suggest alternatives. He knows the custom fields functionality better than almost anyone on the forums.

Of course, you can always do the exact same thing with an icon and link in the product description field too, once the file has been uploaded to your media directory. But placing it into the product description won't give you the consistency in layout and presentation as putting it in its own specific field, and then controlling where that shows up on the page.
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 09, 2012, 00:00:36 am
Hello PolishedGeek,
thank you for your answer
in the Virtuemart 1. it was so simple by adding the file in the media

There is no way to do it again with Virtuemart 2?

Best regards
Amorino


Using a String to Link to related articles, installation instructions etc.
http://forum.virtuemart.net/index.php?topic=99225.msg327903#msg327903

Create a Custom field  type "string" with the name "Installation Instructions" or whatever you want the anchor text to be.
Assign it to the position "link"
In Edit Product apply the field. Paste the url
This below is the code for displaying the link.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[link] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
             <a href="<?php echo $field->display ?>" ><?php echo JText::_($field->custom_title); ?></a>
<?php } ?>
          <?php } ?> <?php } ?>
        </div>



AND:

have you tried checking the "Downloadable"   in the product image tab?


Title: Re: Custom Field Types (Explained)
Post by: amorino on August 09, 2012, 05:26:52 am
AND:

have you tried checking the "Downloadable"   in the product image tab?

Thank you a lot BanquetTables.pro
I tried downlable
I see it in the backend with the medias and it has a pdf icon
But how to insert that icon (cliccable) it in the category template and in the product template?

Best rgegards
Amorino

[Edit:]
Now it's OK in the details page by adding it in the custom field
But I need it in the categorie view because I will not use the detail page
I tried this code :
Code: [Select]
<?php
    
// Product Files
    // foreach ($this->product->images as $fkey => $file) {
    // Todo add downloadable files again
    // if( $file->filesize > 0.5) $filesize_display = ' ('. number_format($file->filesize, 2,',','.')." MB)";
    // else $filesize_display = ' ('. number_format($file->filesize*1024, 2,',','.')." KB)";

    /* Show pdf in a new Window, other file types will be offered as download */
    // $target = stristr($file->file_mimetype, "pdf") ? "_blank" : "_self";
    // $link = JRoute::_('index.php?view=productdetails&task=getfile&virtuemart_media_id='.$file->virtuemart_media_id.'&virtuemart_product_id='.$this->product->virtuemart_product_id);
    // echo JHTMl::_('link', $link, $file->file_title.$filesize_display, array('target' => $target));
    // }
    
if (!empty($this->product->customfieldsRelatedProducts)) {
echo $this->loadTemplate('relatedproducts');
    } 
// Product customfieldsRelatedProducts END

    
if (!empty($this->product->customfieldsRelatedCategories)) {
echo $this->loadTemplate('relatedcategories');
    } 
// Product customfieldsRelatedCategories END
    // Show child categories
    
if (VmConfig::get('showCategory'1)) {
echo $this->loadTemplate('showcategory');
    }
    if (!empty(
$this->product->customfieldsSorted['onbot'])) {
    
$this->position='onbot';
    
echo $this->loadTemplate('customfields');
    } 
// Product Custom ontop end
    
?>

in the category template but it didn't work
Any help please?
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 09, 2012, 14:39:48 pm
Sorry if i give a little up

but I'm blocked on how to insert the pdf in the category page
In the details page it's ok ;)
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 12, 2012, 13:58:58 pm
Hello
could you please tell me how to make this code working with custom field type image?
I used it to upload pdf files

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[link] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
             <a href="<?php echo $field->display ?>" ><?php echo JText::_($field->custom_title); ?></a>
<?php } ?>
          <?php } ?> <?php } ?>
        </div>


Best regrads
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 12, 2012, 15:06:53 pm
amorino,
The correct API is a little different, you have to check the position, to make sure it does not show up in all positions

the position name is "pdf"

If using a string for the pdf url

<?php foreach ($this->product->customfieldsSorted[$this->position] as $field) {
         if ($field->layout_pos == pdf) { ?>
<a class="pdficon" target="_blank" href="<?php echo $field->display;?>"></a><?php
         }
       }
       ?>

if just using image field
<?php foreach ($this->product->customfieldsSorted[$this->position] as $field) {
         if ($field->layout_pos == pdf) {
                               echo $field->display;
         }
       }
       ?>
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 12, 2012, 18:11:35 pm
Hello PRO,
thank you for your help I used the second code in Category template but it gives :
Warning: Invalid argument supplied for foreach() in /home/****/public_html/components/com_virtuemart/views/category/tmpl/default.php on line 305

In admin pannel I made the position of the field (pdf)

The code I used is :
<?php foreach ($this->product->customfieldsSorted[$this->position] as $field) {
         if ($field->layout_pos == pdf) {
                               echo $field->display;
         }
       }
       ?>

Coud you help me please
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 12, 2012, 18:32:45 pm
amorino, you cannot use this in category.



Title: Re: Custom Field Types (Explained)
Post by: amorino on August 12, 2012, 18:37:38 pm
Hello pro,

I tried it also in product details and it's the same :

Warning: Invalid argument supplied for foreach() in /home/****/public_html/components/com_virtuemart/views/productdetails/tmpl/default.php on line 54

Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: techmodule on August 13, 2012, 04:43:13 am
Using The Custom Field Type "String" for an extra field.

Warranty Display Example
1st Setup a Custom field type "string" called "warranty" like in the picture below.
Next Go Into a product, and apply the custom field "warranty" to the product.
Fill In the warranty text. 2 years, 3 years etc.

NEXT:: You need to create a position in your product details view for the warranty text.
<div id="warranty-text"><strong>This is the Warranty Div</strong>
<?php if (!empty($this->product->customfieldsSorted['warranty'])) {
   $this->position='warranty';
   echo $this->loadTemplate('customfields'); } ?></div>
Dear
I use the type of custom field is image
But i dont know how to add image to this
Plz check for me
Thank you

[attachment cleanup by admin]
Title: Re: Custom Field Types (Explained)
Post by: hiepnhung07 on August 13, 2012, 04:52:34 am
Using a String for external images


Create a Custom field  type "string" named "external"
In Edit Product apply the field. Paste the url to the image in the field.
This below is the code for displaying the image.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[external] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
            <img src="<?php echo $field->display ?>" alt="<?php echo $this->product->product_name ?>"  />
<?php } ?>
          <?php } ?> <?php } ?>
        </div>


Using a String to Link to related articles, installation instructions etc.


Create a Custom field  type "string" with the name "Installation Instructions" or whatever you want the anchor text to be.
Assign it to the position "link"
In Edit Product apply the field. Paste the url
This below is the code for displaying the link.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[link] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
             <a href="<?php echo $field->display ?>" ><?php echo JText::_($field->custom_title); ?></a>
<?php } ?>
          <?php } ?> <?php } ?>
        </div>

thank you for your teach but i am a new member and i dont know what's file i need add code to display image. please help me!
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 14, 2012, 18:09:01 pm
Hello,
nothing works for me to display the pdf file uploaded :(

Any step by step help please
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 14, 2012, 19:07:58 pm
I just uploaded a pdf just like a regular image, and it works good

WITHOUT using custom field

see image

[attachment cleanup by admin]
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 14, 2012, 19:14:53 pm
Thank you Pro
But how to put it in a specific position in the product details and category template
Thank you in advance
Amoriono
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 14, 2012, 19:58:40 pm

default_images.php
This code will NOT display the PDF icon in the additional images div


<?php
// Showing The Additional Images
// if(!empty($this->product->images) && count($this->product->images)>1) {
if (!empty($this->product->images) and count ($this->product->images)>1) {
    ?>
    <div class="additional-images">
   <?php
   // List all Images
   if (count($this->product->images) > 0) {
       foreach ($this->product->images as $image) {
       // Added By PRO
        if ($image->file_extension !=pdf) {
        // PRO Checks for PDF and does NOT Display it
      echo '<div class="floatleft">' . $image->displayMediaThumb('class="product-image"', true, 'class="modal"', true, true) . '</div>'; //'class="modal"'
       }}
        // PRO DONE, added the close tag
   }
   ?>
        <div class="clear"></div>
    </div>
<?php
} // Showing The Additional Images END ?>




THEN: This code will display the PDF icon wherever you want to put it

This code can go in

productsdetails/tmpl/default.php

<?php
//Pro Hack PDF to position
if (!empty($this->product->images) and count ($this->product->images)>1) {
    ?>
    <div class="additional-images">
   <?php
   // List all Images
   if (count($this->product->images) > 0) {
       foreach ($this->product->images as $image) {
       // Displays ONLY pdf files
        if ($image->file_extension ==pdf) {
      echo '<div class="floatleft">' . $image->displayMediaThumb('class="product-image"', true, 'class="modal"', true, true) . '</div>'; //'class="modal"'
       }}
        // PRO DONE, added the close tag
   }
   ?>
        <div class="clear"></div>
    </div>
<?php
}  ?>
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 14, 2012, 22:52:11 pm
Thank you a lot pro
I'm really near what I want to do

Now on the product page it works like a charm
I would just put it in category page
components/com_virtuemart/views/category/tmpl/default.php

But it doesn't work
Could you please help me to do it
Best regards
and thank youuuuuuuuuuuuuuuuu again
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 14, 2012, 23:58:37 pm
you could try changing the $this->
http://forum.virtuemart.net/index.php?topic=100696.0


Title: Re: Custom Field Types (Explained)
Post by: amorino on August 15, 2012, 04:19:34 am
Thank you again Pro
I tried
Code: [Select]
<?php
//Pro Hack PDF to position
if (!empty($product->images_name) and count ($product->images_name)>1) {
    
?>

    <div class="additional-images">
   <?php
   
// List all Images
   
if (count($product->images_name) > 0) {
       foreach (
$product->images_name as $image) {
       
// Displays ONLY pdf files
        
if ($image->file_extension ==pdf) {
      echo 
'<div class="floatleft"><strong> Télécharger la brochure : </strong> <br>' $image->displayMediaThumb('class="product-image"'true'class="modal"'truetrue) . '</div>'//'class="modal"'
       
}}
        
// PRO DONE, added the close tag
   
}
   
?>

        <div class="clear"></div>
    </div>
<?php
}  ?>

Also tried this :
Code: [Select]
<?php
//Pro Hack PDF to position
if (!empty($images->product_name) and count ($images->product_name)>1) {
    
?>

    <div class="additional-images">
   <?php
   
// List all Images
   
if (count($images->product_name) > 0) {
       foreach (
$images->product_name as $image) {
       
// Displays ONLY pdf files
        
if ($image->file_extension ==pdf) {
      echo 
'<div class="floatleft"><strong> Télécharger la brochure : </strong> <br>' $image->displayMediaThumb('class="product-image"'true'class="modal"'truetrue) . '</div>'//'class="modal"'
       
}}
        
// PRO DONE, added the close tag
   
}
   
?>

        <div class="clear"></div>
    </div>
<?php
}  ?>

also tried this :
Code: [Select]
<?php
//Pro Hack PDF to position
if (!empty($product->images) and count ($product->images)>1) {
    
?>

    <div class="additional-images">
   <?php
   
// List all Images
   
if (count($product->images) > 0) {
       foreach (
$product->images as $image) {
       
// Displays ONLY pdf files
        
if ($image->file_extension ==pdf) {
      echo 
'<div class="floatleft"><strong> Télécharger la brochure : </strong> <br>' $image->displayMediaThumb('class="product-image"'true'class="modal"'truetrue) . '</div>'//'class="modal"'
       
}}
        
// PRO DONE, added the close tag
   
}
   
?>
but always nothing to display
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 16, 2012, 02:19:46 am
Hello,
I'm sure that I'm almost near the solution but I'm missing something ;)
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 16, 2012, 16:09:46 pm
THIS code looks right, BUT >1  should probably not be there

THE main image is  0, the next is 1. So you would have to have 3 images for a display to happen

try this

<?php
//Pro Hack PDF to position
if (!empty($product->images) {
    ?>
    <div class="additional-images">
   <?php
   // List all Images
   if (count($product->images) > 0) {
       foreach ($product->images as $image) {
       // Displays ONLY pdf files
        if ($image->file_extension ==pdf) {
      echo '<div class="floatleft"><strong> Télécharger la brochure : </strong> <br>' . $image->displayMediaThumb('class="product-image"', true, 'class="modal"', true, true) . '</div>'; //'class="modal"'
       }}
        // PRO DONE, added the close tag
   }}
   ?>
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 16, 2012, 17:05:29 pm
Thank you pro
I tried that code and it gave me the 1st image and not the PDF file wich is in the second position

Pro when I do
<?php echo "<pre>"; print_r( $product->images ); echo "</pre>"; // CATEGORY PAGE ?>

I see only the jpg image in the media and not the pdf
How to make this page read the second file?
Thank you for your help
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 16, 2012, 19:16:11 pm
ok, I cannot get any image to work in category besides # 0

which is the main image
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 16, 2012, 20:02:20 pm
Thank you for your help Pro
So it's not possible to get the pdf icon in the category page like in the details page?
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 16, 2012, 20:20:56 pm
You can use the "internal notes" as a field.

Put the url of the pdf in the internal notes.

Then in the category


<a href="<?php echo $product->intnotes ?>">IMAGE FOR PDF</a>
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 16, 2012, 22:10:19 pm
What a good idea
Could you please wich file should I modify to get editor in Internal note
So I will install JCE with the File manager and just put : <?php echo $product->intnotes ?>

Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: amorino on August 16, 2012, 23:29:42 pm
Or what do you think about custom field "editor"
Could you help me to figure it out?
Best regards
Amorino
Title: Re: Custom Field Types (Explained)
Post by: PRO on August 17, 2012, 12:42:26 pm
amorino,

I told you how to do it

in your category template do this

<?php if (!empty($product->intnotes)){?>
<a href="<?php echo $product->intnotes ?>">IMAGE FOR PDF</a>
<?php } ?>


THEN, in the internal notes just write it like this


www.url.com/pdf/123.pdf


Title: Re: Custom Field Types (Explained)
Post by: imageinaction on October 04, 2012, 09:58:13 am
A question about the M=Image option

Hello ...

It would be good have the images behave as a button and dispose of the ugly radio buttons. How can this be done?
Title: Custom Field in Category view
Post by: uschmi on November 08, 2012, 12:38:33 pm
Sorry, I didn´t got it how to show a custom text field in category view.
Could someone please show me an example how to do this.

When trying to use the examples in this thread, I only get Edit forms in the view instead of a normal table view.
Title: Re: Custom Field Types (Explained)
Post by: webbits on November 13, 2012, 00:33:15 am
yep now its showing the image CF in the Category with products... it's working with:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>

Are there additional steps I am not getting?  I've tried this code in many positions etc. and still can not get the list for quantity variations to show on the category page.  Currently it is placed in the <div class="product floatleft just before the </div>

Using VM 2.0.12f  and Joomla 2.5.6

Please help - with a simple and direct solution as I am not proficient in php.  Thanks!
Title: Re: Custom Field Types (Explained)
Post by: Mole_LR on November 15, 2012, 01:47:26 am
What is the syntax to show THE CustomField, for example, CustomFieldX (not using foreach) into Category View. I'm using CategoryView as table and I need to show needed customfields in columns:

product_sku   customfieldX customfieldY
1111                  valueX1      valueY1
222                    valueX2       valueY2

Every product can have more customfields (also customfieldZ, customfieldA), but I need to show only these 2!

Is it possible, if yes - HOW?

Thank You!   
Title: Re: Custom Field Types (Explained)
Post by: amorino on December 07, 2012, 17:17:35 pm
Hello
I would hide "add to cart" on some productes (details page + category pages)

Could I make some condition with the custom fields
Any help please?

Best regrads
Amorino
Title: Re: Custom Field Types (Explained)
Post by: B4rZAg0nE on December 17, 2012, 05:26:44 am
It's possible to set position layout of custom fields in category view to filter specific custom fields?
Title: Re: Custom Field Types (Explained)
Post by: PRO on December 17, 2012, 18:44:14 pm
It's possible to set position layout of custom fields in category view to filter specific custom fields?

http://breakdesigns.net/extensions/cat-filters
Title: Re: Custom Field Types (Explained)
Post by: B4rZAg0nE on December 17, 2012, 21:12:39 pm
It's possible to set position layout of custom fields in category view to filter specific custom fields?

http://breakdesigns.net/extensions/cat-filters

i mean:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>

but   customfieldssort[something]
(layout position on category view)
Title: Re: Custom Field Types (Explained)
Post by: PRO on December 17, 2012, 21:41:08 pm
It's possible to set position layout of custom fields in category view to filter specific custom fields?

http://breakdesigns.net/extensions/cat-filters

i mean:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>

but   customfieldssort[something]
(layout position on category view)

I dont think you can do this

what do you want to display?

Title: Re: Custom Field Types (Explained)
Post by: B4rZAg0nE on December 17, 2012, 21:46:17 pm
It's possible to set position layout of custom fields in category view to filter specific custom fields?

http://breakdesigns.net/extensions/cat-filters

i mean:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>

but   customfieldssort[something]
(layout position on category view)

I dont think you can do this

what do you want to display?

I have some custom fields mmm maybe 7 or 8 string and i want to see only 3 strings of 8 in category view
2) but with this solution custom field description can't show label?
Title: Re: Custom Field Types (Explained)
Post by: B4rZAg0nE on December 18, 2012, 10:13:26 am
It's possible to set position layout of custom fields in category view to filter specific custom fields?

http://breakdesigns.net/extensions/cat-filters

i mean:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>

but   customfieldssort[something]
(layout position on category view)

I dont think you can do this

what do you want to display?

I have some custom fields mmm maybe 7 or 8 string and i want to see only 3 strings of 8 in category view
2) but with this solution custom field description can't show label?

i have followed this
Code: [Select]
if (!empty($product->customfields)) {
    foreach ($product->customfields as $k => $custom) {
if (!empty($custom->layout_pos)) {
    $product->customfieldsSorted[$custom->layout_pos][] = $custom;
    unset($product->customfields[$k]);
}
    }
    $product->customfieldsSorted['normal'] = $product->customfields;
    unset($product->customfields);
}
the problem is inculde this in precedent code to reach a read of layout position oh customfield
but i dn't know how...
Title: Re: Custom Field Types (Explained)
Post by: PRO on December 19, 2012, 21:36:54 pm
look at this thread
http://forum.virtuemart.net/index.php?topic=100191.0
Title: Re: Custom Field Types (Explained)
Post by: InvitesCouture on January 08, 2013, 19:56:17 pm
I am trying to add an option to my products to add personalization. for example. I sell invitations. the block stock price is set, but I want to add an option to check a box to add personalization for $5.00 per box. I was able to do this in vm1 but can not figure it out in VM2
I would prefer a check box or a button selection for yes or no and not a drop down screen.

Thanks in advance for your time
Title: Re: Custom Field Types (Explained)
Post by: noblefx on January 22, 2013, 23:02:14 pm
look at this thread
http://forum.virtuemart.net/index.php?topic=100191.0

Hello
You are really doing a great job help us here... I have gone through the thread but i want the details view to be tabbed like the one below:
http://www.boohoo.com/restofworld/sale/dresses/icat/saledresses/dresses/florence-lace-trim-shift-dress/invt/azz58820
I also want to change the positions of "related products" and "Recently viewed" as it is in the link above.
Thanks
Title: Re: Custom Field Types (Explained)
Post by: Scargo on January 30, 2013, 17:19:38 pm
Hy All!

I'm building a site for my mobile phone collection. I use custom field. NAme: NETWORK/HÁLÓZAT. The value may be 900 mhz; 1800 mhz; 1900 mhz; CDMA; etc...
How I can select multiple options - probably spam -ample 900 and 1800 mhz in network custom field, on admin site/product/custom fields and not just one?

Thx.

Scargo
Title: Re: Custom Field Types (Explained)
Post by: PRO on January 30, 2013, 17:30:31 pm
Hy All!

I'm building a site for my mobile phone collection. I use custom field. NAme: NETWORK/HÁLÓZAT. The value may be 900 mhz; 1800 mhz; 1900 mhz; CDMA; etc...
How I can select multiple options - probably spam -ample 900 and 1800 mhz in network custom field, on admin site/product/custom fields and not just one?

Thx.

Scargo

this thread is not for questions like this.

You will get more help starting a new thread
Title: Re: Custom Field Types (Explained)
Post by: Scargo on February 05, 2013, 20:20:19 pm
Thx. ok. I starting a new :)
Title: Re: Custom Field Types (Explained)
Post by: juanfer2k on February 07, 2013, 01:07:08 am
this is for the backend. and adds fields to the items Great.

¿What if the items need a custom message to be printed or embraced?
¿can the user choose a product and add his/her name to it?

This is what we need-

Thanks in advance
[/b][/size]
Title: Re: Custom Field Types (Explained)
Post by: PRO on February 07, 2013, 16:50:02 pm
this is for the backend. and adds fields to the items Great.

¿What if the items need a custom message to be printed or embraced?
¿can the user choose a product and add his/her name to it?

This is what we need-



yes thats called "text input"


There is a plugin that comes with vmart that does this
Title: Re: Custom Field Types (Explained)
Post by: juanfer2k on February 08, 2013, 18:51:37 pm
Thanks, it's in http://dev.virtuemart.net/projects/virtuemart/wiki/Product_custom_fields_Plugin_Customer_Text_Input
Title: Re: Custom Field Types (Explained)
Post by: Seltsian-Void on February 13, 2013, 08:20:45 am
I am trying to add an option to my products to add personalization. for example. I sell invitations. the block stock price is set, but I want to add an option to check a box to add personalization for $5.00 per box. I was able to do this in vm1 but can not figure it out in VM2
I would prefer a check box or a button selection for yes or no and not a drop down screen.

Thanks in advance for your time

Hello,

I'm from Czech republic, sorry for my English :-)

I'm looking for the same function in VM 2.0.18a. I have salad shop and I need to add custom field for adding for example "moreover onion" "moreover pepper" etc..Like for example in pizza shop. Is it possible to do that in VM2?

This is great example, what I need (czech pizza website)
(http://s19.postimage.org/l1gxkiznj/pizza.jpg) (http://postimage.org/image/l1gxkiznj/)

Thank You very much
Title: Re: Custom Field Types (Explained)
Post by: dorex on February 28, 2013, 14:52:37 pm
What is the syntax to show THE CustomField, for example, CustomFieldX (not using foreach) into Category View. I'm using CategoryView as table and I need to show needed customfields in columns:

product_sku   customfieldX customfieldY
1111                  valueX1      valueY1
222                    valueX2       valueY2

Every product can have more customfields (also customfieldZ, customfieldA), but I need to show only these 2!

Is it possible, if yes - HOW?

Thank You!   

I've been reading almost all the posts related to custom fields. The above quoted answer is the only one I found, which is somehow related to my question. The problem is that the above mentioned question was never answered. Here is my question:

In the productdetails page, I would like to display a 2 colon table with all the details about the product ( not just the customfields !).

A table structure for the output, for example:

"Manufacturer:"         manufacturer name
"Product Title:"          title of the product
"Category:"               name of the category
"XYZ 001:"                 custom field value
"XYZ 002:"                 custom field value
"XYZ 003:"                 custom field values


NONE of the customfields are Cart Variant.

Customfield's specs are as follows:
XYZ 001   -   ID 30  - integer - one value per each product
XYZ 002   -   ID 31  - string - one value per each product
XYZ 003   -   ID 32  - string - multiple values per each product

So far, I've managed to display the first three rows.

My question is how do I echo the value of a SPECIFIC customfield (ONLY ONE customfield, without using foreach) in the productdetails page? (I want to insert that into a table cell.)

Thank you in advance for any advice on this one.

Here is what I tried (found some code in this post: http://forum.virtuemart.net/index.php?topic=100191.0 , but doesn't work) :


Code: [Select]


<table class="table_d_021">

<tr>
<th>Characteristics</th>
</tr>


<tr class="td02row_01">
<td>Manufacturer:</td>
<td><?php echo $this->product->mf_name ?></td>
</tr>


<tr class="td02row_02">
<td>Model:</td>
<td><?php echo $this->product->product_name ?></td>
</tr>


<tr class="td02row_01">
<td>Category:</td>
<td><?php echo $this->category->category_name?></td>
</tr>


<tr class="td02row_02">
<td>XYZ 001:</td>
<td>

<?php
     $db JFactory::getDBO();
  $query $db->getQuery(true);
  $query->select('custom_value');
  $query->from('#__fra_virtuemart_product_customfields');
  $query->where('virtuemart_product_id="' . (int) $db->escape($product->virtuemart_product_id) . '"');
  $query->where('virtuemart_custom_id="30"');
  $db->setQuery($query);
  $result $db->loadResult();
  echo "<span class=\"YourClass\">".$result."</span>";
?>


</td>
</tr>


<tr class="td02row_01">
<td>XYZ 002:</td>
<td>
                                  <div>
                 <?php if ($field->custom_title != "xyz-002") { ?>
                                 <?php echo JText::_($field->custom_title); ?>
                                 <?php if ($field->custom_tip) echo JHTML::tooltip($field->custom_tip,  JText::_($field->custom_title), 'tooltip.png');
         } 
?>

                                  <span class="product-field-display"><?php echo $field->display ?></span>
                                  <span class="product-field-desc"><?php echo jText::_($field->custom_field_desc?></span>
                 </div>

</td>
</tr>


<tr class="td02row_02">
<td>XYZ 003:</td>
<td> ...........  </td>
</tr>

   
</table>



Title: Re: Custom Field Types (Explained)
Post by: PRO on February 28, 2013, 17:07:40 pm
why not just use the custom field "specification" ??

Title: Re: Custom Field Types (Explained)
Post by: dorex on February 28, 2013, 20:17:32 pm
why not just use the custom field "specification" ??



Hi! Banquet, I don't really understand what you mean by custom field "specification".

I need to display in the same table the product title, the manufacturer, the category and some of the custom fields. Due to the fact that the custom fields output comes from default_customfields.php and not from default.php, it makes it very complicated for me. I took a look in default_customfields.php and even there the custom fields are called using "foreach". This is what puts them together and makes me helpless :( ... can't them be called separately ... by their ID, for example ?

Can you help me to display the value of a custom field (specified by it's ID or by it's name) in the product details page?

Thank you.
Title: Re: Custom Field Types (Explained)
Post by: dorex on February 28, 2013, 20:33:24 pm
Let me know if this is what you suggested by custom field "specification":

Create only one custom field, name it "Specification" and insert all the data in it, so that the "foreach" only displays one custom field?

This is not possible in my case, because even if they are not cart variants, all those custom fields are used with the "Custom Filter Pro"(from breakdesigns) in order to  filter the results in category-view.
Putting all the data in only one custom filter would make the results filtration useless and annoying for the visitor.

Thank you.
Title: Re: Custom Field Types (Explained)
Post by: PRO on February 28, 2013, 21:56:57 pm
I am talking about the custom field "type"  "specification"


Hard Drive: Good
Monitor: Bad

etc.

Thats what its for

[attachment cleanup by admin]
Title: Re: Custom Field Types (Explained)
Post by: dorex on February 28, 2013, 23:28:30 pm
I am talking about the custom field "type"  "specification"


Hard Drive: Good
Monitor: Bad

etc.

Thats what its for

Thank you for your answer, Banquet.  I followed your advice and I've just tested custom field type "specification".  [ off topic: I think it has a bug you should check: Change the value "ABC" to "XYZ" in "Default info" field and click "save"; now you go to a product where this custom field was previously added, remove the custom field from there, save the product, then add the same custom field to the same product. It is now added with the old default info ("ABC"), instead of the new one ("XYZ"). ]

It doesn't answer to my question and it doesn't solve the problem, either. It is not what I need, because:

-- it only has two "Characteristic Label" & "Default info" fields. This means I should have a parent and create more children (custom field type specification) for it.
-- One should duplicate all the data from the other custom fields (the ones used for filtering results). This is NOT acceptable by the person who will administrate the shop. It's just about the same automation as pasting a table with specifications in the product description. And this process also can generate discrepancies between the data sets.

So, my question is still the same:

Can you help me to display the value of a custom field (specified by it's ID or by it's name) in the product details page?

Thank you.


Title: Re: Custom Field Types (Explained)
Post by: PRO on March 01, 2013, 19:57:24 pm


I use this in default.php

<?php
if (!empty($this->product->customfieldsSorted['discount10'])) {
   $this->position='discount10';
   echo '<li class="redtext">';
   echo $this->loadTemplate('customfields');
   echo '</li>';}
?>

Its inside of a UL right under price


I do the same with warranty etc.

THEN:


YOU change default_customfields.php

to have specifics


here is my default_customfields.php

<?php defined ( '_JEXEC' ) or die ( 'Restricted access' );
?>

<?php foreach ($this->product->customfieldsSorted[$this->position] as $field) {
// this is a very simple 1 separated by warranty position
         if ($field->layout_pos == warranty) {
         echo $field->display;
         }
       }
       ?>
      
      <?php foreach ($this->product->customfieldsSorted[$this->position] as $field) {
// this is a very simple 1 seperated by warranty position
         if ($field->layout_pos == discount10) {
         echo $field->display;
         }
       }
       ?>
      
        <?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
      }
       } }
       ?>
      



as you can see I have different layouts foreach() position
Title: Re: Custom Field Types (Explained)
Post by: sankalptech on March 07, 2013, 09:53:24 am
Good explanation about custom field types.
Title: Re: Custom Field Types (Explained)
Post by: realistix on March 14, 2013, 11:23:16 am

THEN: This code will display the PDF icon wherever you want to put it [/b]
This code can go in

productsdetails/tmpl/default.php

<?php
//Pro Hack PDF to position
if (!empty($this->product->images) and count ($this->product->images)>1) {
    ?>
    <div class="additional-images">
   <?php
   // List all Images
   if (count($this->product->images) > 0) {
       foreach ($this->product->images as $image) {
       // Displays ONLY pdf files
        if ($image->file_extension ==pdf) {
      echo '<div class="floatleft">' . $image->displayMediaThumb('class="product-image"', true, 'class="modal"', true, true) . '</div>'; //'class="modal"'
       }}
        // PRO DONE, added the close tag
   }
   ?>
        <div class="clear"></div>
    </div>
<?php
}  ?>

Hi Pro, just a quick question about the above code, got it working fine to display pdf with thumbnail on thep roduct description page but I would like it to display the "Displayed image subtitle" underneath. I have filled in the field for the pdf but it doesn't show on the product page. I'm assming it's just going to need one line of code?

Thanks in advance
Title: Re: Custom Field Types (Explained)
Post by: patben on May 16, 2013, 12:38:58 pm
I want to display multiple custom fields in one place on product page, I have custom fields for books,  like pages, ISBN, publisher, etc and i want to display them together  like specification.
how can I do that??
Title: Re: Custom Field Types (Explained)
Post by: jjk on May 16, 2013, 20:24:56 pm
I have custom fields for books,  like pages, ISBN, publisher, etc and i want to display them together  like specification.
how can I do that??

You can define a custom field named i.e. "Product Details" and then group all the other custom fields like Publisher, ISBN, Language, Format, etc. by selecting "Product Details" as the parent in the custom field settings. Thereafter you can select "Product Details" in your 'Product Edit' > 'Custom Fields' setting and all of them will display.
Title: Re: Custom Field Types (Explained)
Post by: patben on May 17, 2013, 12:20:29 pm

You can define a custom field named i.e. "Product Details" and then group all the other custom fields like Publisher, ISBN, Language, Format, etc. by selecting "Product Details" as the parent in the custom field settings. Thereafter you can select "Product Details" in your 'Product Edit' > 'Custom Fields' setting and all of them will display.

i have groop all in a parent but when i put this parent to a product each custom field is in a new tab and not all in one
Title: Re: Custom Field Types (Explained)
Post by: jjk on May 17, 2013, 13:15:23 pm
... each custom field is in a new tab and not all in one
That sounds like a problem with your template. You may switch temporarily to a standard Joomla template to see if it makes a difference.
Title: Re: Custom Field Types (Explained)
Post by: George Guebelli on June 05, 2013, 01:38:57 am
Hello,
I am using Joomla 2.5.11 and VM 2.0.20b
I'm having problems setting up a textarea in my product. I go to Custom fields and set up as per instructions and save.
When I go to apply to a product, I select the text area and it places a huge textarea in the product area of the admin. I save it.
I go to product on Front end and there is nothing there.

I just need a simple textarea where the user can input special instructions for a product. Some products need this others don't.

Can someone please help me?

my site is www.guebelli.com/tshirts

Thanks,

George
Title: Re: Custom Field Types (Explained)
Post by: AH on June 05, 2013, 09:35:48 am
You will need to change the dimensions of the text area using CSS
Title: Re: Custom Field Types (Explained)
Post by: jjk on June 05, 2013, 09:54:00 am
I suppose this is what you are looking for: http://www.daycounts.com/shop/virtuemart-2/virtuemart-textarea-custom-field-detail
Title: Re: Custom Field Types (Explained)
Post by: fbc on July 18, 2013, 00:53:30 am
I have to input this into the DEFAULT field but it's limited to a certian number of characters.

These are my colors:
Code: [Select]
1 BLANCO;2 ROSA PASTEL;3 NATURLA / CRUDO;4 HUESO;5 BEIGE;6 CAFÉ;7 TINTO;8 AZUL REY;9 AZUL MARINO;10 NEGRO;11 VERDE BOTELLA;12 ROJO;13 UVA;14 SALMON / DURAZNO;15 ARENA;16 VERDE BANDERA;17 AZUL INDIGO;18 PALO DE ROSA;19 TURQUESA;20 MOSTAZA;21 AZUL CIELO;22 ROSA SECO;23 ROSA MALVA;24 VERDE PISTACHE;25 LADRILLO;26 LILA;27 VERDE MENTA;28 FIUSHA;29 GROSELLA;30 GRIS CHOFER;31 SHEDRON;32 ROSA ALBARICOQUE;33 GRIS OXFORD;34 VERDE MANZANA;35 AMARILLO PAJA;36 CAFÉ MOKA;37 KHAKI;38 GRIS PLATA;39 TORONJA;40 PETROLEO;41 CORAL;42 ROSA CORAL;43 VERDE OLIVO / MILITAR;44 ROJO GRANATE;45 AZUL PIZARRA / PLUMBAGO;46 NEGRO JASPE;47 AZUL ACERO;48 CHAMPAGNE;49 CAMELLO;50 ZANAHORIA;51 VERDE NOGAL;52 VERDE SECO;53 VERDE MILITAR;54 COCOA;55 AZUL IMPERIAL;56 AZUL CERULEO;57 AZUL CRISTAL;58 MORADO;60 VERDE ESMERALDA;61 AMARILLO;62 GRIS OSTION;63 CHARCOAL;64 GRIS PALIDO;65 VIOLETA;67 BUGAMBILIA;68 AMARILLO MANGO;72 VERDE JADE;73 NARANJA;74 VERDE NEON;75 AMARILLO NEON;76 ROSA NEON;77 NARANJA NEON;78 GRIS TOPO;79 LAVANDA;80 BARNEY;81 VERDE LIMON;82 PLATA JASPE;83 OXFORD JASPE;84 MARINO JASPE;85 CAFÉ JASPE;86 DURAZNO NEON;87 CORAL NEON;88 AZUL AGUA;90 ORO;91 PLATA;92 COBRE;93 ROSA BOREAL;95 IVORY JASPE;96 IVORY;97 NUDE;98 MORADO AMATISTA;99 AMARILLO PASTEL
Title: Re: Custom Field Types (Explained)
Post by: PRO on July 18, 2013, 04:12:48 am
I have to input this into the DEFAULT field but it's limited to a certian number of characters.

These are my colors:
Code: [Select]
1 BLANCO;2 ROSA PASTEL;3 NATURLA / CRUDO;4 HUESO;5 BEIGE;6 CAFÉ;7 TINTO;8 AZUL REY;9 AZUL MARINO;10 NEGRO;11 VERDE BOTELLA;12 ROJO;13 UVA;14 SALMON / DURAZNO;15 ARENA;16 VERDE BANDERA;17 AZUL INDIGO;18 PALO DE ROSA;19 TURQUESA;20 MOSTAZA;21 AZUL CIELO;22 ROSA SECO;23 ROSA MALVA;24 VERDE PISTACHE;25 LADRILLO;26 LILA;27 VERDE MENTA;28 FIUSHA;29 GROSELLA;30 GRIS CHOFER;31 SHEDRON;32 ROSA ALBARICOQUE;33 GRIS OXFORD;34 VERDE MANZANA;35 AMARILLO PAJA;36 CAFÉ MOKA;37 KHAKI;38 GRIS PLATA;39 TORONJA;40 PETROLEO;41 CORAL;42 ROSA CORAL;43 VERDE OLIVO / MILITAR;44 ROJO GRANATE;45 AZUL PIZARRA / PLUMBAGO;46 NEGRO JASPE;47 AZUL ACERO;48 CHAMPAGNE;49 CAMELLO;50 ZANAHORIA;51 VERDE NOGAL;52 VERDE SECO;53 VERDE MILITAR;54 COCOA;55 AZUL IMPERIAL;56 AZUL CERULEO;57 AZUL CRISTAL;58 MORADO;60 VERDE ESMERALDA;61 AMARILLO;62 GRIS OSTION;63 CHARCOAL;64 GRIS PALIDO;65 VIOLETA;67 BUGAMBILIA;68 AMARILLO MANGO;72 VERDE JADE;73 NARANJA;74 VERDE NEON;75 AMARILLO NEON;76 ROSA NEON;77 NARANJA NEON;78 GRIS TOPO;79 LAVANDA;80 BARNEY;81 VERDE LIMON;82 PLATA JASPE;83 OXFORD JASPE;84 MARINO JASPE;85 CAFÉ JASPE;86 DURAZNO NEON;87 CORAL NEON;88 AZUL AGUA;90 ORO;91 PLATA;92 COBRE;93 ROSA BOREAL;95 IVORY JASPE;96 IVORY;97 NUDE;98 MORADO AMATISTA;99 AMARILLO PASTEL

what do you mean? is this a cart variant?

Title: Re: Custom Field Types (Explained)
Post by: fbc on July 18, 2013, 04:27:45 am
what do you mean? is this a cart variant?
Sorry for being so vague. Yeah, It's a cart variant, my only solution since all of my options will not fit into the DEFAULT field, is to some how find a way to put a text field where they can type the 2 digit code of the color they want.
Title: Re: Custom Field Types (Explained)
Post by: Maxim Pishnyak on July 18, 2013, 13:24:12 pm
Sorry for being so vague. Yeah, It's a cart variant, my only solution since all of my options will not fit into the DEFAULT field, is to some how find a way to put a text field where they can type the 2 digit code of the color they want.
Why not use something more attractive? Like "Product Colors (Component + Plugin)" from 3rd party forum section.
Or just simply "custom field images display" (check thread in Templating section).
Title: Re: Custom Field Types (Explained)
Post by: PRO on July 18, 2013, 19:58:41 pm
what do you mean? is this a cart variant?
Sorry for being so vague. Yeah, It's a cart variant, my only solution since all of my options will not fit into the DEFAULT field, is to some how find a way to put a text field where they can type the 2 digit code of the color they want.

or this
http://www.kaizenmediaworks.com/virtuemart-2-0-custom-field-dropbox-plugin

& also look here
http://forum.virtuemart.net/index.php?topic=90833.0


Title: Re: Custom Field Types (Explained)
Post by: preikarm on September 11, 2013, 13:30:28 pm
Hi,
where I have to put in this code?


Using a String for external images


Create a Custom field  type "string" named "external"
In Edit Product apply the field. Paste the url to the image in the field.
This below is the code for displaying the image.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[external] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
            <img src="<?php echo $field->display ?>" alt="<?php echo $this->product->product_name ?>"  />
<?php } ?>
          <?php } ?> <?php } ?>
        </div>
Title: Re: Custom Field Types (Explained)
Post by: Maxim Pishnyak on September 12, 2013, 19:56:03 pm
In default.php for productdetails template overrides probably.
Title: Re: Custom Field Types (Explained)
Post by: preikarm on September 13, 2013, 10:23:34 am
Hi, where I have to put in  the code'Using a String for external images' ?
Title: Re: Custom Field Types (Explained)
Post by: Maxim Pishnyak on September 13, 2013, 10:34:22 am
In default.php for productdetails template overrides probably.
Using template overrides in general is described in the sticked threads (Template forum section) and in the official documents (virtuemart.net).
Title: Re: Custom Field Types (Explained)
Post by: jhoompk on October 04, 2013, 13:05:17 pm
Hi,

Can anyone reply for this please?

http://forum.virtuemart.net/index.php?topic=118994.0

I m using Joomla 2.5.14 and VM 2.0.24 with PHP Version 5.3.26.

I want to choose product variant based on selected value of existing variant, for example:

I have variant of size with options: small, Medium and Large
I have another variant with color: Pink, Red, Orchid

Now what my requirement is when i select Size small then it only has Pink and Red items available and for Large size only One color item is available.

How can i make variants based on other variant's value?

your help will greatly be appreciated.
Title: Re: Custom Field Types (Explained)
Post by: boogiebobsrecords on October 05, 2013, 21:34:28 pm
There is no "select list" in my custom fields page in vm2 . It is blank or  has dissappeared....
screen shot availble, but I can't seem to get it into this message

I need simply to either edit the default names in Product Information or be able to add simple text fields to the top section of the page where SKU, Name, Price & others reside.
These fields also need to have the ability to be downloaded in a text file for uploading to other retail sites like eBay, MusicStack and others. These major retailers want information broken down like this for example, Name of product (Joe Smith ~ Self Titled) needs to be separated into Artist in one field & Title in a second field. There are others also, but If one can be done then I will know how to do the rest...
Please help,
thx
Bob Bergmann, Owner, Boogiebobs Records
Title: Re: Custom Field Types (Explained)
Post by: Garyk01 on January 01, 2014, 20:53:15 pm
Hi!
I have a problem - I'm showing on the product page using a custom field "Image" logos certain characteristics.
Code apply as follows:
Code: [Select]
     <?php  //  Logoimage custom_fields
    
if (!empty($this->product->customfieldsSorted['logoimage'])) {
   
?>

      <?php
    
$custom_title null;
    foreach ($this->product->customfieldsSorted['logoimage'] as $field) {
     if ( $field->is_hidden 
     continue;
if ($field->display) {
    ?>
<div class="product-field-type-M">
        <span class="product-field-display"><?php echo $field->display ?></span>
    </div>
    <?php
    }
    }
     } 
// Logoimage custom_fields END
   
?>
And here's the problem - how to make a conclusion of the attribute "Title" of the image when you hover the cursor over the image?
Title: Re: Custom Field Types (Explained)
Post by: PRO on January 02, 2014, 01:25:29 am
Hi!
I have a problem - I'm showing on the product page using a custom field "Image" logos certain characteristics.
Code apply as follows:
Code: [Select]
     <?php  //  Logoimage custom_fields
    
if (!empty($this->product->customfieldsSorted['logoimage'])) {
   
?>

      <?php
    
$custom_title null;
    foreach ($this->product->customfieldsSorted['logoimage'] as $field) {
     if ( $field->is_hidden 
     continue;
if ($field->display) {
    ?>
<div class="product-field-type-M">
        <span class="product-field-display"><?php echo $field->display ?></span>
    </div>
    <?php
    }
    }
     } 
// Logoimage custom_fields END
   
?>
And here's the problem - how to make a conclusion of the attribute "Title" of the image when you hover the cursor over the image?


what type of image is it? like a manufacturer image? etc?
Title: Re: Custom Field Types (Explained)
Post by: Garyk01 on January 02, 2014, 09:25:14 am

what type of image is it? like a manufacturer image? etc?
Image type -. png or. jpg - loaded into media files.
For example - the logo image Bluetooth, or Wi-Fi, or size diagonal notebook.
Media files in the folder there is a line - the attribute "ALT", where you can specify the detailed description of the image. How to do that would show a description when you hover the cursor over the image?
Title: Re: Custom Field Types (Explained)
Post by: Garyk01 on January 04, 2014, 14:57:42 pm
Solved this problem as follows: - open file customfields.php
1) After the 1190 line enter code:
Code: [Select]
function displayCustomMedia_M ($media_id, $table = 'product', $absUrl = FALSE) {

if (!class_exists ('TableMedias'))
require(JPATH_VM_ADMINISTRATOR . DS . 'tables' . DS . 'medias.php');
$db = JFactory::getDBO ();
$data = new TableMedias($db);

$data->load ((int)$media_id);

if (!class_exists ('VmMediaHandler'))
require(JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'mediahandler.php');
$media = VmMediaHandler::createMedia ($data, $table);

return $media->displayMediaThumb ('class="m-image"', true, 'onclick="return false"', TRUE, TRUE, $absUrl);

}
2 ) Line 1143 :
Code: [Select]
return $this->displayCustomMedia ($value);changed to code:
Code: [Select]
return $this->displayCustomMedia_M ($value);3 ) Line 1237 :
Code: [Select]
$value = self::displayCustomMedia ($productCustom->custom_value);changed to code:
Code: [Select]
$value = self::displayCustomMedia_M ($productCustom->custom_value);Get something like this - see image

PS This decision does not affect other types of fields , for example - related produсt .
Of course modify the code system is very bad, but other solutions not yet found . Of course , you can connect an additional script ( Tooltips ) , but with it all is not well displayed , and once the script - the additional load .
Developers can take note of this decision or make easier - I will be very grateful.

[attachment cleanup by admin]
Title: Re: Custom Field Types (Explained)
Post by: dmic on January 08, 2014, 18:52:28 pm
Hi,

We are using VM on a school site, where parents are paying fees for exams, art materials, etc.

We need to have a field where shoppers can add the name of the child (children) that the payment relates to. When I try to do this with a custom field it is not working correctly as it is looking for additional payment.

Is there a way to do this?

Thanks

Dave
Title: Re: Custom Field Types (Explained)
Post by: PRO on January 16, 2014, 02:02:33 am
Hi,

We are using VM on a school site, where parents are paying fees for exams, art materials, etc.

We need to have a field where shoppers can add the name of the child (children) that the payment relates to. When I try to do this with a custom field it is not working correctly as it is looking for additional payment.

Is there a way to do this?

Thanks

Dave

why not do "user fields" so it's when they checkout
?
Title: Re: Custom Field Types (Explained)
Post by: Garyk01 on February 18, 2014, 20:23:43 pm
yep now its showing the image CF in the Category with products... it's working with:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>
Please forgive me for my english
Help me - faced with such a situation:
In the category of multiple identical items displayed in different colors to each other - for example:
- "Product white" - "Product black"  -  "Product red" -
category for each product displayed a customfield "image"
code:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
    if( 
$field->layout_pos=='image'){
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php 
?>

But if in the admin panel to the "Product white " in Relatedprodutsts add "Product black ", "Product red", then in these products ("Product black", "Product red") does not appear in the category customfield "image".
What needs to be corrected?
The productdetails displays all ok ....

Help me please...
Title: Re: Custom Field Types (Explained)
Post by: sondh on May 05, 2014, 08:41:29 am
Hi,
I have a custom field on my site which allows to select cakes in KG. Now i have cakes eggless and with eggs... Is it possible to have a custom field where when some selects eggless he is charged per kg.. Every KG he selects if it is eggless the price differs... How can i achieve this?

Example:Normal 1Kg - 100, 2Kg - 200
But if he selects the option eggless. I want the price to increase as per kg e.g if 1Kg - +50, if 2Kg - +100

Possible?
Title: Re: Custom Field Types (Explained)
Post by: lindapowers on May 05, 2014, 13:15:37 pm
I =Integer
P =Parent
B= Bolean (True)

?????????????????????
Title: Re: Custom Field Types (Explained)
Post by: leealex on May 16, 2014, 11:49:05 am
yep now its showing the image CF in the Category with products... it's working with:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>
Please forgive me for my english
Help me - faced with such a situation:
In the category of multiple identical items displayed in different colors to each other - for example:
- "Product white" - "Product black"  -  "Product red" -
category for each product displayed a customfield "image"
code:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
    if( 
$field->layout_pos=='image'){
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php 
?>

But if in the admin panel to the "Product white " in Relatedprodutsts add "Product black ", "Product red", then in these products ("Product black", "Product red") does not appear in the category customfield "image".
What needs to be corrected?
The productdetails displays all ok ....

Help me please...

I have the same problem, can anyone help us?  :'(



[attachment cleanup by admin]
Title: Re: Custom Field Types (Explained)
Post by: komir on September 27, 2014, 13:24:32 pm
yep now its showing the image CF in the Category with products... it's working with:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>
Please forgive me for my english
Help me - faced with such a situation:
In the category of multiple identical items displayed in different colors to each other - for example:
- "
Product white (https://www.domidona-it.hr/web-hosting-cjenik-domidona-it)" - "Product black"  -  "Product red" -
category for each product displayed a customfield "image"
code:
Code: [Select]
<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
    if( 
$field->layout_pos=='image'){
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php 
?>

But if in the admin panel (http://admin panel) to the "Product white " in Relatedprodutsts add "Product black ", "Product red", then in these products ("Product black", "Product red") does not appear in the category customfield "image".
What needs to be corrected?
The productdetails displays all ok ....

Help me please...

I have the same problem, can anyone help us?  :'(
No one ? :(
Title: Re: Custom Field Types (Explained)
Post by: patben on December 23, 2014, 20:51:37 pm
Code: [Select]
<?php  foreach ($product->customfields as $catproduct)?>
<?php echo $catproduct->field_type?>

I use some code like this in category page but it shows only one fieldtype per product and not all is any other code i can use. I care about the E field type but in some products that have i it display S and in other E, products have both E and S field type. I dont want to display the field type i want to use it for an If condition. And it work only in product that display the E field type.

Thank you
Title: Re: Custom Field Types (Explained)
Post by: vieke on April 17, 2015, 17:05:55 pm
Using a String for external images


Create a Custom field  type "string" named "external"
In Edit Product apply the field. Paste the url to the image in the field.
This below is the code for displaying the image.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[external] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
            <img src="<?php echo $field->display ?>" alt="<?php echo $this->product->product_name ?>"  />
<?php } ?>
          <?php } ?> <?php } ?>
        </div>


Using a String to Link to related articles, installation instructions etc.


Create a Custom field  type "string" with the name "Installation Instructions" or whatever you want the anchor text to be.
Assign it to the position "link"
In Edit Product apply the field. Paste the url
This below is the code for displaying the link.

<div class="product-fields">
       <?php
       $custom_title = null;
       foreach ($this->product->customfieldsSorted[link] as $field) {
      if ($field->display) {
          ?>
          <?php if ($field->custom_title != $custom_title) { ?>
             <a href="<?php echo $field->display ?>" ><?php echo JText::_($field->custom_title); ?></a>
<?php } ?>
          <?php } ?> <?php } ?>
        </div>

i tried this, but for me, the custom field renders with a label and inside an input field, does anybody have any idea why this is an how i can fix this ?

This is my php

Code: [Select]
<?php echo "<a href='" $field->display "'>" vmText::($field->custom_title) . "</a>" ?>

but in the frontend it renders like this:

Code: [Select]
<span class="product-field-display"><input id="1960" checked="checked" type="radio" value="196" name="customPrice[0][28]"><label for="1960" class="other-customfield">http://google.com </label></span>
Title: Re: Custom Field Types (Explained)
Post by: be on March 13, 2017, 18:37:12 pm
Hi,

I used the layout position to show my customfield where I need it.
But now I have a field from the field-type "Allgemeine Variable für Produktvarianten" (i don't know how this is called in english) and use this as a list width different standardvalues.
I added a screenshot with all customfield values.

My problem now is if i want to output the customfield in that way:
Code: [Select]
$custom_title = null;
    foreach ($this->product->customfieldsSorted[Ausgabe] as $field) { ?>
            <?php if ($field->display) {
                if (
$field->custom_title != $custom_title) { ?>

                    <span class="product-fields-title" ><?php echo JText::_($field->custom_title); ?></span>
                <?php ?>
                <span class="product-field-display"><?php echo JText::_($field->display); ?></span>
            <?php ?>
    <?php }

The field will not be shown. What have I to change to get this work?

Cheers
Title: Re: Custom Field Types (Explained)
Post by: PRO on March 14, 2017, 09:40:28 am
Hi,

I used the layout position to show my customfield where I need it.
But now I have a field from the field-type "Allgemeine Variable für Produktvarianten" (i don't know how this is called in english) and use this as a list width different standardvalues.
I added a screenshot with all customfield values.

My problem now is if i want to output the customfield in that way:
Code: [Select]
$custom_title = null;
    foreach ($this->product->customfieldsSorted[Ausgabe] as $field) { ?>
            <?php if ($field->display) {
                if (
$field->custom_title != $custom_title) { ?>

                    <span class="product-fields-title" ><?php echo JText::_($field->custom_title); ?></span>
                <?php ?>
                <span class="product-field-display"><?php echo JText::_($field->display); ?></span>
            <?php ?>
    <?php }

The field will not be shown. What have I to change to get this work?

Cheers


what vm version,  and where are you trying to have it display?
Title: Re: Custom Field Types (Explained)
Post by: adamdevine78 on April 27, 2019, 08:43:50 am
is there any way how to make plugin "custom text input" obligatory (required)?