VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: neutrino86 on February 02, 2012, 21:18:43 PM

Title: Custom field layout position VM 2.0.1
Post by: neutrino86 on February 02, 2012, 21:18:43 PM
I a French user of Virtuemart and i try to make a new website with VM2 so, i have i little problem with custom fileds.
Sorry for my approximate english.

I use VM2.0.1b and i would like to add custom fields in product page.
When i attach a filed with a product i don't see it in product page, i think i need to precise a position in "layout position" field but I don't know what i can take in this field.


Thanks in advance for your help
Title: Re: Custom field layout position VM 2.0.1
Post by: Milbo on February 02, 2012, 21:24:47 PM
You can even define different position and set where they should be.
Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on February 03, 2012, 03:22:38 AM
neutrino86, when you choose "cart variant" the default position will be in the add to cart form.

THEN,
the ONLY other default positions in the product layout is

"ontop"
THIS CODE IS IN views/productdetails/tmpl/default.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 ?>


YOU can actually set your own positions anywhere. By copying this code, and renaming the "position"
YOU JUST change the 'ontop'


<?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 ?>
Title: Re: Custom field layout position VM 2.0.1
Post by: neutrino86 on February 04, 2012, 22:30:10 PM
Thanks for your help, that will be very useful later to customise my product page.

The problem is that the the custom fields don't appear at all when i use "VM - Custom, customer text input" plugin.

With "VM - Custom, product specification" plugin the fields appear properly.

I will try with 2.0.1c version to see if this problem is fixed.
Title: Re: Custom field layout position VM 2.0.1
Post by: bluesheep on February 09, 2012, 10:36:13 AM
Hello Forum

I need to know how i can display the customfieldsCart as a <li> and not as a <option>.

I know, that this will break the function of the shop. But, we use the shop only as a catalog and want to show all variants.

I hope, someone can help me.

Beste Grüsse
bluesheep
Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on February 09, 2012, 14:21:06 PM
Quote from: bluesheep on February 09, 2012, 10:36:13 AM
Hello Forum

I need to know how i can display the customfieldsCart as a <li> and not as a <option>.

I know, that this will break the function of the shop. But, we use the shop only as a catalog and want to show all variants.

I hope, someone can help me.

Beste Grüsse
bluesheep


You should use the "product specification" plugin.

Thats is for display

Hard Drive: LARGE
Color: Red


Title: Re: Custom field layout position VM 2.0.6
Post by: Merry on April 24, 2012, 19:44:53 PM
Custom Field New or Edit - Layout position text box choices - Stabbing around and a Google search is yielding no results.

What words can go into this box to affect the layout of the Custom Field? It seems a drop-down box with limited choices would help a ton, or a tooltip, but in lieu of that I'd love to add the list of choices to the VM2 documentation.

TIA,
Merry


Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on April 24, 2012, 21:19:02 PM
Quote from: Merry on April 24, 2012, 19:44:53 PM
Custom Field New or Edit - Layout position text box choices - Stabbing around and a Google search is yielding no results.

What words can go into this box to affect the layout of the Custom Field? It seems a drop-down box with limited choices would help a ton, or a tooltip, but in lieu of that I'd love to add the list of choices to the VM2 documentation.

TIA,
Merry




THIS NOT for cart attributes, ONLY other custom fields

Here are the ones in the current default template
ontop
normal
onbot


OR, you can do your own location

<?php if (!empty($this->product->customfieldsSorted['my-position'])) {
       $this->position='my-position';
       echo $this->loadTemplate('customfields');
    }
    ?>
Title: Re: Custom field layout position VM 2.0.1
Post by: Merry on April 25, 2012, 00:00:15 AM
Thank you, thank you! Solved a great mystery - I had seen a lead about ontop but couldn't find anything else on it.

Merry
Title: Re: Custom field layout position VM 2.0.1
Post by: devkbsc on July 10, 2012, 23:09:05 PM
Hello Sir Madame,

Me too, I have the same problem, I am newbee to php. I don't know how to positioning the custom fields. Since one month i am trying to display differnet types of custom fields in the different position in the product page. if you have seen my post, please give a solution.

Description:

1)Some custom fields are already created : type(text editor)

those are displying in the default position.

