Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Faster login with bootstrap modal


Recommended Posts

  • 2 weeks later...
  • Replies 101
  • Created
  • Last Reply

@@burt,

 

found that using PayPal Login with the modal login navbar module, screws up the grid-list view script.

The responsible part is the external script in:

includes/modules/content/login/templates/paypal_login.php:

<script src="https://www.paypalobjects.com/js/external/api.js"></script>

Here the script:


var requirejs,require,define;(function(Y){function H(b){return"[object Function]"===L.call(b)}function I(b){return"[object Array]"===L.call(b)}function x(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function M(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));d-=1);}}function r(b,c){return da.call(b,c)}function i(b,c){return r(b,c)&&b[c]}function E(b,c){for(var d in b)if(r(b,d)&&c(b[d],d))break}function Q(b,c,d,i){c&&E(c,function(c,h){if(d||!r(b,h))i&&"string"!==typeof c?(b[h]||(b[h]={}),Q(b[h],c,d,i)):b[h]=c});return b}function t(b,c){return function(){return c.apply(b,arguments)}}function Z(b){if(!b)return b;var c=Y;x(b.split("."),function(b){c=c[b]});return c}function J(b,c,d,i){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=i;d&&(c.originalError=d);return c}function ea(b){function c(a,g,v){var e,n,b,c,d,j,f,h=g&&g.split("/");e=h;var l=m.map,k=l&&l["*"];if(a&&"."===a.charAt(0))if(g){e=i(m.pkgs,g)?h=[g]:h.slice(0,h.length-1);g=a=e.concat(a.split("/"));for(e=0;g[e];e+=1)if(n=g[e],"."===n)g.splice(e,1),e-=1;else if(".."===n)if(1===e&&(".."===g[2]||".."===g[0]))break;else 0<e&&(g.splice(e-1,2),e-=2);e=i(m.pkgs,g=a[0]);a=a.join("/");e&&a===g+"/"+e.main&&(a=g)}else 0===a.indexOf("./")&&(a=a.substring(2));if(v&&(h||k)&&l){g=a.split("/");for(e=g.length;0<e;e-=1){b=g.slice(0,e).join("/");if(h)for(n=h.length;0<n;n-=1)if(v=i(l,h.slice(0,n).join("/")))if(v=i(v,b)){c=v;d=e;break}if(c)break;!j&&(k&&i(k,b))&&(j=i(k,b),f=e)}!c&&j&&(c=j,d=f);c&&(g.splice(0,d,c),a=g.join("/"))}return a}function d(a){z&&x(document.getElementsByTagName("script"),function(g){if(g.getAttribute("data-requiremodule")===a&&g.getAttribute("data-requirecontext")===j.contextName)return g.parentNode.removeChild(g),!0})}function y(a){var g=i(m.paths,a);if(g&&I(g)&&1<g.length)return d(a),g.shift(),j.require.undef(a),j.require([a]),!0}function f(a){var g,b=a?a.indexOf("!"):-1;-1<b&&(g=a.substring(0,b),a=a.substring(b+1,a.length));return[g,a]}function h(a,g,b,e){var n,u,d=null,h=g?g.name:null,l=a,m=!0,k="";a||(m=!1,a="_@r"+(L+=1));a=f(a);d=a[0];a=a[1];d&&(d=c(d,h,e),u=i(p,d));a&&(d?k=u&&u.normalize?u.normalize(a,function(a){return c(a,h,e)}):c(a,h,e):(k=c(a,h,e),a=f(k),d=a[0],k=a[1],b=!0,n=j.nameToUrl(k)));b=d&&!u&&!b?"_unnormalized"+(M+=1):"";return{prefix:d,name:k,parentMap:g,unnormalized:!!b,url:n,originalName:l,isDefine:m,id:(d?d+"!"+k:k)+b}}function q(a){var g=a.id,b=i(k,g);b||(b=k[g]=new j.Module(a));return b}function s(a,g,b){var e=a.id,n=i(k,e);if(r(p,e)&&(!n||n.defineEmitComplete))"defined"===g&&b(p[e]);else q(a).on(g,b)}function C(a,g){var b=a.requireModules,e=!1;if(g)g(a);else if(x(b,function(g){if(g=i(k,g))g.error=a,g.events.error&&(e=!0,g.emit("error",a))}),!e)l.onError(a)}function w(){R.length&&(fa.apply(F,[F.length-1,0].concat(R)),R=[])}function A(a,g,b){var e=a.map.id;a.error?a.emit("error",a.error):(g[e]=!0,x(a.depMaps,function(e,c){var d=e.id,h=i(k,d);h&&(!a.depMatched[c]&&!b[d])&&(i(g,d)?(a.defineDep(c,p[d]),a.check()):A(h,g,b))}),b[e]=!0)}function B(){var a,g,b,e,n=(b=1E3*m.waitSeconds)&&j.startTime+b<(new Date).getTime(),c=[],h=[],f=!1,l=!0;if(!T){T=!0;E(k,function(b){a=b.map;g=a.id;if(b.enabled&&(a.isDefine||h.push(b),!b.error))if(!b.inited&&n)y(g)?f=e=!0:(c.push(g),d(g));else if(!b.inited&&(b.fetched&&a.isDefine)&&(f=!0,!a.prefix))return l=!1});if(n&&c.length)return b=J("timeout","Load timeout for modules: "+c,null,c),b.contextName=j.contextName,C(b);l&&x(h,function(a){A(a,{},{})});if((!n||e)&&f)if((z||$)&&!U)U=setTimeout(function(){U=0;B()},50);T=!1}}function D(a){r(p,a[0])||q(h(a[0],null,!0)).init(a[1],a[2])}function G(a){var a=a.currentTarget||a.srcElement,b=j.onScriptLoad;a.detachEvent&&!V?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1);b=j.onScriptError;(!a.detachEvent||V)&&a.removeEventListener("error",b,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function K(){var a;for(w();F.length;){a=F.shift();if(null===a[0])return C(J("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));D(a)}}var T,W,j,N,U,m={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},map:{},config:{}},k={},X={},F=[],p={},S={},L=1,M=1;N={require:function(a){return a.require?a.require:a.require=j.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?a.exports:a.exports=p[a.map.id]={}},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){return m.config&&i(m.config,a.map.id)||{}},exports:p[a.map.id]}}};W=function(a){this.events=i(X,a.id)||{};this.map=a;this.shim=i(m.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};W.prototype={init:function(a,b,c,e){e=e||{};if(!this.inited){this.factory=b;if(c)this.on("error",c);else this.events.error&&(c=t(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=c;this.inited=!0;this.ignore=e.ignore;e.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0;j.startTime=(new Date).getTime();var a=this.map;if(this.shim)j.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],t(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=this.map.url;S[a]||(S[a]=!0,j.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var e=this.exports,n=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(H(n)){if(this.events.error)try{e=j.execCb(c,n,b,e)}catch(d){a=d}else e=j.execCb(c,n,b,e);this.map.isDefine&&((b=this.module)&&void 0!==b.exports&&b.exports!==this.exports?e=b.exports:void 0===e&&this.usingExports&&(e=this.exports));if(a)return a.requireMap=this.map,a.requireModules=[this.map.id],a.requireType="define",C(this.error=a)}else e=n;this.exports=e;if(this.map.isDefine&&!this.ignore&&(p[c]=e,l.onResourceLoad))l.onResourceLoad(j,this.map,this.depMaps);delete k[c];this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=this.map,b=a.id,d=h(a.prefix);this.depMaps.push(d);s(d,"defined",t(this,function(e){var n,d;d=this.map.name;var v=this.map.parentMap?this.map.parentMap.name:null,f=j.makeRequire(a.parentMap,{enableBuildCallback:!0,skipMap:!0});if(this.map.unnormalized){if(e.normalize&&(d=e.normalize(d,function(a){return c(a,v,!0)})||""),e=h(a.prefix+"!"+d,this.map.parentMap),s(e,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),d=i(k,e.id)){this.depMaps.push(e);if(this.events.error)d.on("error",t(this,function(a){this.emit("error",a)}));d.enable()}}else n=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),n.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];E(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&delete k[a.map.id]});C(a)}),n.fromText=t(this,function(e,c){var d=a.name,u=h(d),v=O;c&&(e=c);v&&(O=!1);q(u);r(m.config,b)&&(m.config[d]=m.config[b]);try{l.exec(e)}catch(k){throw Error("fromText eval for "+d+" failed: "+k);}v&&(O=!0);this.depMaps.push(u);j.completeLoad(d);f([d],n)}),e.load(a.name,f,n,m)}));j.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){this.enabling=this.enabled=!0;x(this.depMaps,t(this,function(a,b){var c,e;if("string"===typeof a){a=h(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=i(N,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;s(a,"defined",t(this,function(a){this.defineDep(b,a);this.check()}));this.errback&&s(a,"error",this.errback)}c=a.id;e=k[c];!r(N,c)&&(e&&!e.enabled)&&j.enable(a,this)}));E(this.pluginMaps,t(this,function(a){var b=i(k,a.id);b&&!b.enabled&&j.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){x(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};j={config:m,contextName:b,registry:k,defined:p,urlFetched:S,defQueue:F,Module:W,makeModuleMap:h,nextTick:l.nextTick,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=m.pkgs,c=m.shim,e={paths:!0,config:!0,map:!0};E(a,function(a,b){e[b]?"map"===b?Q(m[b],a,!0,!0):Q(m[b],a,!0):m[b]=a});a.shim&&(E(a.shim,function(a,b){I(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=j.makeShimExports(a);c[b]=a}),m.shim=c);a.packages&&(x(a.packages,function(a){a="string"===typeof a?{name:a}:a;b[a.name]={name:a.name,location:a.location||a.name,main:(a.main||"main").replace(ga,"").replace(aa,"")}}),m.pkgs=b);E(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=h(b))});if(a.deps||a.callback)j.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(Y,arguments));return b||a.exports&&Z(a.exports)}},makeRequire:function(a,d){function f(e,c,u){var i,m;d.enableBuildCallback&&(c&&H(c))&&(c.__requireJsBuild=!0);if("string"===typeof e){if(H(c))return C(J("requireargs","Invalid require call"),u);if(a&&r(N,e))return N[e](k[a.id]);if(l.get)return l.get(j,e,a);i=h(e,a,!1,!0);i=i.id;return!r(p,i)?C(J("notloaded",'Module name "'+i+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[i]}K();j.nextTick(function(){K();m=q(h(null,a));m.skipMap=d.skipMap;m.init(e,c,u,{enabled:!0});B()});return f}d=d||{};Q(f,{isBrowser:z,toUrl:function(b){var d=b.lastIndexOf("."),g=null;-1!==d&&(g=b.substring(d,b.length),b=b.substring(0,d));return j.nameToUrl(c(b,a&&a.id,!0),g)},defined:function(b){return r(p,h(b,a,!1,!0).id)},specified:function(b){b=h(b,a,!1,!0).id;return r(p,b)||r(k,b)}});a||(f.undef=function(b){w();var c=h(b,a,!0),d=i(k,b);delete p[b];delete S[c.url];delete X[b];d&&(d.events.defined&&(X[b]=d.events),delete k[b])});return f},enable:function(a){i(k,a.id)&&q(a).enable()},completeLoad:function(a){var b,c,d=i(m.shim,a)||{},h=d.exports;for(w();F.length;){c=F.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);D(c)}c=i(k,a);if(!b&&!r(p,a)&&c&&!c.inited){if(m.enforceDefine&&(!h||!Z(h)))return y(a)?void 0:C(J("nodefine","No define call for "+a,null,[a]));D([a,d.deps||[],d.exportsFn])}B()},nameToUrl:function(a,b){var c,d,h,f,j,k;if(l.jsExtRegExp.test(a))f=a+(b||"");else{c=m.paths;d=m.pkgs;f=a.split("/");for(j=f.length;0<j;j-=1)if(k=f.slice(0,j).join("/"),h=i(d,k),k=i(c,k)){I(k)&&(k=k[0]);f.splice(0,j,k);break}else if(h){c=a===h.name?h.location+"/"+h.main:h.location;f.splice(0,j,c);break}f=f.join("/");f+=b||(/\?/.test(f)?"":".js");f=("/"===f.charAt(0)||f.match(/^[\w\+\.\-]+:/)?"":m.baseUrl)+f}return m.urlArgs?f+((-1===f.indexOf("?")?"?":"&")+m.urlArgs):f},load:function(a,b){l.load(j,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ha.test((a.currentTarget||a.srcElement).readyState))P=null,a=G(a),j.completeLoad(a.id)},onScriptError:function(a){var b=G(a);if(!y(b.id))return C(J("scripterror","Script error",a,[b.id]))}};j.require=j.makeRequire();return j}var l,w,A,D,s,G,P,K,ba,ca,ia=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ja=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,aa=/\.js$/,ga=/^\.\//;w=Object.prototype;var L=w.toString,da=w.hasOwnProperty,fa=Array.prototype.splice,z=!!("undefined"!==typeof window&&navigator&&document),$=!z&&"undefined"!==typeof importScripts,ha=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,V="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),B={},q={},R=[],O=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(H(requirejs))return;q=requirejs;requirejs=void 0}"undefined"!==typeof require&&!H(require)&&(q=require,require=void 0);l=requirejs=function(b,c,d,y){var f,h="_";!I(b)&&"string"!==typeof b&&(f=b,I(c)?(b=c,c=d,d=y):b=[]);f&&f.context&&(h=f.context);(y=i(B,h))||(y=B[h]=l.s.newContext(h));f&&y.configure(f);return y.require(b,c,d)};l.config=function(b){return l(b)};l.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=l);l.version="2.1.2";l.jsExtRegExp=/^\/|:|\?|\.js$/;l.isBrowser=z;w=l.s={contexts:B,newContext:ea};l({});x(["toUrl","undef","defined","specified"],function(b){l[b]=function(){var c=B._;return c.require[b].apply(c,arguments)}});if(z&&(A=w.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))A=w.head=D.parentNode;l.onError=function(b){throw b;};l.load=function(b,c,d){var i=b&&b.config||{},f;if(z)return f=i.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),f.type=i.scriptType||"text/javascript",f.charset="utf-8",f.async=!0,f.setAttribute("data-requirecontext",b.contextName),f.setAttribute("data-requiremodule",c),f.attachEvent&&!(f.attachEvent.toString&&0>f.attachEvent.toString().indexOf("[native code"))&&!V?(O=!0,f.attachEvent("onreadystatechange",b.onScriptLoad)):(f.addEventListener("load",b.onScriptLoad,!1),f.addEventListener("error",b.onScriptError,!1)),f.src=d,K=f,D?A.insertBefore(f,D):A.appendChild(f),K=null,f;$&&(importScripts(d),b.completeLoad(c))};z&&M(document.getElementsByTagName("script"),function(b){A||(A=b.parentNode);if(s=b.getAttribute("data-main"))return q.baseUrl||(G=s.split("/"),ba=G.pop(),ca=G.length?G.join("/")+"/":"./",q.baseUrl=ca,s=ba),s=s.replace(aa,""),q.deps=q.deps?q.deps.concat(s):[s],!0});define=function(b,c,d){var i,f;"string"!==typeof b&&(d=c,c=b,b=null);I(c)||(d=c,c=[]);!c.length&&H(d)&&d.length&&(d.toString().replace(ia,"").replace(ja,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c));if(O){if(!(i=K))P&&"interactive"===P.readyState||M(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),i=P;i&&(b||(b=i.getAttribute("data-requiremodule")),f=B[i.getAttribute("data-requirecontext")])}(f?f.defQueue:R).push([b,c,d])};define.amd={jQuery:!0};l.exec=function(b){return eval(b)};l(q)}})(this);if(typeof paypal!=='object'){paypal={};}
(function(window,document,undefined){'use strict';var api='',scripts=document.getElementsByTagName('script'),noop=function(){},noImpl=function(){throw new Error('Not Implemented');},console=window.console,i=0;if(console===undefined){console=window.console={};api='log,debug,info,warn,error,assert,dir,dirxml,count,trace,group,groupEnd,time,timeEnd,profile,profileEnd'.split(',');i=api.length-1;for(;i>-1;i--){console[api[i]]=noop;}}
paypal.use=(function(){var baseUrl=scripts[scripts.length-1].src.replace(/[^\/]*$/,'');if(typeof require!=='undefined'){return require.config({context:'paypal',baseUrl:baseUrl});}
return noImpl;}());paypal.getElementsByAttribute=(function(modern){if(modern){return function(attr){var elems=document.body.querySelectorAll('['+attr+']'),match=[],i=0;for(i=elems.length-1;i>-1;i--){match.push(elems[i]);}
return match;};}
return function(attr){var elems=document.body.getElementsByTagName('*'),match=[],i=0;for(i=elems.length-1;i>-1;i--){if(elems[i].getAttribute(attr)){match.push(elems);}}
return match;};}(document.querySelectorAll));}(window,document));(function(){"use strict";var ppEles=paypal.getElementsByAttribute('data-paypal'),funcs=[],attrs=[],params={},execFunc=null,i=0,j=0;for(i=0;i<ppEles.length;i++){funcs=ppEles[i].getAttribute('data-paypal').split(':');execFunc=null;params={};attrs=ppEles[i].attributes;for(j=0;j<attrs.length;j++){if(/^data-pparam-.*/.test(attrs[j].name)){params[attrs[j].name.replace(/data-pparam-/,'')]=attrs[j].value;}}
params.containerelement=ppEles[i];}
paypal.use(funcs,function(){for(i=0;i<arguments.length;i++){execFunc=(arguments[i]&&arguments[i].hasOwnProperty('go')&&typeof arguments[i].go==='function')?arguments[i].go:execFunc;execFunc=(arguments[i]&&arguments[i].hasOwnProperty('render')&&typeof arguments[i].render==='function')?arguments[i].render:execFunc;if(execFunc){execFunc(params);}}});})();

Any suggestions how to fix it.

 

Thank you

Link to comment
Share on other sites

found that using PayPal Login with the modal login navbar module, screws up the grid-list view script.

 

@@raiwa

 

Try the changes below inside "catalog\includes\modules\content\login\templates\paypal_login.php"

 

replace:

<script type="text/javascript" src="https://www.paypalobjects.com/js/external/api.js"></script>
<script type="text/javascript">
paypal.use( ["login"], function(login) {
  login.render ({

<?php
  if ( OSCOM_APP_PAYPAL_LOGIN_STATUS == '0' ) {
    echo '    "authend": "sandbox",';
  }

  if ( OSCOM_APP_PAYPAL_LOGIN_THEME == 'Neutral' ) {
    echo '    "theme": "neutral",';
  }
?>

    "locale": "<?php echo $cm_paypal_login->_app->getDef('module_login_language_locale'); ?>",
    "appid": "<?php echo (OSCOM_APP_PAYPAL_LOGIN_STATUS == '1') ? OSCOM_APP_PAYPAL_LOGIN_LIVE_CLIENT_ID : OSCOM_APP_PAYPAL_LOGIN_SANDBOX_CLIENT_ID; ?>",
    "scopes": "<?php echo implode(' ', $use_scopes); ?>",
    "containerid": "PayPalLoginButton",
    "returnurl": "<?php echo str_replace('&', '&', tep_href_link(FILENAME_LOGIN, 'action=paypal_login', 'SSL', false)); ?>"
  });
});
</script>

with:

<?php
if ( OSCOM_APP_PAYPAL_LOGIN_STATUS == '0' ) {
  $authend = 'sandbox';
}
if ( OSCOM_APP_PAYPAL_LOGIN_THEME == 'Neutral' ) {
  $theme = 'neutral';
}

$paypal_login_script = '<script type="text/javascript">
paypal.use( ["login"], function(login) {
  login.render ({
    "authend": "' . $authend . '",
    "theme": "' . $theme . '",
    "locale": "' . $cm_paypal_login->_app->getDef('module_login_language_locale') . '",
    "appid": "' . (OSCOM_APP_PAYPAL_LOGIN_STATUS == '1' ? OSCOM_APP_PAYPAL_LOGIN_LIVE_CLIENT_ID : OSCOM_APP_PAYPAL_LOGIN_SANDBOX_CLIENT_ID) . '",
    "scopes": "' . implode(' ', $use_scopes) . '",
    "containerid": "PayPalLoginButton",
    "returnurl": "' . str_replace('&', '&', tep_href_link(FILENAME_LOGIN, 'action=paypal_login', 'SSL', false)) . '"
  });
});
</script>' . "\n";

$oscTemplate->addBlock('<script type="text/javascript" src="https://www.paypalobjects.com/js/external/api.js"></script>' . "\n", 'footer_scripts');
$oscTemplate->addBlock($paypal_login_script, 'footer_scripts');
?>

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@raiwa

 

Apologies. The above changes are for the new PayPal App.

 

For the standard paypal login use below.

 

replace:

<script src="https://www.paypalobjects.com/js/external/api.js"></script>
<script>
paypal.use( ["login"], function(login) {
  login.render ({

<?php
  if ( MODULE_CONTENT_PAYPAL_LOGIN_SERVER_TYPE == 'Sandbox' ) {
    echo '    "authend": "sandbox",';
  }

  if ( MODULE_CONTENT_PAYPAL_LOGIN_THEME == 'Neutral' ) {
    echo '    "theme": "neutral",';
  }

  if ( defined('MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE') && tep_not_null(MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE) ) {
    echo '    "locale": "' . MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE . '",';
  }
?>

    "appid": "<?php echo MODULE_CONTENT_PAYPAL_LOGIN_CLIENT_ID; ?>",
    "scopes": "<?php echo implode(' ', $use_scopes); ?>",
    "containerid": "PayPalLoginButton",
    "returnurl": "<?php echo str_replace('&', '&', tep_href_link(FILENAME_LOGIN, 'action=paypal_login', 'SSL', false)); ?>"
  });
});
</script>

with:

<?php
if ( MODULE_CONTENT_PAYPAL_LOGIN_SERVER_TYPE == 'Sandbox' ) {
  $authend = 'sandbox';
}
if ( MODULE_CONTENT_PAYPAL_LOGIN_THEME == 'Neutral' ) {
  $theme = 'neutral';
}
if ( defined('MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE') && tep_not_null(MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE) ) {
  $locale = MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE;
}

$paypal_login_script = '<script>
paypal.use( ["login"], function(login) {
  login.render ({
    "authend": "' . $authend . '",
    "theme": "' . $theme . '",
    "locale": "' . $locale . '",
    "appid": "' . MODULE_CONTENT_PAYPAL_LOGIN_CLIENT_ID . '",
    "scopes": "' . implode(' ', $use_scopes) . '",
    "containerid": "PayPalLoginButton",
    "returnurl": "' . str_replace('&', '&', tep_href_link(FILENAME_LOGIN, 'action=paypal_login', 'SSL', false)) . '"
  });
});
</script>' . "\n";

$oscTemplate->addBlock('<script src="https://www.paypalobjects.com/js/external/api.js"></script>' . "\n", 'footer_scripts');
$oscTemplate->addBlock($paypal_login_script, 'footer_scripts');
?>

I think you get the idea :)

 

tested with the PayPal App version and that seemed to fix the grid-list view problem

 

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@auzStar,

 

Thank you very much, works perfect.

 

There is another issue, the return URL in paypal login is defined for login.php:

    "returnurl": "' . str_replace('&', '&', tep_href_link(FILENAME_LOGIN, 'action=paypal_login', 'SSL', false)) . '"

I first thought to change "FILENAME_LOGIN" to "$PHP_SELF", but it seems this is needed for the advanced security check to be the same like specified in the PayPal login app.

 

To get redirected back to the page where the modal login is used, we need to add "$navigation->set_snapshot()" to the modal login snippet:

In includes/modules/content/navbar/templates/navbar.php

            	$navigation->set_snapshot();
            	echo '<a style="cursor:pointer;" data-toggle="modal" data-target="#ModalLogin">' . HEADER_ACCOUNT_LOGIN . '</a>';?>

and add global $navigation in: includes/modules/content/navbar/cm_navbar.php

      global $customer_first_name, $navigation;

regards

Rainer

Link to comment
Share on other sites

@@raiwa 

 

To get redirected back to the page where the modal login is used, we need to add "$navigation->set_snapshot()" to the modal login snippet:

In includes/modules/content/navbar/templates/navbar.php

            	$navigation->set_snapshot();
            	echo '<a style="cursor:pointer;" data-toggle="modal" data-target="#ModalLogin">' . HEADER_ACCOUNT_LOGIN . '</a>';?>

 

Rainer, won't that set a snapshot on every page load? could conflict with other snapshots that are set i.e for write reviews, product notifications etc.

 

 

Also, after looking closer at the modified paypal login script provided earlier, below is probably a more correct way of handling the "if" statements.

<?php
$paypal_login_script = '<script>
paypal.use( ["login"], function(login) {
  login.render ({' .
    ( MODULE_CONTENT_PAYPAL_LOGIN_SERVER_TYPE == 'Sandbox' ? '"authend": "sandbox",' : '' ) .
    ( MODULE_CONTENT_PAYPAL_LOGIN_THEME == 'Neutral' ? '"theme": "neutral",' : '' ) .
    ( defined('MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE') && tep_not_null(MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE) ? '"locale": "' . MODULE_CONTENT_PAYPAL_LOGIN_LANGUAGE_LOCALE . '",'  : '' ) . '
    "appid": "' . MODULE_CONTENT_PAYPAL_LOGIN_CLIENT_ID . '",
    "scopes": "' . implode(' ', $use_scopes) . '",
    "containerid": "PayPalLoginButton",
    "returnurl": "' . str_replace('&', '&', tep_href_link(FILENAME_LOGIN, 'action=paypal_login', 'SSL', false)) . '"
  });
});
</script>' . "\n";

$oscTemplate->addBlock('<script src="https://www.paypalobjects.com/js/external/api.js"></script>' . "\n", 'footer_scripts');
$oscTemplate->addBlock($paypal_login_script, 'footer_scripts');
?>

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@auzStar,

 

Yes, you are right, It should be included in the paypal login module and only used when needed.

Can you check this:

includes/modules/content/login/cm_paypal_login.php:

    function execute() {
      global $HTTP_GET_VARS, $oscTemplate, $navigation;
      $navigation->set_snapshot();

I have my sandbox paypal login spoiled with the redirect url check and can't check it right now with my develop installation:-)

 

Thank you

Rainer

Link to comment
Share on other sites

@@auzStar,

 

Could get my paypal login sandbox to work again.

I found that this works for me. Tested with standard and SEO URLs:

    function execute() {
      global $HTTP_GET_VARS, $oscTemplate;
      global $PHP_SELF, $request_type, $navigation;
      if ( $PHP_SELF != 'login.php') $navigation->set_snapshot(array('mode' => $request_type, 'page' => $PHP_SELF, 'get' => $HTTP_GET_VARS));

Could you confirm.

 

Thank you and kind regards

Rainer

Link to comment
Share on other sites

@@raiwa

 

Could you confirm.

 

Thank you and kind regards

Rainer

 

 Sure, will do :thumbsup:

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@raiwa

 

@@auzStar,

 

Could get my paypal login sandbox to work again.

I found that this works for me. Tested with standard and SEO URLs:

    function execute() {
      global $HTTP_GET_VARS, $oscTemplate;
      global $PHP_SELF, $request_type, $navigation;
      if ( $PHP_SELF != 'login.php') $navigation->set_snapshot(array('mode' => $request_type, 'page' => $PHP_SELF, 'get' => $HTTP_GET_VARS));

Could you confirm.

 

Thank you and kind regards

Rainer

 

 

Rainer,

 

The snapshot works OK when doing a straight forward login from the navbar in regards to keeping you on the current page where the modal login is used.

 

Also OK when logging via modal from within the shopping cart page using the checkout button.

 

But when you click "No thanks" in the "Login with Paypal" box you will be redirected away from your current page to the standard login page.  :(

 

P.S. I noticed that there are some return_url/redirect_uri pointing to FILENAME_LOGIN inside cm_paypal_login.php.

 

Back to the drawing board  :-  :D

 

(Note These results were the same using "Login with Paypal" for either the Paypal App version and the standard Paypal.)

 

 

cheers

 

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@auzStar,

 

Thank you for testing. I believe the percentage of users who will find that text link might be <0.01% (I wasn't aware until now that it exists, always just closed the window to cancel).

 

Here the trick:

Still in includes/modules/content/login/cm_paypal_login.php

at the end of the "preLogin" function,

FIND:

      echo '<script>window.opener.location.href="' . str_replace('&', '&', $return_url) . '";window.close();</script>';

REPLACE BY:

      if ( isset($response['email']) ) {
      	echo '<script>window.opener.location.href="' . str_replace('&', '&', $return_url) . '";window.close();</script>';
      } else {
      	echo '<script>window.close();</script>';
      }

this should do it.

 

regards

Rainer

Link to comment
Share on other sites

Have made some changes to the way this works, improvements I hope :)

 

Have recreated Lambros's login modal module, mainly so that the modal login can now be turned on/off. It also contains the javascript/ajax code which is used to set the snapshot pre login modal appearing (fired onclick). Have changed the installation location of the module to the header instead of the footer, to fix an issue where the modal login display was not formatting the correct styling to the titles, to look the same as the actual login page.

 

To use this new version you'll need to undo any changes already made, just work through from the begining of the thread, or compare your files with the new changes required in the download (attached) but beware that some earlier changes have been discarded such as the redirect_login.php file. (Make sure you uninstall Lambros's earlier login modal module if you have this installed and remove the files). More info in the dowload package.

 

set_snaptshot is now only called as needed via ajax, ie when modal popup is called with onclick event. So the snapshot is set before the modal pops up, snapping the current page in view or the redirect-to page depending on the link/button that was clicked. This snapshot also works for the "Login with PayPal", if used, (both PayPal App version and the Standard Paypal version which is included with osCommerce).

 

Rainer's set_snapshot addition in the cm_paypal_login.php is not required since the snapshot is already set via ajax pre modal login appearing, but Rainer's change to fix the "No thanks" problem works well as now it just closes the "Login with PayPal" window (with login modal still sitting there) instead of re-direting away from current page to the normal login page.

 

Haven't made any change to the login and create account links in the footer since it's unlikely that they would be used.

 

If customers still happen to stumble across the standard login page then the login modal is deactivated, due to an issue where 2 "Login with Paypal" buttons would appear. When the login modal is deactivated/disabled all buttons/links function as normal.

 

I've incorporated much of what has been discussed in this thread. Thanks to all contributors.

 

Still need to implement in other links that require login ie write reviews, notifications.

 

Still needs to be tested with SSL enabled.

 

NOTE: some changes to core files required.

 

cheers

login_modal_module.zip

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

Hello Dominic @@auzStar,

 

Great! Just tested and all works fine.

 

- tested with SSL on local test installation under XAMPP

- tested with guest checkout (

and product_reviews.php:

  // if the customer is not logged on, pop-up the login modules
  	if ( !tep_session_is_registered('customer_id') && defined('MODULE_CONTENT_HEADER_MODAL_STATUS') && (MODULE_CONTENT_HEADER_MODAL_STATUS == 'True') ) {
  		?>
  			<div class="col-xs-6 text-right"><?php echo tep_draw_button(IMAGE_BUTTON_WRITE_REVIEW, 'glyphicon glyphicon-comment', tep_href_link('#'), 'primary', array('params' => 'data-redirect_page="product_reviews_write" data-toggle="modal" data-target="#ModalLogin"'), 'btn-success'); ?></div>
    	<?php
		} else {
			?>
    		<div class="col-xs-6 text-right"><?php echo tep_draw_button(IMAGE_BUTTON_WRITE_REVIEW, 'glyphicon glyphicon-comment', tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, tep_get_all_get_params()), 'primary', NULL, 'btn-success'); ?></div>
    			<?php
		}

See it on my develop store (reviews and notifications are not in use there):

http://www.sarplataygemas.com/sarplataygemasbs/''>http://www.sarplataygemas.com/sarplataygemasbs/'>http://www.sarplataygemas.com/sarplataygemasbs/

 

regards

Rainer

Link to comment
Share on other sites

@@raiwa

 

only change: I still like more the large pop up: templates/modal.php:   <div class="modal-dialog modal-lg">

 

I noticed one issue: if the header module is loaded first, before my store logo, all other header modules do not show. Loading it at any point blow the store logo all works fine. I'll have a deeper look on this tomorrow.

 

Rainer,

Thanks for testing.

We could probably include an option in the login modal module to select the modal size, user preference.  :)

How did you go with the "header module loaded first" issue? I wasn't able to replicate.

 

Trying something different again. :D

I'm attempting to get the links/buttons to fire the login modal without actually modifying each ones code (no core code changes (w00t)), using jquery/javascript. Have successfully tested with "Tell a friend (Share via E-mail)", "Notifications" and "Notify me of updates" links on the "Product Notifications" and "Product Social Bookmarks" box modules (which are links not included in the original modifications, so should have clean code). 

 

If you want to test, enable the "Product Notifications" and "Product Social Bookmarks" box modules and make sure "E-mail" is enabled in "Social Bookmarks" modules. Also set Allow Guest To Tell A Friend to false in "admin->config->my store". (It's assumed that you have downloaded and followed the instructions in the zip file from above post, but not made the changes to bm_products_notifications.php from Rainer's post above or changes to bm_product_social_bookmarks.php).

 

Tested in IE11, latest Chrome and Firefox.

 

Needs to be tested with SSL enabled again.

 

(modifications are required to the "Login Modal" module code as per below but no need to remove/re-install the module)

 

add $request_type to globals in "catalog\includes\modules\content\header\cm_header_modal.php":

    function execute() {
      global $oscTemplate, $PHP_SELF, $request_type;

add this code under the existing script inside "catalog\includes\modules\content\header\templates\modal.php":

(this addition will allow the existing script to work on the manually coded link changes done previously)

<?php
if ( !tep_session_is_registered('customer_id') && defined('MODULE_CONTENT_HEADER_MODAL_STATUS') && (MODULE_CONTENT_HEADER_MODAL_STATUS == 'True') ) {
?>

<script>
$(function() {

  var tell_a_friend = "<?php echo tep_href_link('tell_a_friend.php', 'products_id=' . $_GET['products_id']) ?>";
  if ($("a[href='"+tell_a_friend+"']").is(":visible") && "<?php echo ALLOW_GUEST_TO_TELL_A_FRIEND == 'false' ?>") {
    $("a[href='"+tell_a_friend+"']").click(function(e) {
      e.preventDefault();
      set_snapshot('tell_a_friend.php');
      show_login_modal();
    });
  }

  var account_notifications = "<?php echo tep_href_link('account_notifications.php') ?>";
  if ($("a[href='"+account_notifications+"']").is(":visible")) {
    $("a[href='"+account_notifications+"']").click(function(e) {
      e.preventDefault();
      set_snapshot('account_notifications.php');
      show_login_modal();
    });
  }

  var product_notify = "<?php echo tep_href_link($PHP_SELF, tep_get_all_get_params(array('action')) . 'action=notify') ?>";
  product_notify = product_notify.replace(/&/g, '&');
  if ($("a[href='"+product_notify+"']").is(":visible")) {
    $("a[href='"+product_notify+"']").click(function(e) {
      e.preventDefault();
      set_snapshot("<?php echo $PHP_SELF ?>", {action: "notify"}, "<?php echo $request_type ?>");
      show_login_modal();
    });
  }

});

function set_snapshot(redirect_page, redirect_vars, redirect_ssl) {
  var redirect_vars = redirect_vars || {};
  redirect_vars = $.extend(<?php echo json_encode($_GET) ?>, redirect_vars);
  var redirect_ssl = redirect_ssl || '';
  $.ajax({ type: "GET", dataType: "json", url: "set_snapshot.php", data: {'redirect_ssl': redirect_ssl, 'redirect_page': redirect_page, 'redirect_vars': redirect_vars} });
}

function show_login_modal() {
  $('#ModalLogin').modal('show');
}
</script>

<?php
}
?>

replace the contents of the "catalog\set_snapshot.php" file with:

<?php
require('includes/application_top.php');

$navigation->set_snapshot( array('mode' => (isset($_GET['redirect_ssl']) && tep_not_null($_GET['redirect_ssl'])? $_GET['redirect_ssl'] : 'SSL'), 'page' => $_GET['redirect_page'], 'get' => $_GET['redirect_vars']) );

require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

Trying something different again. :D

I'm attempting to get the links/buttons to fire the login modal without actually modifying each ones code (no core code changes (w00t)), using jquery/javascript. Have successfully tested with "Tell a friend (Share via E-mail)", "Notifications" and "Notify me of updates" links on the "Product Notifications" and "Product Social Bookmarks" box modules. 

 

More changes.... :P   

 

Continuing from my previous post, I've changed this so that now it's easier to install, no code changes required.

 

I guess this started off as just a simple login modal for checkout shipping and navbar login, but I thought it would be good to get the login modal to popup for any link/button that requires the customer to login.

 

Have now included all links that require login (let me know if I've missed any). Page snapshot is still set via javascript/ajax pre login modal appearing.

 

Works like the standard login in that you are re-directed to the page you were trying to access before logging in, ie write review, checkout etc.

When login via the navbar you stay on the current page, unless the current page is logoff, create account or the standard login page, in which case you get re-directed to index. The page snapshot also works for the "Login with PayPal" if used.

 

There are major differences with this version so first you need to undo any previous changes already made, since the modifications to the links are no longer required. (Make sure you uninstall any previous login modal module if installed and remove the files). More info in the download package.

 

Note: I have applied the login modal to work with the original navbar, where Login and the other account links appear under "My Account".

 

features:

popup login modal can be turned on/off

login modal size can be selected normal/large

 

links that activate the login modal when customer is not signed in are:

login - in navbar->My Account->Login, footer, index page and create account page

my account - in navbar->My Account->My Account and header buttons

other account links - in navbar->My Account (My Orders, My Address Book, My Password)

checkout - in navbar, header buttons & shopping cart

account notification and product notifications in the product notifications box module

tell a friend in the Product Social Bookmarks box module

write review on the product reviews page

and if installed, write testimonial on the testimonials page and in the testimonials box module

(customer testimonials is currently commented out in the module template javascript section)

 

Tested with SSL.

login_modal_module_v2.zip

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@auzStar

Hi Dom

 

Wonderfull,wonderfull adon. just what I want. Installed it. Works like  treat.

 

Just one thing, I see in the admin > contents, the Login Modal shows twice. in the "Install Modules' So I installed 1 and left the other in "Install Modules". Maybe I missed something in the instructions.

 

Cheers, and thanks again.

 

Grandpa

Link to comment
Share on other sites

@@grandpaj

 

Just one thing, I see in the admin > contents, the Login Modal shows twice. in the "Install Modules' So I installed 1 and left the other in "Install Modules". Maybe I missed something in the instructions.

 

Hi John,

 

You may have had one of the previous login modal modules still sitting in "Install Modules". Although I had steps in the instructions to remove previous login module (and delete files), you may not have been aware that one was still sitting in there.

 

What I would do is also remove the one installed (not delete, just "Remove Module"), so that 2 will appear in the "Install Modules", then delete 3 files as per below: 

 

depending on which previous version you had installed, the 3 module files to be deleted may be located as per below or the next group of 3 files

 

HERE:
catalog\includes\modules\content\footer\cm_footer_modal.php
catalog\includes\modules\content\footer\templates\modal.php
catalog\includes\languages\english\modules\content\footer\cm_footer_modal.php

 

OR HERE:
catalog\includes\modules\content\header\cm_header_modal.php
catalog\includes\modules\content\header\templates\modal.php
catalog\includes\languages\english\modules\content\header\cm_header_modal.php

 

 

Make sure these 5 files exist for the new one (from download package):

 

catalog\ext\modules\content\header\login_modal\set_snapshot.php
catalog\ext\modules\content\header\login_modal\clear_snapshot.php

catalog\includes\modules\content\header\cm_header_login_modal.php
catalog\includes\modules\content\header\templates\login_modal.php
catalog\includes\languages\english\modules\content\header\cm_header_login_modal.php

 

Once you've done that, go back to "Install Modules" (my need to refresh page) where should now see only one. Install that one.

 

Let me know how you go.

 

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@auzStar

 

Hi Dom

 

You  were spot on. I didn't realize that I had an "old" copy on board, thought I had removed  it. Your instructions did the trick.

 

Many thanks

 

John

Link to comment
Share on other sites

  • 2 months later...

Hi guys,

 

I was thinking of packaging this up and uploading to the add-ons page.

 

Has anyone found any issues with it by before I do. Seems to work well as far as I can see.

 

@@grandpaj

@@raiwa

I noticed you have this running on your sites :thumbsup:

 

cheers

 

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@auzStar

 

Hi Dom

 

Seems to run without problem. Only thing is if someone puts in wrong email address instead of giving them another chance it goes straight to the LogIn Create Account page, otherwise all seems good

 

Cheers

 

Grandpa

Link to comment
Share on other sites

@@auzStar

 

Hi Dom

 

Seems to run without problem. Only thing is if someone puts in wrong email address instead of giving them another chance it goes straight to the LogIn Create Account page, otherwise all seems good

 

Cheers

 

Grandpa

 

@@grandpaj

 

Thanks for your feedback John.

 

I don't think that re-directing to the normal login page after an incorrect login attempt is a big issue. It's not really a bug.

The reason this happens is because the login modal pulls in code from the login module and that's where the login details are processed. It's a normal function of the login module.

 

It's definitely something to be looked at though. It can sit on the back burner for now.

 

cheers

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

  • 2 months later...

As per the comments in this topic here http://www.oscommerce.com/forums/topic/408457-suspected-configurephp-incorrectly-set-up/page-2#entry1735014, if you wish to use the Login Modal then the best option for this is to enable SSL for your entire store.

 

The reason is that the Login Modal needs to be fired from a secure SSL page (i.e. https://) to ensure that the login credentials are secured.
Some help (samples), on enabling full SSL for your store, is provided further below.
 
According to this topic http://www.oscommerce.com/forums/topic/397760-going-ssl/ going full SSL is suggested anyway. Many major sites have gone this way.

 

Testing (on a non fully SSL'd site) I was able to secure/encrypt the Login Modal (when fired from the current non-ssl page) by accessing a secure (SSL) page in the background via ajax/javascript, where programs such as Wireshark proved that the Login Modal content was encrypted, but this is still not a good solution. Browser/developer tools still give security warnings since it is still being fired from a non-secured page initially, hence a man-in-the-middle attack is still possible.
 
For those that still wish to use this add-on (I suggest only on a fully secured site) I have attached version 2.1 for download.
I have added code so that now the focus will be on the e-mail address input field when the login modal appears (previously there was no focus) and have made other minor corrections/code improvements.
 
Below is an example of enabling full SSL that I have setup on a test site. Use this as a guide only as you may need professional assistance depending on your site setup. Below is a link to the test site which uses the Login Modal. (please ignore certificate warnings as this test site only uses self-signed certificates)
 
Test site:
https://www.auzcommerce.com.au/osc234bs_test_sec/index.php
 
The below configure.php files show main settings for ssl/https
 
Store:

  define('HTTP_SERVER', 'https://www.auzcommerce.com.au');
  define('HTTPS_SERVER', 'https://www.auzcommerce.com.au');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', 'auzcommerce.com.au');
  define('HTTPS_COOKIE_DOMAIN', 'auzcommerce.com.au');
  define('HTTP_COOKIE_PATH', '/osc234bs_test_sec/');
  define('HTTPS_COOKIE_PATH', '/osc234bs_test_sec/');
  define('DIR_WS_HTTP_CATALOG', '/osc234bs_test_sec/');
  define('DIR_WS_HTTPS_CATALOG', '/osc234bs_test_sec/');

 
Admin:

  define('HTTP_SERVER', 'https://www.auzcommerce.com.au');
  define('HTTPS_SERVER', 'https://www.auzcommerce.com.au');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', 'auzcommerce.com.au');
  define('HTTPS_COOKIE_DOMAIN', 'auzcommerce.com.au');
  define('HTTP_COOKIE_PATH', '/osc234bs_test_sec/YOURADMIN');
  define('HTTPS_COOKIE_PATH', '/osc234bs_test_sec/YOURADMIN');
  define('HTTP_CATALOG_SERVER', 'https://www.auzcommerce.com.au');
  define('HTTPS_CATALOG_SERVER', 'https://www.auzcommerce.com.au');
  define('ENABLE_SSL_CATALOG', 'true');
  define('DIR_FS_DOCUMENT_ROOT', '/home/YOURHOMEDIR/public_html/osc234bs_test_sec/');
  define('DIR_WS_ADMIN', '/osc234bs_test_sec/YOURADMIN/');
  define('DIR_WS_HTTPS_ADMIN', '/osc234bs_test_sec/YOURADMIN/');
  define('DIR_FS_ADMIN', '/home/YOURHOMEDIR/public_html/osc234bs_test_sec/YOURADMIN/');
  define('DIR_WS_CATALOG', '/osc234bs_test_sec/');
  define('DIR_WS_HTTPS_CATALOG', '/osc234bs_test_sec/');
  define('DIR_FS_CATALOG', '/home/YOURHOMEDIR/public_html/osc234bs_test_sec/');

 
.htaccess file (to force https when there are attempts to use http)
(remove/add # as applicable)

#-- NOTE: This .htaccess file is located in the root folder i.e. public_html


#-- Make sure you have a RewriteEngine on
RewriteEngine on


######### START -> Rules to force a redirect from their original location in HTTP, to the same location but using HTTPS.
#-- i.e.  http://www.example.com/foo/ will transform to https://www.example.com/foo/

#-- Having this setup (along with your configure.php files) will ensure that any attempt to access your store via http will be forced to https
#-- i.e old bookmark links using http and typing http in browser address bar 

# ***** Shared hosting may require this version (NOTE: if this version is used ensure to comment out or remove the non-shared version below)

#-- If SERVER_PORT connection is 80 (HTTP) then apply the rule to convert to HTTPS
#RewriteCond %{SERVER_PORT} 80
#-- NOTE: Enter your https server in place of www.auzcommerce.com.au below
#-- NOTE: Enter your catalog name in place of osc234bs_test_sec below
#-- Use this rule when your catalog is in a sub-folder i.e. /osc234bs_test_sec/
#RewriteRule ^osc234bs_test_sec/(.*)$ https://www.auzcommerce.com.au/osc234bs_test_sec/$1 [R=301,L]
#-- Use this rule instead of above rule if your catalog is in the root /
#RewriteRule ^(.*)$ https://www.auzcommerce.com.au/$1 [R=301,L]

# ***** END Shared hosting

# ***** Non-shared (VPS) hosting can use this version (NOTE: if this version is used ensure to comment out or remove the shared version above) 

#-- This checks to make sure the connection is not already HTTPS
RewriteCond %{HTTPS} !=on
#-- Then apply the rules below to redirect users from their original HTTP location, to the same location but using HTTPS.
#-- NOTE: Enter your https server in place of www.auzcommerce.com.au below
#-- NOTE: Enter your catalog name in place of osc234bs_test_sec below
#-- Use this rule when your catalog is in a sub-folder i.e. /osc234bs_test_sec/
RewriteRule ^osc234bs_test_sec/?(.*) https://www.auzcommerce.com.au/osc234bs_test_sec/$1 [R=301,L]
#-- Use this rule instead of above rule if your catalog is in the root /
#RewriteRule ^/?(.*) https://www.auzcommerce.com.au/$1 [R=301,L]

# ***** END Non-shared (VPS) hosting

######### END -> Rules to force a redirect from their original location in HTTP, to the same location but using HTTPS.

 
Below are links to some other useful information regarding SSL:
http://www.oscommerce.com/forums/topic/396284-securring-the-admin/
http://www.oscommerce.com/forums/topic/398247-ssl-web-server-configuration-protection-against-ssl-30-vulnerability-poodle/

login_modal_module_v2_1.zip

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

  • 9 months later...

@@ArtcoInc
(quoted from this this thread: http://www.oscommerce.com/forums/topic/409084-addon-front-page-new-products-carousel-for-osc-234-bootstrap/?p=1747224)

@@auzStar
 
(not meaning to hijack this thread, but ... :- )
 
Ah, I thought I recognized that B)
 
I see on your test site that you have the SSL on the entire site. Did anyone ever figure out how to trigger an SSL modal from a non-SSL page?
 
Thanks!
 
Malcolm


I had have a go at non-SSL pages. Following is quoted from my post above:

Testing (on a non fully SSL'd site) I was able to secure/encrypt the Login Modal (when fired from the current non-ssl page) by accessing a secure (SSL) page in the background via ajax/javascript, where programs such as Wireshark proved that the Login Modal content was encrypted, but this is still not a good solution. Browser/developer tools still give security warnings since it is still being fired from a non-secured page initially, hence a man-in-the-middle attack is still possible.

I ditched it because browser/developer tools still gave security warnings.

 

cheers
 

My Add-ons
Advanced Cache Control Tool for osCommerce 2.3.x (non-bootstrap) Download Support
Ajax Product Listing for osC 2.3.4 (bootstrap) Download Support
Category New Products Carousel for osC 2.3.4 (bootstrap) Download Support
Category Popular Products Carousel for osC 2.3.4 (bootstrap) Download Support
Customer Testimonials for osCommerce 2.3.4 (bootstrap and non-bootstrap) Download Support
Front Page New Products Carousel for osC 2.3.4 (bootstrap) Download Support

Index Nested - Product Listing for osC 2.3.4 (bootstrapDownload Support
Match Categories in Search Results for osCommerce versions 2.3.x (non-bootstrap) Download Support
Modular Category Page for osC 2.3.4 (bootstrap)
Download Support

NEW Australia Post Shipping Modules for osCommerce 2.3.x (non-bootstrap) Download Support
NEW Equal Height Module for osC 2.3.4 (bootstrapDownload Support
Products Low Stock Report for osC 2.3.x (bootstrap and non-bootstrap) Download Support
Twitter Typeahead Autocomplete Search for osCommerce 2.3.4 (bootstrap and non-bootstrap)
Download Support

Upcoming Products Modules for osC 2.3.4 (bootstrap) Download Support

 
Assisted Add-ons
Scroll Boxes for osCommerce 2.3.x (bootstrap and non-bootstrap) Download Support
 
Bootstrap Add-ons created by other members
osCommerce Bootstrap Addons and Code

Link to comment
Share on other sites

@@auzStar

 

Thank you for all of your work on this project (and moving the conversation back over here, where it belonged).

 

When this project first started, I had no clue as to the consequence of the SSL within a modal login. I appreciate that you were able to see it, and attempt to find a way to make it work. Your contribution was/is valuable, even when you had to ditch it.

 

Thank you.

 

Malcolm

Link to comment
Share on other sites

  • 7 months later...

Thank you very much for all of your hard work on creating this login modal.  It's beautiful.  I have a need for an AJAX login for my store... I'm alright with PHP but worthless when it comes to AJAX.  Is anyone interested in adding an option with this login modal for AJAX login?  Please PM me with a cost if so.  Thank you!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...