VirtueMart 2 + 3 > Product creation

Custom Field Types (Explained)

(1/24) > >>

PRO:
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
} ?>

PRO:
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]

PRO:
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]

PRO:
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>

kg:
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

Navigation

[0] Message Index

[#] Next page

Go to full version