Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Virtuemart Template - FashionMart (SKU# FLEX-00008)

TOPIC: print list

print list 9 years 6 months ago #1972

hello, I need to display a print button in the list of products.

What code should I add in defaultlist.php to print all products

Thank you in advance
Last Edit: 9 years 6 months ago by Burhan Mercan.
The topic has been locked.

print list 9 years 6 months ago #1995

Hi,

You can use this link in anywhere you would like (usually at the top of the page):
<A HREF="javascript:window.print()">Click to Print This Page</A>

to create "print" button.
Regards.
The topic has been locked.

print list 9 years 6 months ago #2001

Hello and thank you for your help.

I tried to put this code, it shows me the good list, but I still sidbar is printed, is there a way to resume printing the view.

thank you


<?php
    // PDF - Print - Email Icon
    if (VmConfig::get('show_emailfriend') || VmConfig::get('show_printicon') || VmConfig::get('pdf_button_enable')) {
	?>
        <div class="icons">
	    <?php
	    //$link = (JVM_VERSION===1) ? 'index2.php' : 'index.php';
	    $link = 'index.php?tmpl=component&option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $this->product->virtuemart_product_id;
	    $MailLink = 'index.php?option=com_virtuemart&view=productdetails&task=recommend&virtuemart_product_id=' . $this->product->virtuemart_product_id . '&virtuemart_category_id=' . $this->product->virtuemart_category_id . '&tmpl=component';
 
	    if (VmConfig::get('pdf_icon', 1) == '1') {
		echo $this->linkIcon($link . '&format=pdf', 'COM_VIRTUEMART_PDF', 'pdf_button', 'pdf_button_enable', false);
	    }
	    echo $this->linkIcon($link . '&print=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon');
	    echo $this->linkIcon($MailLink, 'COM_VIRTUEMART_EMAIL', 'emailButton', 'show_emailfriend');
	    ?>
    	<div class="clear"></div>
        </div>
    <?php } // PDF - Print - Email Icon END
    ?>
Last Edit: 9 years 6 months ago by Burhan Mercan.
The topic has been locked.

print list 9 years 6 months ago #2002

Hi,

In which page you are trying put the the "print" link and which page you want to be get printed?
Category browse page? or product details page?
Last Edit: 9 years 6 months ago by Support.
The topic has been locked.

print list 9 years 6 months ago #2005

Category browse page
The topic has been locked.

print list 9 years 6 months ago #2020

Hello I managed to display the list in a popup and print.
here's the code to insert.
<?php
    // Print Icon
    if (VmConfig::get('show_printicon')) {
	?>
        <div class="icons">
	    <?php
	    //$link = (JVM_VERSION===1) ? 'index2.php' : 'index.php';
	    $link = 'index.php?tmpl=component&option=com_virtuemart&view=category&virtuemart_category_id=' . $this->category->virtuemart_category_id;
 
	      $isPopup = JRequest::getVar( 'pop' );
    if ( $isPopup ) {
   // Print Preview button - used in pop-up window 
   echo $this->linkIcon('', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon', false,true,false, true);
    } else {
   // Print Button - used when viewing page
   echo $this->linkIcon($link . '&print=1&pop=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon');
    }
	    ?>
    	<div class="clear"></div>
        </div>
    <?php } //Print -  Icon END
    ?>

I would do the same to show chos manufacturer. I have a fatal error

Fatal error: Call to undefined method CustomfiltersViewProducts::linkIcon() in/var/www/www****/html/com_virtuemart/category/default.php on line 68
echo $this->linkIcon($link . '&print=1&pop=1', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon');
Do you have any idea
Last Edit: 9 years 6 months ago by Burhan Mercan.
The topic has been locked.

print list 9 years 6 months ago #2024

You can't use those PHP functions (such as: echo $this->linkIcon ) everywhere you want.
Virtuemart developers have defined those parameters in the pages where they are needed. Apparently they didn't define it in manufacturer page, 'cause they didn't think manufacturer page needs to be printed..

You can use this little trick. Follow my steps.. (ohh by the way, this is a custom modification and our free support doesn't cover the custom modification, but i am going to guide you to solve it anyway..)

In Category browse page;
(to this PHP file: ROOT/templates/<yourjoomlatemplate>/html/com_virtuemart/category/default.php)

Add this regular Link:
<A HREF="javascript:window.print()">Click to Print This Page</A>

To any where you would like to put the "print icon". BUT this will print the whole page, including menu navigations and everything appears. You might want to hide the unnecessary elements and print only inside the "content" area.

Then you can use include this STYLE lines to category browse page PHP:
<s-tyle type="text/css" media="print">
   .no-print-element { display: none; }
</style>
(don't forget to change the s-tyle to style. I can't do it here as this rule gets affected in this forum page.)

Since this STYLE Tag has media="print", it will be effective only while printing.
I don't know your website so i don't know which element you should include there with display:none;
But use FireBug (firefox plugin) to determine the unnecessary elements and include them in this STYLE tag with display:none; parameter..

You understand the idea?

For instance, your menu navigation has this DIV ID: <div id="menu"> ...... the menu navigation stays here.... </div>

Then if you add this:
<s-tyle type="text/css" media="print">
   #menu { display: none; }
</style>
(don't forget to change the s-tyle to style. I can't do it here as this rule gets affected in this forum page.)

And once the
<A HREF="javascript:window.print()">Click to Print This Page</A>
link is clicked, what ever stays inside the <div id="menu">...</div> won't be printed.....

This is the most easiest and efficient way to print the website page. Opening the page in a POPUP page is also a way, but that time you will also need to include the JAVA line to page to start the printing automatically once the page gets loaded. My way is the easiest way. You can google it and find an alternative ways. I would recommend you to take care this without using PHP. Things will be much easier then.

Regards.
Forum Support.
Last Edit: 9 years 6 months ago by Support.
The topic has been locked.

print list 9 years 6 months ago #2029

A big thank you!

It works great
Last Edit: 9 years 6 months ago by Burhan Mercan.
The topic has been locked.

print list 9 years 6 months ago #2032

I am glad you figured it out.
Think simple. Sometimes things are easier than you expect ;)

Case solved. Topic is closed.
The topic has been locked.
Time to create page: 0.256 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo