News:

Looking for documentation? Take a look on our wiki

Main Menu

Custom Field Types (Explained)

Started by PRO, March 07, 2012, 18:04:25 PM

Previous topic - Next topic

cspub

I'm having a hard time trying to do something basic and not sure if the custom fields and cart variant is the way to go. Please advise.
We have products, say shirts. Most of the shirts can add monogramming. THere are 3 types of monogram and each has a different cost. We want to add drop down that says Monogram. From there they select the monogram type they want and it add the cost to the product.

Then they need to pick monogram font and color and enter text for monogram. Do i do this with custom fields? If so how do i group so that it is a drop down?

cspub

i have cart variant and add price to product. when you go to cart then it shows the added price as a discount and subtract.

PRO

Quote from: cspub on June 13, 2012, 07:17:15 AM
i have cart variant and add price to product. when you go to cart then it shows the added price as a discount and subtract.


wrong thread, this thread is NOT about cart variants
http://forum.virtuemart.net/index.php?topic=90833.0

Mole_LR

Hello!

What I have to do if I want to display product CustomFields into pdf? I'm trying to modify standard Joomla pdf plugin to print normally all information about the product - name, description, prices, images and CustomFields! All, except CustomFields, prints to pdf normally, but I can't make that CustomFields shows into pdf..

Thank You!

Parsimonious

Quote from: BanquetTables.pro on March 08, 2012, 19:13:18 PM


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>

I'm not understanding what I need to do. I created a custom custom field type: string, gave it a title, added it to a product, pasted the url in the empty box under value (i verified my url is valid). Now I don't know what to do to make it show in the front end. Do I have to put the code somewhere? If so where?


RevoLion

Hi BanquetTables.pro,

Is there any documentation any where on how to add a date picker as a cart attribute in VM 2.0. I saw that "date" is a selection as a custom field and I need it to be a custom field. I tried adding it, but all it did was display todays date instead of allowing a customer to pick the date they want their greeting card delivered by.

Thanks for any help,
Jeremy

PRO


RevoLion

What would be the best way to go about this?

amorino

Hello,
thank you very much for this tutorial

Could you please tell me how to do to put a custom field to upload pdfs and than show automaticly an icon on the product page that we can clic to download the pdf?

Best regards
Amorino
Création sites web Tunisie
http://www.idealconception.com

PolishedGeek

@Amorino -

There's not a file upload Custom Field per se. However, you can do this by using Custom Field Type = editor, and using that to paste in a URL to the PDF, or a linked icon. You'll have to upload your PDFs first of course. Then you can place the PDF links into the product area the way I describe.
~ Deb Cinkus, CEO
Polished Geek, LLC   |    www.PolishedGeek.com

Creators of JoomLister - eBay Lister for Joomla!

amorino

Hello PolishedGeek,
thank you for your answer
in the Virtuemart 1. it was so simple by adding the file in the media

There is no way to do it again with Virtuemart 2?

Best regards
Amorino
Création sites web Tunisie
http://www.idealconception.com

PolishedGeek

VM2 is a very different world than 1.1...... in many ways a better world, in other ways, not so much. Perhaps BanquetTables Pro knows another method and can suggest alternatives. He knows the custom fields functionality better than almost anyone on the forums.

Of course, you can always do the exact same thing with an icon and link in the product description field too, once the file has been uploaded to your media directory. But placing it into the product description won't give you the consistency in layout and presentation as putting it in its own specific field, and then controlling where that shows up on the page.
~ Deb Cinkus, CEO
Polished Geek, LLC   |    www.PolishedGeek.com

Creators of JoomLister - eBay Lister for Joomla!

PRO

Quote from: amorino on August 08, 2012, 18:56:26 PM
Hello PolishedGeek,
thank you for your answer
in the Virtuemart 1. it was so simple by adding the file in the media

There is no way to do it again with Virtuemart 2?

Best regards
Amorino


Using a String to Link to related articles, installation instructions etc.
http://forum.virtuemart.net/index.php?topic=99225.msg327903#msg327903

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>



AND:

have you tried checking the "Downloadable"   in the product image tab?



amorino

#29
Quote from: BanquetTables.pro on August 09, 2012, 00:00:36 AM
AND:

have you tried checking the "Downloadable"   in the product image tab?

Thank you a lot BanquetTables.pro
I tried downlable
I see it in the backend with the medias and it has a pdf icon
But how to insert that icon (cliccable) it in the category template and in the product template?

Best rgegards
Amorino

[Edit:]
Now it's OK in the details page by adding it in the custom field
But I need it in the categorie view because I will not use the detail page
I tried this code :
<?php
    
// Product Files
    // foreach ($this->product->images as $fkey => $file) {
    // Todo add downloadable files again
    // if( $file->filesize > 0.5) $filesize_display = ' ('. number_format($file->filesize, 2,',','.')." MB)";
    // else $filesize_display = ' ('. number_format($file->filesize*1024, 2,',','.')." KB)";

    /* Show pdf in a new Window, other file types will be offered as download */
    // $target = stristr($file->file_mimetype, "pdf") ? "_blank" : "_self";
    // $link = JRoute::_('index.php?view=productdetails&task=getfile&virtuemart_media_id='.$file->virtuemart_media_id.'&virtuemart_product_id='.$this->product->virtuemart_product_id);
    // echo JHTMl::_('link', $link, $file->file_title.$filesize_display, array('target' => $target));
    // }
    
if (!empty($this->product->customfieldsRelatedProducts)) {
echo $this->loadTemplate('relatedproducts');
    } 
// Product customfieldsRelatedProducts END

    
if (!empty($this->product->customfieldsRelatedCategories)) {
echo $this->loadTemplate('relatedcategories');
    } 
// Product customfieldsRelatedCategories END
    // Show child categories
    
if (VmConfig::get('showCategory'1)) {
echo $this->loadTemplate('showcategory');
    }
    if (!empty(
$this->product->customfieldsSorted['onbot'])) {
    
$this->position='onbot';
    
echo $this->loadTemplate('customfields');
    } 
// Product Custom ontop end
    
?>


in the category template but it didn't work
Any help please?
Best regards
Amorino
Création sites web Tunisie
http://www.idealconception.com