VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product creation => Topic started by: d0ublezer0 on October 03, 2017, 09:40:55 AM

Title: CustomField [P]roperty - can you explain me, please?
Post by: d0ublezer0 on October 03, 2017, 09:40:55 AM
I want to display the characteristics of the product, such as width, height, length on the product page.
In this case, I would not want to specify them in the custom fields, because they are already specified in the properties of the product.
How do I display them?
I found something similar in the file \sublayouts\customfield.php but did not understand how to use it.
// Property
                case 'P':
                    //$customfield->display = vmText::_ ('COM_VIRTUEMART_'.strtoupper($customfield->customfield_value));
                    $attr = $customfield->customfield_value;
                    $lkey = 'COM_VIRTUEMART_' . strtoupper($customfield->customfield_value) . '_FE';
                    $trValue = vmText::_($lkey);
                    $options[] = array('value' => 'product_length', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_LENGTH'));
                    $options[] = array('value' => 'product_width', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_WIDTH'));
                    $options[] = array('value' => 'product_height', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_HEIGHT'));
                    $options[] = array('value' => 'product_weight', 'text' => vmText::_('COM_VIRTUEMART_PRODUCT_WEIGHT'));


It is possible?
Title: Re: CustomField [P]roperty - can you explain me, please?
Post by: Studio 42 on October 03, 2017, 11:11:33 AM
You can add and display any value from product in your template, simply use same code as for other fields eg.
echo $product->product_length;
Of course you have to format this.