2) I have created some more custom fields : type(image)

Now i would like to display the image custom fields on the top of the page. is it any possibilities to do that?
Title: Re: Custom field layout position VM 2.0.1
Post by: kyteasdale on July 24, 2012, 15:48:59 PM
Hi all,

I'm using VM as a catalogue and not displaying prices, so "Cart Attributes" aren't displayed; yet I'd like the custom fields besides the "Ask a question about this product" button.

Is there a preset layout position for this?

Thanks
Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on July 24, 2012, 17:20:46 PM
Quote from: kyteasdale on July 24, 2012, 15:48:59 PM
Hi all,

I'm using VM as a catalogue and not displaying prices, so "Cart Attributes" aren't displayed; yet I'd like the custom fields besides the "Ask a question about this product" button.

Is there a preset layout position for this?

Thanks

what fields do you want to show?

Title: Re: Custom field layout position VM 2.0.1
Post by: kyteasdale on August 06, 2012, 14:29:03 PM
Pretty much just the Ask a question field.  Beneath that I'd like the series of custom fields - then the description.

Sorry if that wasn't what you were asking.
Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on August 06, 2012, 16:34:56 PM
Quote from: kyteasdale on August 06, 2012, 14:29:03 PM
Pretty much just the Ask a question field.  Beneath that I'd like the series of custom fields - then the description.

Sorry if that wasn't what you were asking.

which fields? the atributes?
the only way to do this is to change it to NOT catalogue,

then remove the add to cart code & price code from the template
Title: Re: Custom field layout position VM 2.0.1
Post by: jason45 on September 07, 2012, 09:52:58 AM
While attaching the file along with the product it is not possible to view it on the product page. I believe there is some kind of positioning failure
Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on September 07, 2012, 16:08:53 PM
Quote from: jason45 on September 07, 2012, 09:52:58 AM
While attaching the file along with the product it is not possible to view it on the product page. I believe there is some kind of positioning failure


what?
Title: Re: Custom field layout position VM 2.0.1
Post by: zorro lee on September 29, 2012, 22:54:46 PM
How to add custom fields in category view?
Title: Re: Custom field layout position VM 2.0.1
Post by: 1cube1wheel on October 10, 2012, 01:36:26 AM
@PRO,

Based on the code in /views/productdetails/tmpl/defualt, it seems like setting the layout position to 'ontop' places the custom fields under the 'Short Description' section, while setting the position to 'normal' places them under the 'Product Description' section.  I have adjusted the layout position using both 'ontop' and 'normal', but the position of my fields is not changing at all.  I also tried inserting the code you posted like this:

   <?php
   // Product Description
   if (!empty($this->product->product_desc)) {
       ?>
        <div class="product-description">
   <?php /** @todo Test if content plugins modify the product description */ ?>
       <span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE') ?></span>
   <?php echo $this->product->product_desc; ?>
        </div>
   <?php
    } // Product Description END

    if (!empty($this->product->customfieldsSorted['normal'])) {
   $this->position = 'normal';
   echo $this->loadTemplate('customfields');
    } // Product custom_fields END
    // Product Packaging
    $product_packaging = '';
    if ($this->product->product_box) {
   ?>
        <div class="product-box">
       <?php
           echo JText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box;
       ?>
        </div>
       <?php if (!empty($this->product->customfieldsSorted['my-position'])) {
       $this->position='my-position';
       echo $this->loadTemplate('customfields');
       }
       ?>
    <?php } // Product Packaging END
    ?>

However, I do not know if this is correct placement as I am unfamiliar with PHP.  Any assistance you can provide is appreciated.  I am running version 2.0.12.
Title: Re: Custom field layout position VM 2.0.1
Post by: Flasher on February 01, 2013, 02:30:24 AM
Quote from: PRO on April 24, 2012, 21:19:02 PM
Quote from: Merry on April 24, 2012, 19:44:53 PM
Custom Field New or Edit - Layout position text box choices - Stabbing around and a Google search is yielding no results.

What words can go into this box to affect the layout of the Custom Field? It seems a drop-down box with limited choices would help a ton, or a tooltip, but in lieu of that I'd love to add the list of choices to the VM2 documentation.

TIA,
Merry




