Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / set_snapshot - can I use it for scripts outside of index.php?

set_snapshot - can I use it for scripts outside of index.php?

Views: 2,100

Results 21 to 30 of 30
6 Aug 2015, 3:36 PM
#21
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

set_snapshot - can I use it for scripts outside of index.php?

DigitalShadow:

the snapshot page is showing as correct, but it seems to want to place the page on a base path that needs to be set.

Alternatively, you could emulate the zen_back_link function and if the $page['page'] variable is set as you have done above without the first slash, then if you created your zen_href_link with $static set to true instead of the default false, then yes you could leave the file where it is and the email link the way it is... But that all centers around how the user gets from the link, to login, and back to the link...

6 Aug 2015, 3:41 PM
#22
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: set_snapshot - can I use it for scripts outside of index.php?

There's also a notifier in includes/modules/pages/login/header_php.php that could be used to identify the presence of that page in the navigation_history and redirect to it yourself in that observer...

$zco_notifier->notify('NOTIFY_LOGIN_SUCCESS');

Or modify the above header file directly to "listen" for this "event" and redirect to the page you are trying to access instead of what it currently does...

Just some thoughts.

I'd suggest the notifier instead to save sanity on upgrades, but...

6 Aug 2015, 3:51 PM
#23
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: set_snapshot - can I use it for scripts outside of index.php?

If i do nothing and just

echo $_SESSION['navigation']->debug();

then it shows on page load

index?order_id=35041&

if i then add

$_SESSION['navigation']->set_snapshot(); echo $_SESSION['navigation']->snapshot['page'];

then it shows on page load

index?order_id=35041&

SSL index?order_id=35041
index

and redirects to

domain.here/?order_id=35041&

So it has redirected to a page without index.php

How do I fill out the array information correctly to modify the page information without injecting back in the index.php

6 Aug 2015, 4:24 PM
#24
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: set_snapshot - can I use it for scripts outside of index.php?

See the code referenced above, includes/functions/functions_general.php and html_output.php play into this having each of the above functions: zen_back_link and zen_href_link respectively.

After looking at the code as it stands, there is no information that can be provided to set_snapshot that would take to a different location other than YOURSITE/index.php.

6 Aug 2015, 4:47 PM
#25
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: set_snapshot - can I use it for scripts outside of index.php?

If I could inject something into

$get_vars[$key] = $value;

It might work

6 Aug 2015, 5:30 PM
#26
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: set_snapshot - can I use it for scripts outside of index.php?

I've tried, I managed to modify the $_GET to create a url, but the best I have managed is

domain.here/**?**order_question.php?order_id=35041

the ? obviously is the problem, and I don't think that can be removed without changing navigation_history.php and that was another thing I wanted to avoid.

Oh well... moving it to a custom page it is....

6 Aug 2015, 6:45 PM
#27
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: set_snapshot - can I use it for scripts outside of index.php?

DigitalShadow:

If I could inject something into

$get_vars[$key] = $value;

> 
> It might work

That portion is related to the parameters on the uri. Which would requre a redirect type key that doesn't exist/work.

There are a number of ways it could be addressed though... :)
10 Aug 2015, 1:20 PM
#28
digitalshadow avatar

digitalshadow

Totally Zenned

Join Date:
Mar 2009
Posts:
616
Plugin Contributions:
0

Re: set_snapshot - can I use it for scripts outside of index.php?

that doesn't involve moving the module to a custom page?

10 Aug 2015, 1:40 PM
#29
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: set_snapshot - can I use it for scripts outside of index.php?

DigitalShadow:

that doesn't involve moving the module to a custom page?

Here's my thought. You already have the ability to set the page to which toreturn... So, the header of that page should have a redirect to your desired code... No additional tpl files necessary, just the FILENAME_XXX definition, and a header_php.php file in the appropriate pages directory for the "new" page...

As written right now, click on link in email, goes to file, file checks for login status, if not logged in, set "new" page, goto login, when done go to new page, new page redirects back to file, check for login, logged in, continue transaction.

Just need to be sure to maintain the uri parameters (get info) along the way...

11 Aug 2015, 5:12 AM
#30
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: set_snapshot - can I use it for scripts outside of index.php?

Note: The navigation-history code which does the snapshots was never designed to handle files that originate from someplace other than index.php?main_page=(something). That's why you're running into these difficulties.

I would recommend this to be the simplest approach:

a. create a custom page which is accessed via index.php?main_page=custom_page_name (it can take a snapshot and restore it after login, the same as the My Account or Checkout pages do)

b. in your apache .htaccess set a Redirect rule to send /custom_page.php to index.php?main_page=custom_page_name ... this way you can use the fancy short URL you've wanted since your first post, and the server will auto-send them to the correct "real" place where that page operates from.

Then all the snapshot logic should work without requiring complicated rewrites to its logic.