After click add button return to the top of site

pesema

Avatar: pesema

2012-02-08 12:10

Hello,
I have done this modification in file action_client/p_oredrs.php

original code:
// add product to basket
$oOrder->addToBasket( $iProductAdd, $iQuantity );
header( 'Location: '.REDIRECT.$aData['sLinkName'] );
exit;

changed code:
// add product to basket
$oOrder->addToBasket( $iProductAdd, $iQuantity );
$oOrder->generateBasket( $iProductAdd, $iQuantity );
header ('Location: '.$_SERVER['HTTP_REFERER'] );
exit;

It works correctly and after I add product to the basket I am redirect to the same page, but on the top of this page.
I would like to be redirect to the same position from top. On my sites I have more then twenty products above and when I am down on the page and add product to the basket, I am redirect to top and it is very confusing.

Thank you very much
Ivan
QC 4.2

» Quick.Cart v4.x

boboo

Avatar: boboo

2012-02-08 12:57

http://opensolution.org/Quick.Cart/forum/dodaj-do-koszyka-ale-tam-nie-przeskakuj,6568,1.html

The post, which begins with "Mirasie Zelazny"

qc-plugins.kimla.de

pesema

Avatar: pesema

2012-02-08 19:44

thanks for your replay,
but if I add this script and do changes, it doesnt work. If you can, visit http://pesema.cz/pesema/pesema/index.php and try it.

Ivan

boboo

Avatar: boboo

2012-02-08 20:32

Why do you do mistakes even by simple copy&paste?

On your page:
onclick =" window.name = document.documentElement.scrollTop, "

In my hint:
onclick =" window.name = document.documentElement.scrollTop; "

There is no comma after .scrollTop
There is a semicolon ";"

http://qc-plugins.kimla.de

pesema

Avatar: pesema

2012-02-09 10:47

Because I am so stupid.

Unfortunetly I changed comma to semicolon and script doesnt work.

Where I do another mistake?

boboo

Avatar: boboo

2012-02-09 11:10

I just tried. It works.

qc-plugins.kimla.de

pesema

Avatar: pesema

2012-02-09 11:35

I just tried too in chrome, ie9 and mozilla and it doesnt work. When I add product to the baskest I am redirect back to the top of the page.

boboo

Avatar: boboo

2012-02-09 12:30

I tried this only in ie9

qc-plugins.kimla.de

pesema

Avatar: pesema

2012-02-09 13:12

Yes, its true, in ie9 it works fine only sometimes "HTTP_REFERER" return wrong doctype and the page is in adapctive mode.

boboo

Avatar: boboo

2012-02-09 13:43

I made this feature for "nacked" QC.
It works on IE and FF.
Chrome not.
Your QC is... no more "nacked". I saw some js errors on your page. Maybe this is the reason.

qc-plugins.kimla.de

cachousam

Avatar: cachousam

2012-02-10 05:50

Pesema.
Your script is good and suits me perfectly. In fact I only display 5 items per page, so the return to the top is not annoying.
Boboo
I can not understand the logic of yours. But I am persistent and I could do it.
In fact, what is the instruction to write so that when we click on "add to basket", we stay in the same place.
Thank you all.

boboo

Avatar: boboo

2012-02-10 07:41

Yesterday I saw on his page js errors in the statusbar.
Today the page is empty - only background & and some meta.
And I had already the experience: if a piece of js makes errors -> another js scripts may not work properly.
js is, what I don't like. I use this only if there is no possibility to solve any problem with pure php.
In container.tpl in scripts invoking add the:
window.onload=function(){
if(window.name!="")
document.documentElement.scrollTop=window.name;
document.body.scrollTop=window.name;
window.name=0;
}
then in every product on the list in its basket href add:
onclick="window.name=document.documentElement.scrollTop||document.body.scrollTop;"
With document.body... the Chrome is now working with this.
Checked on Win Apache: IE9, newest FF and newest Chrome.
To make this clear: it is working on "nacked and fresh" QC42 Add.
I don't know does it work on systems with installed jQuery or another "must have" gadgets. And I will NOT check it.

qc-plugins.kimla.de

Back to top
about us | contact