News:

Support the VirtueMart project and become a member

Main Menu

Print/pdf button in category view?

Started by naoko15, May 27, 2014, 12:48:53 PM

Previous topic - Next topic

naoko15

Hello, i'd like to know if it is possible to have a print or/and a pdf button in category views and how. I've noticed that these buttons are only available for in product detail view.

I'm running VM 2.0.26d  + Joomla 2.5

Thank you and kind regards.

skhn123

Hello,

why dont you first try these sticky post's:

category page override:
http://forum.virtuemart.net/index.php?topic=97744.0

product details page override:
http://forum.virtuemart.net/index.php?topic=92756.0

and also look at different between category and product page system:
http://forum.virtuemart.net/index.php?topic=100696.0

see if there is something relative about you problem.

regards :)

naoko15

#2
Thanks for the reply. I figured out how to insert the print function in the category view. I inserted the following code in the category's default.php override

<div class="imprimir"><A HREF="javascript:window.print()"><img src="/images/printButton.png"></A>
<style type="text/css" media="print">
#s5_cartright, .module_round_box-static, #s5_header_area, .module_round_box_outer, .orderby-displaynumber, .module_round_box2, #s5_logo_module,
#s5_search_wrap, #s5_newmodule a, #s5_newmodule, #s5_menu_wrap, #s5_texto, #s5_footer_area1, .social, #s5_logregtm, .browse-view h1,
.addtocart-bar-plus, .imprimir, #s5_breadcrumb_wrap, .title, .pagination, .vm-pagination { display: none;}
</style></div>



naoko15

#3
i'm really struggling to firue out this. Can someone help me? I'd like the resulting print file to have a layout with four products per row instead of three

If i add this code to the category override's default.php i get 4 products per row IN the category layout instead of the printed file:

<div class="imprimir"><A HREF="javascript:window.print()"><img src="/images/printButton.png"></A>
<style type="text/css" media="print">
#s5_cartright, .module_round_box-static, #s5_header_area, s5_header_area1, .module_round_box_outer, .orderby-displaynumber, .module_round_box2, #s5_logo_module,
#s5_search_wrap, #s5_newmodule a, #s5_newmodule, #s5_menu_wrap, #s5_texto, #s5_footer_area1, .social, #s5_logregtm, .browse-view h1,
.addtocart-bar-plus, .addtocart-bar2, .imprimir, #s5_breadcrumb_wrap, .title, .pagination, .vm-pagination, head, .bottom-pagination{ display: none;}

body {
margin-bottom: 25px;
    margin-right: 200px;
    padding-top: 1px;
margin-top: -150px;
    z-index: 1000;
float: left;
}

.module_round_box_outer, #s5_component_wrap, #s5_center_area .moduletable, .module_round_box_outer-none, #s5_breadcrumb_wrap .moduletable {
    margin-left: 12px;
    margin-right: 14px;
    margin-top: 5px;
    padding-right: 50px;
}

.vertical-separator {
    border-right: 0px dotted #939393;
}


.featured-view .spacer h3, .latest-view .spacer h3, .topten-view .spacer h3, .recent-view .spacer h3, .related-products-view .spacer h3, .browse-view .row .product .spacer h2 {
    float: right;
    font-size: 17px;
    font-weight: bold;
    margin: -190px -14px 6px;
    padding: 0;
    width: 116px;

}

</style>


<?php $this->perRow $this->perRow 1;  ?>
</div>


How can make the layout to print to look like i need?



Thanks


naoko15

I hate to bump posts, but a i really really need help : (

GJC Web Design

Hmm ...  I don't see how you can expect anyone to help you when you provide a small snippet of out of context css and a screen shot.. come on!
No live site? 
Would you know what you were talking about if this was all you were provided with?

Firebug is your friend
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

naoko15

#6
Hi, i've provided all the necessary information to request help, including live urls i've posted in previous posts:


Regards






GJC Web Design

You can't redesign your html layout (cleared rows with 33% width divs) by placing some css in the page.

If you want a different layout - 4 per row ) you will have to go down the path of a separate "print" template - not just hiding elements by css

And if you really want to not get help keep the right click disable so we have to manually dig down thru 50 layers of divs to get to the component element --  :-\  ;D
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

naoko15

Thank you  for your reply : ) I like your idea of creating a different template for the output pint file instead of embedding the css in the category layout's override, but i don't know how to do it.

I mean, i know how to create a css file but i don't know how to make this template be the print file. Would you be so kind to point me in the right direction?

Sorry about the right-click thing. It's enabled now.

jenkinhill

Look at the pdf templates in productdetails for an example of print style layout.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

naoko15

Quote from: jenkinhill on June 12, 2014, 12:15:55 PM
Look at the pdf templates in productdetails for an example of print style layout.

Thanks! I have another question though. How can i load the pdf/print file form the print botton code i embedded in the category's layout?

<div class="imprimir"><A HREF="javascript:window.print()"><img src="/images/printButton.png"></A>

GJC Web Design

quite complicated and needs a small core hack

first copy the default.php cat template to default_pdf.php and get it displaying as you want

then change the print icon code to   

echo $this->linkIcon($link . '&format=pdf&tmpl=component', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon', false);

and then in the components/com_virtuemart/controllers/category.php ~ line 63 add after ->  $viewName = JRequest::getCmd('view', $this->default_view);

$document = JFactory::getDocument();
$viewType = $document->getType();
$viewName = JRequest::getCmd('view', $this->default_view);
//GJC
$format = JRequest::getWord ('format', 'html');
if ($format == 'pdf') {
$viewName = 'Pdf';
}
//GJC


then it will open as you style it in a pdf window and they can print it

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

naoko15

#12
Quote from: GJC Web Design on June 13, 2014, 15:28:57 PM
quite complicated and needs a small core hack

first copy the default.php cat template to default_pdf.php and get it displaying as you want

then change the print icon code to   

echo $this->linkIcon($link . '&format=pdf&tmpl=component', 'COM_VIRTUEMART_PRINT', 'printButton', 'show_printicon', false);

and then in the components/com_virtuemart/controllers/category.php ~ line 63 add after ->  $viewName = JRequest::getCmd('view', $this->default_view);

$document = JFactory::getDocument();
$viewType = $document->getType();
$viewName = JRequest::getCmd('view', $this->default_view);
//GJC
$format = JRequest::getWord ('format', 'html');
if ($format == 'pdf') {
$viewName = 'Pdf';
}
//GJC


then it will open as you style it in a pdf window and they can print it



Excellent!! I would never have been able to figure it out on my own, thank you very much, you're great!!!! : ) I'll let you know how it goes

naoko15

#13
Ok, so i got it to work. Now i'm styling the pdf. I have a question:

How can i have 4 rows of products instead of one?

This doesn't work: $this->perRow = 4

I need the products in the pdf layout to look similar to the category's, only in rows of 4 instead of 3



Thanks