No easy way to print gift card in download area

  • Posts: 165
  • Thank you received: 3
  • Hikashop Business
5 years 7 months ago #232696

-- HikaShop version -- : 2.6.1
-- HikaSerial version -- : 1.10.2
-- Joomla version -- : 3.4.8

I am using hikaserial with hikashop and I have noticed a major issue. Inside of the customer download area where i can download my gift cards it does not allow me to download my images but instead opens the image in the same tab with no easy way to print. I am sure this is default browser behavior.However, this is a problem it takes you off the main site with no way to get back, but by clicking the back button in the browser. That is not intuitive to a lot of people.

Also, I need a way to add a print button so I can print the coupon images instead of it opening the image in a new tab like above or if there is a way to download this image without it opening in a tab that is fine as well.

This is also a user problem. It may not be common sense to all customer that they can right click and print or go to their browser and print.

How can I add a print button to directly print the hikaserial coupon. I know it is dynamically generating the coupon when I click download but there has to be a way to add a print button there?

Last edit: 5 years 7 months ago by jschroeder.

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

  • Posts: 25034
  • Thank you received: 3874
  • MODERATOR
5 years 7 months ago #232731

Hi,

When HikaSerial use the HikaShop trigger to override the download of a (virtual) file ; it takes control of the headers.
And in these headers, I choose to use the one to mark the file as an image ; which makes the browser display it directly and not download it in your hard drive.
But, it would be possible to add an option in the "attach serial" plugin in order to choose the type of the HTTP headers, so you could have a configuration where the download of the file is forced everywhere (in the front-end order, in the backend, in the email).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 165
  • Thank you received: 3
  • Hikashop Business
5 years 7 months ago #232772

Is there a way to add a print button instead of downloading the file the more i think about it, the more I thinking they need to be able to print the file and not download it.?

Thanks,

Josh

Last edit: 5 years 7 months ago by jschroeder.

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

  • Posts: 25034
  • Thank you received: 3874
  • MODERATOR
5 years 7 months ago #232789

Hi,

There is no (simple) way to add a print button.

With a lot of development, some view override and maybe a custom plugin ; it might be possible to add it, but it is clearly not something which can be done in a few minutes or in a few hours.
It requires to modify several files in HikaShop and HikaSerial to change completely how the download of the product files can be done (and do it only for the HikaSerial "attach serial" files...)

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 165
  • Thank you received: 3
  • Hikashop Business
5 years 7 months ago #232810

Jerome wrote: Hi,

When HikaSerial use the HikaShop trigger to override the download of a (virtual) file ; it takes control of the headers.
And in these headers, I choose to use the one to mark the file as an image ; which makes the browser display it directly and not download it in your hard drive.
But, it would be possible to add an option in the "attach serial" plugin in order to choose the type of the HTTP headers, so you could have a configuration where the download of the file is forced everywhere (in the front-end order, in the backend, in the email).

Regards,


Hi I was able to figure out how to change the type as you suggested now. In the attachserial plugin in the very last function
I wrote the following
Original Code:
private function sendHeader($extension) {
		$mime = $this->getMime($extension);
		if(!empty($mime)) {
			header('Content-Type: '.$mime);
			return true;
		}
		return false;
	}
}

re-written code:
private function sendHeader($extension) {
		$mime = $this->getMime($extension);
		if(!empty($mime)) {
			header('Content-Type: '.$mime);
			header('Content-Disposition: attachment');
			return true;
		}
		return false;
	}
}


All i added is this 1 line header('Content-Disposition: attachment');
The problem I am having is it is downloading the html file and and not the actual coupon that is generated from the url how would i write the code to fix this?

I am using a .png as well for my image. I very urgently need at solution for this i have spent like 2 days trying to get this to work.

Thanks,

Josh

Last edit: 5 years 7 months ago by jschroeder.

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

  • Posts: 165
  • Thank you received: 3
  • Hikashop Business
5 years 7 months ago #232813

I finally figured it out. I had to add these 2 lines of code
$filecustom = "AutobellPrintableGiftCard.png";
header('Content-Disposition: attachment; filename="'.$filecustom.'"');

private function sendHeader($extension) {
		$mime = $this->getMime($extension);
		$filecustom = "PrintableGiftCard.png";
		if(!empty($mime)) {
			header('Content-Type: '.$mime);
			header('Content-Disposition: attachment; filename="'.$filecustom.'"');
			return true;
		}
		return false;
	}

It would be nice to give an option somewhere in the parameters of the hikaserial plugin to give the option to download the image file or have it just open like previously. I don't see why it couldn't be a parameter in the plugin itself.

The thing I don't like about what it did is it is going to be overridden in an update.

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

  • Posts: 25034
  • Thank you received: 3874
  • MODERATOR
5 years 7 months ago #232843

Hi,

I was working on that before writing my previous answer and I would give you some piece of code to do so... But due to the fact that you edited (multiple times) your message(s), the original message was gone and you put your "print" question instead.
So, when I wanted to make you a reply, with the work I have done, I was surprised that the email notification I received was totally different..

Please understand that we do not appreciate that kind of message modification ; if you want to fix some typo that's fine.. But if you want to add new questions or totally change your message ; it won't help us to provide a good support and could have to opposite effect.

So yes ; I have already added two settings in the plugin to force the download and force the downloaded filename.
That feature will be include in the next HikaSerial release.

Thanks for your understanding.


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 165
  • Thank you received: 3
  • Hikashop Business
5 years 7 months ago #232867

I apologize about removing that and won't do that in the future, but after talking to my boss I actually removed it because I did not want you to waste time, but it appears by removing it I caused the opposite because after talking to him again we just decided to make it download instead.

Any idea when the new version may be available?

Thanks,

Josh

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

  • Posts: 165
  • Thank you received: 3
  • Hikashop Business
5 years 7 months ago #232868

Also, even though my code is working is there anyway you can send me the updated code or file with the changes you made? I am going to have to present this site to the client next week and I would prefer to have the code you added since it will be in the next release.

Last edit: 5 years 7 months ago by jschroeder.

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

  • Posts: 25034
  • Thank you received: 3874
  • MODERATOR
5 years 7 months ago #232878

Hi,

I can't provide you all modification like that in the forum ; there is too many modified parts (in several files, to add the new settings).
We can see to send you an updated version of the "attachserial" plugin by email ; best is to use the "contact us" form for that.

Otherwise, the patch is using that kind of code in order to force the download :

	header('Content-Type: application/octet-stream');
	header('Content-Disposition: attachment; filename="' . $filename . '.' . $extension . '"');
where you have to define the variable $filename.

About the HikaSerial next release ; we do not have any schedule for the moment.
We have some developments in progress for HikaMarket and few patchs for HikaSerial.
I think that once the HikaMarket release will be done, we will perform some developments for HikaSerial (which are in the TODO list) and then we will be able to make a release.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 165
  • Thank you received: 3
  • Hikashop Business
5 years 7 months ago #232886

Thank you for the response I just sent a submission via the contact form to get the serial attach plugin changes you made.

Thanks,

Josh

Last edit: 5 years 7 months ago by jschroeder.

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

Moderators: Obsidev
Time to create page: 0.055 seconds
Powered by Kunena Forum