Landing page

[quote]

May this have something to do with the landing page change i made?

[/quote]

Quite possibly.


[quote]

May this have something to do with the landing page change i made?

[/quote]

No, this is not good. What are you seeing that is causing you to believe you need to do this? I have customers using this registry method that run for months without clearing the cache. They do need to clear it when making some admin changes like adding blocks, etc. But nothing that would be considered regular maintenance.

Yeah, I agree with “T” in that the whole idea behind the SQLITE mod in 2.0.14 was to eliminate the need for all the user intervention, so it is rather puzzling that although you are seeing improvements in site performance, you still believe or have the need to constantly clear your cache. :confused:



Regardless “T” is the expert in tearing this code apart & putting it back together again (& actually having it work properly)!



I am nothing more than a “Master Manipulator” that somehow manages to survive from day to day (although I am rather talented at business survival). :smiley:



I will again strongly suggest that you consider upgrading at your leisure, even if you only upgrade to 2.0.15 and stop there for awhile!


[QUOTE]Struck, I love red wine color in lips, nails and cars. I also love red wine, if it is Spanish even better :wink: [/QUOTE]



Well, I am almost speechless and overwhelmed with pleasant thoughts, I only have experience with red Merlot, however, there is absolutely nothing wrong with Spanish girls, they are quite precious! :oops:

I still get a “page not found” error when I edit an order. Could you please tell me where I must look? which file must I check?

It must be something I changed but still don’t know what :confused:

Can you post a screenshot of the page you are on before you click whatever action takes you to a page not found and then tell us what you are clicking?



Is it a link you can hover over and see what the Href would be in the browser status area? Or is it a button (like Save)?

[quote name=‘tbirnseth’]Can you post a screenshot of the page you are on before you click whatever action takes you to a page not found and then tell us what you are clicking?



Is it a link you can hover over and see what the Href would be in the browser status area? Or is it a button (like Save)?[/QUOTE]



ok, it is simple to explain, when I edit an order and get to final step, I have 2 choices (buttons) : SAVE or SAVE & CHECKOUT

like here:





It doesn’t matter if I hit save or checkout, what i get is a 404 error: page not found, like here:







What it is supposed to happen is that I get redirected to order details with all changes already done, yet this does not happen, i get a 404 error.

One thing I must add, I can make changes ok, that is not the issue

Sorry, don’t know.

tbirnseth, no problem, you help me a lot and you do not always have to have the answer for all problems us newbies find along the way.



Just let me ask you sth, in order to have a landing page I made this modificatrion:



In core/fn.cart.php on or about line 2119 , I changed


fn_redirect($prefix . INDEX_SCRIPT . "?dispatch=orders.details&order_id=$order_id&confirmation=Y", true);



for this:


fn_redirect($prefix . INDEX_SCRIPT . "?dispatch=pages.view&page_id=20);



Does this modify not only the checkout final step for customers in the store but also checkout final step in the backend when editing? That would explain what happens, right?

I thought I was just modifying step 4 in store’s checkout not in admin panel.:frowning:

Without knowing what version you are running it is difficult to check. But similar code for 2.1.4 is on line 2878 of fn.cart.php and is bracketd by an If(AREA == ‘A’ || $action == ‘repay’ ) which would mean that it would only apply to the admin view or when a customer is repaying an order that was previously declined. Otherwise they would go to the checkout.checkout page (if one page checkout) or checkout.summary (if not one-page checkout).



If what you are wanting to do is to redirect to a custom landing page, I would do this in the checkout controller such as:

addons/my_changes/customer/checkout.post.php

and add detection for the $mode you want to catch (complete?) and then do your redirect there. You should ensure that your landing page includes a {hook name=“checkout:order_confirmation”}{/hook} tag so that you can continue to keep order confirmation scripts in a single location. But if you’re using a ‘page’, you won’t be able to do that and the order data will not be available…

[QUOTE] I am using 2.0.14 and it’s giving me a headache[/QUOTE] :wink:

That’s correct, I am using 2.0.14 and multiple page checkout.

Do you know what to do for this version? I truly thought the modification did not affect admin.

If not there, then where must I change code in order to have a landing page only in the store checkout?:confused:

Looks like things changed in 2.0.15…

Your code should take the user to your ‘page’ for the landing page. But note that anything you have in the hook “orders:confirmation” will not execute nor will any of the current order’s data be available to your template.



Notice that 2 lines above the line you changed is a line that looks like:


fn_set_hook('order_placement_routines', $order_id, $force_notification, $order_info);




So you could make your change without every modifying a core file by creating or adding to addons/my_changes/func.php this function


function fn_my_changes_order_placement_routines($order_id) {
fn_redirect(INDEX_SCRIPT."?dispatch=pages.view&page_id=20");
}


and in addons/my_changes/init.php add or change


register_hooks('order_placement_routines');




When the fn_set_hook() is called in the fn_order_placement_routines() function, your registered hook will be called with the order_id as the argument. In your case, you don’t even need the order_id. When your fn_my_changes_order_placement_routines() is called, you will redirect to your page from there.



Any future upgrade will not require any modifications to keep your change working. Trying to educate, not confuse. But not sure I’m successful! :slight_smile:

[quote name=‘tbirnseth’]

Any future upgrade will not require any modifications to keep your change working. Trying to educate, not confuse. But not sure I’m successful! :-)[/QUOTE]

