Jump to content

Print Invoices PDf ..


ChrisColeman

Recommended Posts

I am adding an option to allow customers to print using PDF.

I will use a hook at class.cubecart.print.receipt.

The problem is that I need to pass the option to the hook. 

Normally to print a receipt the anchor tag looks like -

       <a href="{$STORE_URL}/index.php?_a=receipt&amp;cart_order_id={$SUM.cart_order_id}" target="_blank">{$LANG.confirm.print}</a>

But I need to change it to do something like -

<a href="{$STORE_URL}/index.php?_a=receipt&amp;cart_order_id={$SUM.cart_order_id}&amp;_pdf=pdf" target="_blank">{$LANG.confirm.print}</a>

i.e. with extra pdf variable ..

But CubeCart strips of the extra pdf variable, which I guess is safer.

Is there another way to pass additional variables from an html page ?

Thanks.

Edited by ChrisColeman
Link to comment
Share on other sites

So, the edited anchor tag is on a skin template somewhere? Perhaps the customer's Order Summary or Order History page?

If so, then perhaps CubeCart is using a cached copy of that previously compiled template.

To double-check that, have your browser show you the HTML source of the page received and find the anchor tag that you edited. (A simpler way is to hover over the "Print" icon and note the address that the browser should show in the status bar.)

If the edited link is not actually showing as it has been edited in the browser, then I would suspect the skin is being assembled from the cached templates. In admin, Maintenance, Rebuild tab, check the Clear Cache box and Submit.

Link to comment
Share on other sites

Yes, its the order history page.

I was running without the cache, but have now emptied the cache too.

Running the curser over the anchor show that I am opening the correct page, but I'm still getting the same result.

I have noticed something strange, if I change the request string around a little so the variables are in a different order -

   <a href="{$STORE_URL}/index.php?_a=receipt&amp;_pdf=pdf&amp;cart_order_id={$SUM.cart_order_id}" target="_blank">{$LANG.confirm.print}</a>

You would expect the result to be the same, but its not because I get redirected back to the homepage ..

Anyway 'notwithstanding' all of that -

I found that the data I need is in the 'session object' so can ignore the above.

And Thank You for pointing me in the right direction.

Chris.

Link to comment
Share on other sites

I can confirm these results, and I think the problem is more systemic than what you are doing.

I will experiment by making this edit to the SEO class:

/classes/seo.class.php, starting near line 46,
(Line expanded out for readability)
	/**
	 * Ignored URL sections
	 *
	 * @var array of strings
	 */
	private $_ignored   = array(
		'account',
		'addressbook',
		'basket',
		'checkout',
		'complete',
		'confirm',
		'downloads',
		'gateway',
		'logout',
		'profile',
		'receipt', // <== NEWLY ADDED IGNORED SECTION
		'recover',
		'recovery',
		'remote',
		'vieworder',
		'plugin'
	);

Edit: Ok, good, I got the new window for the Customer's Invoice.

Now to make sure that _pdf=pdf has not got lost.

Edited by bsmither
Test Results
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...