THIS NOT for cart attributes, ONLY other custom fields

Here are the ones in the current default template
ontop
normal
onbot


OR, you can do your own location

<?php if (!empty($this->product->customfieldsSorted['my-position'])) {
       $this->position='my-position';
       echo $this->loadTemplate('customfields');
    }
    ?>


Hi All. I try to use this code after the price is displayed but nothing happens... i don't get the custom fields displayed. :(
Title: Re: Custom field layout position VM 2.0.1
Post by: Milbo on June 12, 2013, 13:06:33 PM
The custom needs of course also your position.
Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on June 12, 2013, 18:22:23 PM
Quote from: Flasher on February 01, 2013, 02:30:24 AM


<?php if (!empty($this->product->customfieldsSorted['my-position'])) {
       $this->position='my-position';
       echo $this->loadTemplate('customfields');
    }
    ?>


Hi All. I try to use this code after the price is displayed but nothing happens... i don't get the custom fields displayed. :(

my-position

needs to be changed to YOUR position
Title: Re: Custom field layout position VM 2.0.1
Post by: pnaugh on June 14, 2013, 02:01:25 AM
Sorry for such an easy question, however I just am not quite getting how to do this. What I see with my custom fields are that they are too close together one on top of the other. I may have missed this but is there a way to space then apart in the vertical directions a few px? I have 3-6 custom fields for each product and it looks cluttered.

Thanks in advance for any responsed

Peter
Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on June 14, 2013, 10:51:41 AM
Quote from: pnaugh on June 14, 2013, 02:01:25 AM
Sorry for such an easy question, however I just am not quite getting how to do this. What I see with my custom fields are that they are too close together one on top of the other. I may have missed this but is there a way to space then apart in the vertical directions a few px? I have 3-6 custom fields for each product and it looks cluttered.

Thanks in advance for any responsed

Peter

which fields?
http://forum.virtuemart.net/index.php?topic=102850.0


Title: Re: Custom field layout position VM 2.0.1
Post by: pnaugh on June 14, 2013, 15:49:10 PM
Pro Thank You

Title: Re: Custom field layout position VM 2.0.1
Post by: Christopher on June 21, 2013, 11:21:42 AM
Hello

I'm trying to alter the CSS in vmsite-ltr.css around line 202 - 209, to format the custom fields into columns by setting the widths of:

product-fields-title
product-field-display
product-field-desc

... But none of my changes appear to make any difference.... Have I missed something? I have multiple custom fields displayed for each product, each with a title, listbox and description - all I want to do is set the width of each of these to either 33% or 220px so they appear one beneath the other in neat columns - Please see the screenshot attached

Please can someone point me in the right direction?

Thanks in advance

[attachment cleanup by admin]
Title: Re: Custom field layout position VM 2.0.1
Post by: PRO on June 21, 2013, 19:14:32 PM
Quote from: Christopher on June 21, 2013, 11:21:42 AM
Hello

I'm trying to alter the CSS in vmsite-ltr.css around line 202 - 209, to format the custom fields into columns by setting the widths of:

product-fields-title
product-field-display
product-field-desc

... But none of my changes appear to make any difference.... Have I missed something? I have multiple custom fields displayed for each product, each with a title, listbox and description - all I want to do is set the width of each of these to either 33% or 220px so they appear one beneath the other in neat columns - Please see the screenshot attached

Please can someone point me in the right direction?

Thanks in advance

you are in the wrong thread for cart variant custom fields.

BUT!

why not edit the

default_addtocart.php

???


and just add your own class?

http://forum.virtuemart.net/index.php?topic=90935.0
Title: Re: Custom field layout position VM 2.0.1
Post by: t68 on October 29, 2013, 11:34:29 AM
Quote from: PRO on April 24, 2012, 21:19:02 PM

OR, you can do your own location

<?php if (!empty($this->product->customfieldsSorted['my-position'])) {
       $this->position='my-position';
       echo $this->loadTemplate('customfields');
    }
    ?>