Yes, I understood what you explained and I appreciate your help. I may not be the best pupil but I make an effort :wink:

I’ll make those changes and hopefully solve the issue. Thanks again!

I restored the changes I made in core folder, now I get no errors when editing yet still do have my landing page.



So I went to addons/my_changes to add the functions as you suggested in order to finally have my landing page and I can not find the files func.php or init.php in addons/my_changes.

Maybe I’m looking in the wrong folder or maybe those files are not there in my version, I do not know.

All I see in addons/my_changes is a file named addon.xml :confused:

By default, the my_changes addon is a “placeholder” or a “stub”. It has no funciontality and they chose not to provide any structure to it for people to use.



Hence, you will have to create the files if they don’t exist. Same goes for the hook template files or anything else you do with any addon.

tbirnseth, I have done as per your advise the following:



I created init.php in my_changes folder and copied the following content:


if ( !defined('AREA') ) { die('Access denied'); }
fn_register_hooks('order_placement_routines');
?>




I had a problem in line 3 and then realized, tbirnseth, it was not register_hooks but fn_register_hooks, after I modified it, I had no problem at all.



I created another file: func.php with the following content:

if ( !defined('AREA') ) { die('Access denied'); }
function fn_my_changes_order_placement_routines($order_id) {
fn_redirect(INDEX_SCRIPT."?dispatch=pages.view&page_id=20");
}
?>




I have the same problem as before, it works for the landing page, I made a test order and was taken to the landing page without any issue but when I edit an order in admin panel, I get a “page not found” error at the end of the editing process, where I should get the order page already modified.



Is there something wrong in the code above, is there anything else I need to add or modify?

What;'s the URL in your address bar when the 404 is generated?

You could bracket the fn_redirect() within a test for the AREA being ‘C’ I.e.


if( AREA == 'C' ) {
fn_redirect(INDEX_SCRIPT."?dispatch=pages.view&page_id=20");
}


This will ensure that if this hook is called from the admin area that it will not redirect. Make sure you have backed out your other changes made prior to adding the hook.



Sorry about the typo. I just type this stuff and don’t syntax check it…

wow! I never noticed the url when I got the 404 error, it is this:

http:/mydomain.com/admin.php?dispatch=pages.view&page_id=20



so it is actually looking for page_id=20 :o



I’m sorry, but I did not understand well your last suggestion. Please, bear with me, I know nothing about codes.

what can I do in order to get the landing page only when customers make orders but not when I edit such orders in admin?

Bracket the redirect function call inside an if statement as shown above.

This will make sure that it only tries to redirect to the pages.view controller when it is in the customer area. Admin will behave normally.



Again, make sure you’ve backed out your other changes to fn.core.php

[quote name=‘tbirnseth’]Bracket the redirect function call inside an if statement as shown above.

This will make sure that it only tries to redirect to the pages.view controller when it is in the customer area. Admin will behave normally.



Again, make sure you’ve backed out your other changes to fn.core.php[/QUOTE]



Thank you very much, your suggestions have helped me a lot. I think it is solved now.