Ecommerce software home
Shopping Cart Software Forum for Ecommerce Templates
 
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

Find us on Facebook Follow us on Twitter View our YouTube channel
Search our site
Forum Search
Google Site Search
 All Forums
 Technical
 ASP (Windows server) versions
 Adding text to qty in options
Previous Page
Author « Topic »
Page: of 2

dbdave
ECT Moderator

USA
10409 Posts

Posted - 10/06/2017 :  23:37:28  
Ok Julie we are just gonna put another function under that first one.
This will see when the option change is clicked and tell it not to slice to unslice any text there.
The part in red there is what you want to add under what you already have.


<script type="text/javascript">
$('#optn0x0y0, #optn0x0y1, #optn0x0y2, #optn0x0y3, #optn0x0y4, #optn0x0y5, #optn0x0y6, #optn0x0y7, #optn0x0y8, #optn0x0y9, #optn0x0y10').text(function (_,txt) {
return txt.slice(0, -1);
});
</script>


<script type="text/javascript">
function updateoptimage(){
$('#optn0x0y0, #optn0x0y1, #optn0x0y2, #optn0x0y3, #optn0x0y4, #optn0x0y5, #optn0x0y6, #optn0x0y7, #optn0x0y8, #optn0x0y9, #optn0x0y10').text(function (_,txt) {
return txt.slice(0);
});
}
</script>


David
ECT Power User

Edited by - dbdave on 10/06/2017 23:37:49

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 10/07/2017 :  12:12:15  
Well, drat - that was a good solution but when I add it - I lose the image changing when an option is chosen.

Must be tied into that somehow.

Julie
Browns Summit NC USA

dbdave
ECT Moderator

USA
10409 Posts

Posted - 10/07/2017 :  14:21:44  
Ok, let me take another stab at it.
I will see if I can turn on the inventory feature on my dev site so I can duplicate your setup.
Hang in there and let me see if I can get it going.

David
ECT Power User

dbdave
ECT Moderator

USA
10409 Posts

Posted - 10/08/2017 :  11:00:48  
Hi Julie, the problem with my last fix

<script type="text/javascript">
$('#optn0x0y0, #optn0x0y1, #optn0x0y2, #optn0x0y3, #optn0x0y4, #optn0x0y5, #optn0x0y6, #optn0x0y7, #optn0x0y8, #optn0x0y9, #optn0x0y10').text(function (_,txt) {
return txt.slice(0, -1);
});
</script>


<script type="text/javascript">
function updateoptimage(){
$('#optn0x0y0, #optn0x0y1, #optn0x0y2, #optn0x0y3, #optn0x0y4, #optn0x0y5, #optn0x0y6, #optn0x0y7, #optn0x0y8, #optn0x0y9, #optn0x0y10').text(function (_,txt) {
return txt.slice(0);
});
}
</script>

was the function there in red (updateoptimage) is the ect function that changes the image, allows dependent options to work, and changes your pricing.
Be me adding that function again further down the page, it caused the first one to stop working.
My understanding is if it's listed twice on the page, then the 2nd one takes priority.
I worked on several solutions and it's tricky detecting a radio button change to call the function that chops off the last letter.
The ect code has a built in trigger that calls up the updateoptimage function.

In the end I just copied the ect function and added in the part there that cuts off the last letter.
So when the updateoptimage function is requested, it is using the new one I created.
It all seems to work fine in my testing. I checked several browsers.
It's updaterproof, but if ect ever adds something to that function (updateoptimage) then you may not have the feature until we update this hack.
I am sure there are lots of ways to do this, but it does seem to work.

Alternately, you can do a hack (not updater-proof) in the core code.

Below is what you want now


<script type="text/javascript">
$('#optn0x0y0, #optn0x0y1, #optn0x0y2, #optn0x0y3, #optn0x0y4, #optn0x0y5, #optn0x0y6, #optn0x0y7, #optn0x0y8, #optn0x0y9, #optn0x0y10').text(function (_,txt) {
return txt.slice(0, -1);
});
</script>