This worked like a charm for me! I added two new positions in my default_addtocart.php override so now I can ad more custom fields to the right of the image before and after the default positions for custom fields. I named these "custom1" and "custom2" and put the coding above right after (for custom1) the start div: <div class="product-fields"> and right before its closing (for custom2) </div>. Great for adding more info about how my price-per-letter input works and so on.
Title: Re: Custom field layout position VM 2.0.1
Post by: kennethrules on September 10, 2014, 16:54:09 PM
PRO thanks for big help.. I have project right now and I need this ^_^..
Title: Re: Custom field layout position VM 2.0.1
Post by: BrickLee47 on September 25, 2014, 16:10:49 PM
   <?php
   // Product Description
   if (!empty($this->product->product_desc)) {
       ?>
        <div class="product-description">
   <?php /** @todo Test if content plugins modify the product description */ ?>
       <span class="title"><?php echo JText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE') ?></span>
   <?php echo $this->product->product_desc; ?>
        </div>
   <?php
    } // Product Description END

    if (!empty($this->product->customfieldsSorted['normal'])) {
   $this->position = 'normal';
   echo $this->loadTemplate('customfields');
    } // Product custom_fields END
    // Product Packaging
    $product_packaging = '';
    if ($this->product->product_box) {
   ?>
        <div class="product-box">
       <?php
           echo JText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box;
       ?>
        </div>
       <?php if (!empty($this->product->customfieldsSorted['my-position'])) {
       $this->position='my-position';
       echo $this->loadTemplate('customfields');
       }
       ?>
    <?php } // Product Packaging END
    ?>

Using this code snippet in PHP was a bad experience for me
Title: Re: Custom field layout position VM 2.0.1
Post by: kelecz on January 17, 2015, 20:46:37 PM
Need assist. My problem is on the pisture. I can not add fields,no problem with "creating" custom field, Cart Variant.
Is that Jquery problem? I already have some mess with popups but now is fine.


THX in advance.

Joomla 2.5.28
VM 2.6.14
Live www.petproba.konji.rs

[attachment cleanup by admin]
Title: Re: Custom field layout position VM 2.0.1
Post by: GJC Web Design on January 17, 2015, 22:58:45 PM
You should really start your own topic for this - hardly relates in any way to this topic
Can't see anything wrong with your custom field setup..

Maybe try non crylic letters in title etc?
Title: Re: Custom field layout position VM 2.0.1
Post by: kelecz on January 18, 2015, 09:16:42 AM
You do not understand. When Custom fields is created and when I am in product settings I can not any of size or color in from Custom field. (first picture)
How is that not related?

THX
Title: Re: Custom field layout position VM 2.0.1
Post by: GJC Web Design on January 18, 2015, 12:57:23 PM
because this is a sticky topic about positioning the display of custom fields on the FE in an extremely early release of VM2 dating back 2 years - nothing to do with their configuration or access from admin in the last stable release of VM2.6
This forum is supposed to be a resource for all VM users - not just a place for your question to be answered

Therefore it makes sense to start your own topic instead of burying it at the end of a long unrelated topic.. where if some else has a similar problem the chance of them finding the subject is null

did u try non crylic letters?
Title: Re: Custom field layout position VM 2.0.1
Post by: kelecz on January 19, 2015, 00:46:24 AM
Quote from: GJC Web Design on January 18, 2015, 12:57:23 PM
because this is a sticky topic about positioning the display of custom fields on the FE in an extremely early release of VM2 dating back 2 years - nothing to do with their configuration or access from admin in the last stable release of VM2.6
This forum is supposed to be a resource for all VM users - not just a place for your question to be answered

Therefore it makes sense to start your own topic instead of burying it at the end of a long unrelated topic.. where if some else has a similar problem the chance of them finding the subject is null

did u try non crylic letters?

Thank you. I have to admit that have small experience on all kind of forums. I understand and I am sorry.

I will take care in the future. Sorry again. 
Title: Re: Custom field layout position VM 2.0.1
Post by: fotonio on July 12, 2015, 13:21:00 PM
Hi, i see the topic is for VM 2.0.1 but i am using VM 3.0.9.4 with the default template and joomla 3.4.1. Is there any related topic for VM 3.* ?

My problem is i am trying to create a new position for a custom field using this code in the file:
\my joomla root folder\components\com_virtuemart\views\productdetails\tmpl\default.php

