Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Need help locating files to modify attribute setup

Need help locating files to modify attribute setup

Locked

Views: 731

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
10 Aug 2010, 03:06
#1
jeffmic avatar

jeffmic

Zen Follower

Join Date:
Aug 2006
Location:
North Carolina
Posts:
280
Plugin Contributions:
0

Need help locating files to modify attribute setup

Hi everyone - I'm trying to add some code and I cannot locate exactly where and how to insert attribute code:

1 - How do I insert onclick="return checkdl()" into my tpl_modules_attributes.php file like this example below?:

<input type="radio" name="id[20]" value="91" checked="checked" id="attrib-20-91"onclick="return checkdl()" /><label class="attribsRadioButton one" for="attrib-20-91">Select format</label><br />

2 - What file and how do I insert this line of code into the header area of the product info page so I can call this javascript file?

<script type="text/javascript" src="includes/modules/pages/product_info/jscript_callbacks.js"></script>

thanks everyone

10 Aug 2010, 03:17
#2
jeffmic avatar

jeffmic

Zen Follower

Join Date:
Aug 2006
Location:
North Carolina
Posts:
280
Plugin Contributions:
0

Re: Need help locating files to modify attribute setup

I figured out how to do step 2 myself. Didn't realize that all I had to do was place the .js file into the proper folder and it would appear and work correctly on the product_info page

10 Aug 2010, 22:03
#3
niccol avatar

niccol

Totally Zenned

Join Date:
Apr 2009
Posts:
2,138
Plugin Contributions:
1

Re: Need help locating files to modify attribute setup

With the attributes the file you are going to need is modules/attributes.php.

It might be easier (but possibly not) to add an event listener in an external javascript file. Something like:

document.getElementById('id[20]').onclick  = function(){return checkdl()};

Even easier with jQuery if you have that on the go.

10 Aug 2010, 23:17
#4
jeffmic avatar

jeffmic

Zen Follower

Join Date:
Aug 2006
Location:
North Carolina
Posts:
280
Plugin Contributions:
0

Re: Need help locating files to modify attribute setup

Mike, please see a private message I sent you

thanks

11 Aug 2010, 00:59
#5
jeffmic avatar

jeffmic

Zen Follower

Join Date:
Aug 2006
Location:
North Carolina
Posts:
280
Plugin Contributions:
0

Re: Need help locating files to modify attribute setup

I got the attribute disable to finally work tonight, BUT even though I want 1 through 4 out of 6 radio buttons to disable attributes displaying lower on the product info page, only ONE of those buttons is working correctly. If I have 4 pieces of javascript code assigning one to each button, only the lowest one in the code list will actually work.

Really confused here..... :(

Here is the sample website to view what I'm trying to accomplish and view the source if needed.
http://download.pocketsongs.com/index.php?main_page=product_info&cPath=10&products_id=100001101

Here is the jscript_callbacks.js file with the FOUR dlbutton = functions at the top. In this example code, only attrib-1-4 actually disables the attributes (or the button labeled 4 - wmv video download [PC/Zune] ( +$1.00 ).

I also tried four different .js files, each with one attrib-1-1 or attrib-1-2, etc and it didn't work either. Only the 4th one works on the page too.

I cannot figure out a way to combine those code snippets either.

Any help on this so all 4 (out of 6) radio buttons are disabling the attributes would be appreciated.

function checkdl() {
dlbutton = document.getElementById("attrib-1-1");
dlbutton = document.getElementById("attrib-1-2");
dlbutton = document.getElementById("attrib-1-3");
dlbutton = document.getElementById("attrib-1-4");
if (dlbutton == null) {
return true;
}

checked = dlbutton.checked;
if (checked) {
document.getElementById("attrib-25").disabled = true;
document.getElementById("attrib-26").disabled = true;
document.getElementById("attrib-29-30").disabled = true;
document.getElementById("attrib-29-30").value= "";
} else {
document.getElementById("attrib-25").disabled = false;
document.getElementById("attrib-26").disabled = false;
document.getElementById("attrib-29-30").disabled = false;
}
return true;
}