VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: IceMan-101 on February 29, 2012, 14:31:26 PM

Title: Custom Fields - No Cart Attribute
Post by: IceMan-101 on February 29, 2012, 14:31:26 PM
Hi All,

I am running the latest version of Virtuemart 2.0.2. I am stuck and can not get my Custom fields with no Cart Attribute to display in my product details page. My Custom Field with Cart Attribute display with no problems.

I would like to know am i doing something wrong?

Here is the code of my custom template I am using:


<?php // Product custom_fields
if (!empty($this->product->customfieldsCart)) {  ?>

<div class="product-fields">
<?php foreach ($this->product->customfieldsCart as $field)
?>

<div class="product-field-type-<?php echo $field->field_type ?>">
<label class="product-fields-title" ><?php echo  JText::_($field->custom_title?></label>
<?php echo $field->display ?>
</div>
<?php
}
?>

</div>
<?php }
/* Product custom Childs
* to display a simple link use $field->virtuemart_product_id as link to child product_id
* custom_value is relation value to child
*/

if (!empty($this->product->customsChilds)) {  ?>

<div class="product-fields">
<?php foreach ($this->product->customsChilds as $field) {  ?>
<div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title?></b></span>
<span class="product-field-desc"><?php echo JText::_($field->field->custom_value?></span>
<span class="product-field-display"><?php echo $field->display ?></span>
</div>
<br />
<?php
?>

</div>
<?php ?>



Here is an image of the setting in the custom fields manager:
(http://www.myitmanager.co.za/customfield.png)

Any help or guidance would be appreciated.

Regards,
IceMan
Title: Re: Custom Fields - No Cart Attribute
Post by: teecookie on March 02, 2012, 20:23:15 PM
I have found that if you unpublish first the custom field, then add to custom attribute in product, add your attribute EX. small med and large then publish it it will appear in a list
Title: Re: Custom Fields - No Cart Attribute
Post by: PRO on March 02, 2012, 21:35:22 PM
also, look here
http://forum.virtuemart.net/index.php?topic=97419.0
Title: Re: Custom Fields - No Cart Attribute
Post by: IceMan-101 on March 06, 2012, 08:22:06 AM
Hi Guys,

Thanks for the feedback.

Quote from: teecookie on March 02, 2012, 20:23:15 PM
I have found that if you unpublish first the custom field, then add to custom attribute in product, add your attribute EX. small med and large then publish it it will appear in a list

I tried it and it is not working.

BanquetTables.pro, do you think if I create a custom layout position that it would resolve my problem?
Title: Re: Custom Fields - No Cart Attribute
Post by: PRO on March 06, 2012, 11:52:06 AM
put

ontop    in the position and it will show up
Title: Re: Custom Fields - No Cart Attribute
Post by: IceMan-101 on March 06, 2012, 13:09:26 PM
Hi BanquetTables.pro,

Thanks it worked and now it is showing up correctly.

For those that want to know what I did, her is the code:
if (!empty($this->product->customsChilds)) {  ?>
<div class="product-fields">
<?php foreach ($this->product->customsChilds as $field) {  ?>
<div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field->field_type ?>">
<span class="product-fields-title" ><b><?php echo JText::_($field->field->custom_title?></b></span>
<span class="product-field-desc"><?php echo JText::_($field->field->custom_value?></span>
<span class="product-field-display"><?php echo $field->display ?></span>
</div>
<br />
<?php
?>

</div>
<?php // Product Custom ontop begin?>
<?php if (!empty($this->product->customfieldsSorted['ontop'])) { ?>
   <div class="product-fields">
   <?php
   $custom_title 
null ;
   foreach (
$this->product->customfieldsSorted['ontop'] as $field){
  if ($field->display) {
 ?>
<div class="product-field product-field-type-<?php echo $field->field_type ?>">
<?php if ($field->custom_title != $custom_title) { ?>
<span class="product-fields-title" ><?php echo JText::_($field->custom_title); ?></span>
<?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>
<?php
 $custom_title $field->custom_title;
  }
   } 
?>

   </div>
<?php // Product Custom ontop end ?>


Hope it helps, if you have any questions, please ask and I'll try to help where I can.

Regards,
IceMan
Title: Re: Custom Fields - No Cart Attribute
Post by: PRO on March 06, 2012, 14:19:03 PM
iceman, there is a separate template for custom fields now.

So you can just echo the template
Title: Re: Custom Fields - No Cart Attribute
Post by: IceMan-101 on March 08, 2012, 15:12:29 PM
Quote from: BanquetTables.pro on March 06, 2012, 14:19:03 PM
iceman, there is a separate template for custom fields now.

So you can just echo the template

BanquetTables.pro, where can I get this template or is part of Virtuemart 2.0.2?

I am making use of the GavickPro eSport template and it has a custom Virtuemart template. Could this be influencing the separate template for custom fields?
Title: Re: Custom Fields - No Cart Attribute
Post by: PRO on March 08, 2012, 16:44:56 PM
Quote from: IceMan-101 on March 08, 2012, 15:12:29 PM

BanquetTables.pro, where can I get this template or is part of Virtuemart 2.0.2?

I am making use of the GavickPro eSport template and it has a custom Virtuemart template. Could this be influencing the separate template for custom fields?

Yes its in vmart core.

productdetails/tmpl/HERE

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