News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

show media files separate from images in productdetails

Started by Nelia, February 02, 2016, 12:00:43 PM

Previous topic - Next topic

Nelia

Hi,
I am very new to Joomla/Virtuemart so maybe I am overlooking the obvious, but:

For each product I have one or more images and also one or more PDF-files that have additional productinformation. I used the media upload to attach all these files to a product. So now when I view the product I see all media together but I would like to set the PDF-files apart from the images on the page and I can't seem to figure out how to do this. I have found the /templates/.../html/com_virtuemart/productdetails/default.php, but can anyone give me a hand on how to query for images and pdf-files separately? I am using Joomla 3.4.8 and Virtuemart 3.0.12.

PRO

you can actually use custom fields for this.
Just set the PDF as the custom field.

but also


default_images_additional.php


after this
   $image = $this->product->images[$i];
      add this
if ($image->file_extension =='pdf') continue;


then that will skip the pdf files


then,
you can add this code, where you want the pdf files

<div class="additional-images">
   <?php
   $start_image = VmConfig::get('add_img_main', 1) ? 0 : 1;
   for ($i = $start_image; $i < count($this->product->images); $i++) {
      $image = $this->product->images[$i];
        if ($image->file_extension !='pdf') continue;
      ?>
      <div class="floatleft">
         <?php
         if(VmConfig::get('add_img_main', 1)) {
            echo $image->displayMediaThumb('class="product-image" style="cursor: pointer"',false,$image->file_description);
            echo '<a href="'. $image->file_url .'"  class="product-image image-'. $i .'" style="display:none;" title="'. $image->file_meta .'" rel="vm-additional-images"></a>';
         } else {
            echo $image->displayMediaThumb("",true,"rel='vm-additional-images'",true,$image->file_description);
         }
         ?>
      </div>
   <?php
   }
   ?>
   <div class="clear"></div>
</div>

VMTemplates.net

Hi,

maybe it would be easier to add only images for products (on product images tab) and PDF files add as a links in the product description. You mentioned you are very new to Joomla/VirtueMart so, if you want to avoid changes to the code this solution may work for you.
We develop VirtueMart templates since 2008
https://www.virtuemarttemplates.net/
Join the VirtueMart Templates Club today and get an access to over 60 VirtueMart templates
https://www.virtuemarttemplates.net/template-club.html
If you need a custom VirtueMart Template design please visit https://www.virtuemarttemplates.net/custom-virtuemart-template-design.html
Visit our new shop https://demo.virtuemarttemplates.net/
Join the VirtueMart Templates Club, purchase the template or order one of our services like Hosting, Website Maintenance, Security and Optimization, Template Customization and more

Nelia

Hi PRO, thank you so much. This is exactly what I have been looking for for days!

Can I just ask you one more question? Can you point me towards a good reference (book, site, document?) where I can learn about the objects/functions of joomla and virtuemart? So that I can get a better understanding what the code is doing...

GJC Web Design

One of the huge advantages of Vm2+ is that it follows standard MVC architecture as used in Joomla components

So Google any basic discussion of this code structure will inform you of how VM is put together plud investigate the actual structure.. u don't need any specific VM references  perhaps plugin structure etc

http://docs.virtuemart.net/tutorials/development.html
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation