VirtueMart 2 + 3 > Product creation

Custom Field Types (Explained)

<< < (3/24) > >>

gldproducts:

--- Quote from: BanquetTables.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>

--- End quote ---

Pardon me, but what page do you add the code to?

lipes:
one question. In the Category i got this php code inserted in
<div class="product floatleft ... >

--- Code: ---<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 }  ?>
--- End code ---

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

PRO:


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


}

lipes:
yep now its showing the image CF in the Category with products... it's working with:

--- Code: ---<?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 }  ?>
--- End code ---

jbmd:
Please, is there any way how to make plugin "custom text input" obligatory (required)?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version