VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: naoko15 on May 27, 2014, 12:48:53 PM

Title: Print/pdf button in category view?
Post by: naoko15 on May 27, 2014, 12:48:53 PM
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.
Title: Re: Print/pdf button in category view?
Post by: skhn123 on May 29, 2014, 15:15:25 PM
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 :)
Title: Re: Print/pdf button in category view?
Post by: naoko15 on June 02, 2014, 13:50:47 PM
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>


Title: Re: Print/pdf button in category view?
Post by: naoko15 on June 10, 2014, 11:53:36 AM
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

Title: Re: Print/pdf button in category view?
Post by: naoko15 on June 12, 2014, 10:58:56 AM
I hate to bump posts, but a i really really need help : (
Title: Re: Print/pdf button in category view?
Post by: GJC Web Design on June 12, 2014, 11:25:52 AM
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
Title: Re: Print/pdf button in category view?
Post by: naoko15 on June 12, 2014, 11:32:55 AM
Hi, i've provided all the necessary information to request help, including live urls i've posted in previous posts:


Regards





Title: Re: Print/pdf button in category view?
Post by: GJC Web Design on June 12, 2014, 11:59:43 AM
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
Title: Re: Print/pdf button in category view?
Post by: naoko15 on June 12, 2014, 12:12:08 PM
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.
Title: Re: Print/pdf button in category view?
Post by: jenkinhill on June 12, 2014, 12:15:55 PM
Look at the pdf templates in productdetails for an example of print style layout.
Title: Re: Print/pdf button in category view?
Post by: naoko15 on June 13, 2014, 14:13:36 PM
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>
Title: Re: Print/pdf button in category view?
Post by: 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

Title: Re: Print/pdf button in category view?
Post by: naoko15 on June 13, 2014, 17:42:31 PM
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
Title: Re: Print/pdf button in category view?
Post by: naoko15 on June 19, 2014, 11:27:35 AM
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