ChrisColeman Posted October 20, 2015 Share Posted October 20, 2015 (edited) 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&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&cart_order_id={$SUM.cart_order_id}&_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 October 20, 2015 by ChrisColeman Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 20, 2015 Share Posted October 20, 2015 CubeCart shouldn't strip it off. The variable $_GET['_pdf'] should be available.Where do you observe that $_GET['_pdf'] is not available? Quote Link to comment Share on other sites More sharing options...
ChrisColeman Posted October 20, 2015 Author Share Posted October 20, 2015 In the hook - class.cubecart.print.receipt.phpI have - print_r($_GET);die;Which returns - Array ( [_a] => receipt [cart_order_id] => 151020-123959-6761 ) Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 20, 2015 Share Posted October 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
ChrisColeman Posted October 20, 2015 Author Share Posted October 20, 2015 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&_pdf=pdf&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. Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 21, 2015 Share Posted October 21, 2015 (edited) 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 October 21, 2015 by bsmither Test Results Quote Link to comment Share on other sites More sharing options...
ChrisColeman Posted October 23, 2015 Author Share Posted October 23, 2015 Yes I did the same - but do not wish to modify this part of the store - My plug-in would stop working every time an update occurred .. Quote Link to comment Share on other sites More sharing options...
bsmither Posted October 23, 2015 Share Posted October 23, 2015 I have 100% confidence that the code change I mentioned above will be implemented in the next version of CubeCart 6. As such, I assert that your plugin will continue to operate as expected when/if you upgrade to CC609 or later. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.