<script type="text/javascript">
function updateoptimage(theitem,themenu,opttype){
var imageitemsrc='',mzitem,theopt,theid,imageitem,imlist,imlistl,fn=window['updateprice'+theitem];
dependantopts(theitem);
fn();
$('#optn0x0y0, #optn0x0y1, #optn0x0y2, #optn0x0y3, #optn0x0y4, #optn0x0y5, #optn0x0y6, #optn0x0y7, #optn0x0y8, #optn0x0y9, #optn0x0y10').text(function (_,txt) {
return txt.slice(0, -1);
});

if(opttype==1){
theopt=document.getElementsByName('optn'+theitem+'x'+themenu)
for(var i=0; i<theopt.length; i++)
if(theopt[i].checked)theid=theopt[i].value;
}else{
theopt=document.getElementById('optn'+theitem+'x'+themenu)
theid=theopt.options[theopt.selectedIndex].value;
}

if(mzitem=(document.getElementById("zoom1")?document.getElementById("zoom1"):document.getElementById("mz"+(globalquickbuyid!==''?'qb':'prod')+"image"+theitem))){
if(aIML[theid]){
MagicZoom.update(mzitem,vsdecimg(aIML[theid]),vsdecimg(aIM[theid]));
}else if(pIM[0]&&pIM[999]){
imlist=pIM[0].split('*');imlistl=pIM[999].split('*');
for(var index=0;index<imlist.length;index++)
if(imlist[index]==aIM[theid]&&imlistl[index]){MagicZoom.update(mzitem.id,vsdecimg(imlistl[index]),vsdecimg(aIM[theid]));return;}
if(aIM[theid])MagicZoom.update(mzitem.id,vsdecimg(aIM[theid]),vsdecimg(aIM[theid]));
}else if(aIM[theid])
MagicZoom.update(mzitem.id,vsdecimg(aIM[theid]),vsdecimg(aIM[theid]));
}else

if(imageitem=document.getElementById((globalquickbuyid!==''?'qb':'prod')+"image"+theitem)){
if(aIM[theid]){
if(typeof(imageitem.src)!='unknown')imageitem.src=vsdecimg(aIM[theid]);
}
}
}


David
ECT Power User

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 10/08/2017 :  11:19:58  
well, drat - it's not having any effect on my site.. still getting the extra ")" when clicking an option.

Maybe something in the copy/paste?

Here's a page with 10 options:
https://www.**seeprofile**.com/proddetail.asp?prod=Amazing-Pet-Squeaky-Face-Ball-for-Dogs

Julie
Browns Summit NC USA

Edited by - Positivek9 on 10/08/2017 11:27:33

dbdave
ECT Moderator

USA
10409 Posts

Posted - 10/08/2017 :  12:47:30  
weird. I can't easily duplicate your setup, but in theory what I am testing with should produce the same results.
I added a link under "cool links" in my profile to my test page.
Notice the top row of options never regain that last character.

Just so you can say we tried, you might try to paste the code again, I see you lost the indents, although that should not really matter.

I am out of time to work on this some more, for now at least.
I can probably tell you where to hack the code if you want that option.

David
ECT Power User

Edited by - dbdave on 10/08/2017 12:51:25

Positivek9
Ecommerce Template Guru

USA
4061 Posts

Pre-sales questions only
(More Details...)

Posted - 10/08/2017 :  13:13:54  
Hey thanks, David.. it was worth a shot, anyways.

Maybe someone else can jump in with a way to make it work.

Julie
Browns Summit NC USA
Page: of 2 « Topic »  
Previous Page
Jump To:
Shopping Cart Software Forum for Ecommerce Templates © 2002-2022 ecommercetemplates.com
This page was generated in 0.02 seconds. Snitz Forums 2000