Add Print Button

  • Posts: 2
  • Thank you received: 0
9 years 5 months ago #234442

how add print button on product page , to print only visible product content .

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
9 years 5 months ago #234447

Hi,

You can add something like this to product/show_default view:

<a class="print_button" onclick="return window.hikashop.openBox(this,null,false);" href="<?php echo JURI::current(); ?>?tmpl=component&print=1"  rel="{handler: 'iframe', size: {x: 580, y: 590}}"  title="<?php echo JText::_('HIKA_PRINT');?>"><i class='fa fa-print'></i></a>

And add this to your template component.php file:
<?php
if($_GET['print'] == "1") { ?>
 <head>
    <jdoc:include type="head" />
    <link rel="stylesheet" href="<?php echo JURI::base(); ?>templates/<?php echo $this->template ?>/css/print.css" type="text/css" />
</head>
<?php }?>

And create print.css file to your template css folder so you could customize this print view with css...
All depends on your template and configuration.

You also need in the file "components/com_hikashop/views/product/view.html.php" at the beginning of the function "show()" add this code :
$print = JRequest::getVar('print','');
		if($print){
			$js = "do_nothing( function() {setTimeout(function(){window.focus();window.print();setTimeout(function(){hikashop.closeBox();}, 1000);},1000);});";
			$doc = JFactory::getDocument();
			$doc->addScriptDeclaration("\n<!--\n".$js."\n//-->\n");
			//JHTML::script('mootools.js', JURI::base(true) .'media/system/js/');
			if(!HIKASHOP_J30)
				JHTML::_('behavior.mootools');
			else
				JHTML::_('behavior.framework');
		}

As per this topic: www.hikashop.com/forum/4-how-to/71556-ad...p-social-plugin.html


Hope this helps.
Regards

Last edit: 9 years 5 months ago by kyratn.
The following user(s) said Thank You: JacoboRoy

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 0
9 years 5 months ago #234803

Tienen soporte en español?
El primer código en que archivo debo meterlo?

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
9 years 5 months ago #234829

Hello,

1. Support is principally done in English.

2. You'll find your answer by following that thread : www.hikashop.com/forum/4-how-to/71556-ad...p-social-plugin.html

Please Log in or Create an account to join the conversation.

Time to create page: 0.078 seconds
Powered by Kunena Forum