After default code:
// Product Packaging
    $product_packaging = '';
    if ($this->product->product_box) {
   ?>
        <div class="product-box">
       <?php
           echo vmText::_('COM_VIRTUEMART_PRODUCT_UNITS_IN_BOX') .$this->product->product_box;
       ?>
i added:
<?php if (!empty($this->product->customfieldsSorted['myposition'])) {
       $this->position='myposition';
       echo $this->loadTemplate('customfields');
       }
       ?>

And of course i use myposition as layout position in the custom field admin configuration.
But the field does not appear at all at the product's page.

Any help would be appreciated.

Title: Re: Custom field layout position VM 2.0.1
Post by: Studio 42 on July 12, 2015, 14:41:17 PM
hi fotonio,
do a
var_dump($this->product->customfieldsSorted);
to check if you have some "myposition' customfield set.
you check product_box in your code
  if ($this->product->product_box) {
perhaps that simply product is empty ?

Greets,
Patrick
Title: Re: Custom field layout position VM 2.0.1
Post by: fotonio on July 14, 2015, 07:17:17 AM
The solution for VM3 is to put this snippet in the file \my joomla root folder\components\com_virtuemart\views\productdetails\tmpl\default.php wherever you want the custom field to appear.

<?php
echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'myposition'));
?>
Title: Re: Custom field layout position VM 2.0.1
Post by: jade Quinton on November 06, 2015, 21:58:37 PM
Hello, please could someone point me in the right direction, I have been struggling with the "related products" that appear on the bottom of the page when you view a product in Virtue mart. They always appeared correctly but afew days ago I noticed they had  become very large, displaying vertically down the page. The images are completely stretched. I have removed the template completely and re-copied the original but that didn't even seem to work. I'm not sure where the issue is lying? I'm stumped!
Joomla! 2.5.8, not sure the version of virtuemart.
Here's what it looks like: http://purejewellery.co.za/index.php/engagement-rings/er450-detail
If someone could guide me to remove related products completly from default_relatedproducts.php that would be amazing.
Any advice would be appreciated. Thanks a mil. Jade

Title: Re: Custom field layout position VM 2.0.1
Post by: GJC Web Design on November 06, 2015, 23:35:17 PM
STOP cross posting esp. in a totally unrelated POST!
Title: Re: Custom field layout position VM 2.0.1
Post by: design609 on October 03, 2018, 14:25:37 PM
Quote from: fotonio on July 14, 2015, 07:17:17 AM
The solution for VM3 is to put this snippet in the file \my joomla root folder\components\com_virtuemart\views\productdetails\tmpl\default.php wherever you want the custom field to appear.

<?php
echo shopFunctionsF::renderVmSubLayout('customfields',array('product'=>$this->product,'position'=>'myposition'));
?>

Thanks - worked ! custom field placement on product detail page for Virtuemart 3
Title: Re: Custom field layout position VM 2.0.1
Post by: Елeна on March 14, 2019, 18:45:51 PM
Hello
Works great!
QuoteРешение SPAMля VM3 состоит в том, чтобы поместить этот фрагмент в файл \ моя корневая папка joomla \ components \ com_virtuemart \ views \ productdetails \ tmpl \ default.php везSPAMе, гSPAMе вы хотите, чтобы появилось настраиваемое поле.

<? php
echo shopFunctionsF :: renderVmSubLayout ('customfields', array ('product' => $ this-> product, 'position' => 'myposition'));
?>
VirtueMart 3.4.2 / Joomla! 3.8.12 / protostar/ site (http://uchilka.01sh.ru/magazin-uk/sport-kostyum-uk)

This, but only for the category page !?
,,,/templates/protostar/html/com_virtuemart/sublayouts/products.php
--
In the category all products are the same, and one is special. It is necessary to highlight it by labeling the picture
Thanks


// Show Products ?>

<div class="product vm-col<?php echo ' vm-col-' $products_per_row $show_vertical_separator ?>">
<div class="spacer product-container">
<div class="vm-product-media-container">
<a title="<?php echo $product->product_name ?>" href="<?php echo $product->link.$ItemidStr?>">
<?php
echo $product->images[0]->displayMediaThumb('class="browseProductImage"'false);
?>

</a>
???
???
???

</div>