/    Sign up×
Community /Pin to ProfileBookmark

Moving a product script to a website with skins

I’ve re-designed my E-store to a new cart with skins (.tpl files). Everything works fine except my PC configurator scripts. They use a form that also shows a running total of the selections. This code: <body onload=”ChangePrice()”> is necessary for this and is not working because the configurator scripts are on their own .tpl page and and the <body> is on the index.tpl page.

I need to move the onload=”ChangePrice()” javascript to the same page as the configurator scripts and those pages have no <body> line.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@DokMay 14.2007 — I'm not really sure what you mean but an onload event is only fired when a whole document of frame/iframe finishes loading. Can you tell a bit more about your problem?
Copy linkTweet thisAlerts:
@pcjuiceauthorMay 14.2007 — I'm not much into Javascript but my previous website had PC Configurators with all the Javascript on each page. At the top of the configurator is the base system price that changes as the customer changed the components. All the components are in a long array, then there is another Wizform section that changes the price as the customer selects different parts.

Each product (motherboard, memory etc.) have this code:

<select size="1" style="width: 582px" onchange=ChangePrice()>

<option value=23000 selected>None Selected</option>

<option value=23102>$104 &nbsp;INTEL Celeron D 320 2.40 GHz, 533FSB, 478-pin, L2=256KB, 90nm, RETAIL, BX80546RE2400C</option>. As you can see it's fairly old as it uses the "select" form.

So, basically, the prices will not change if that <body onload="ChangePrice();"> is not there on the same page like it used to be. The Javascript is now on a .tpl or template page and this page itself has no <body> line. The <body> line is on the index.tpl so the Javascript no longer functions.

Besides this problem, I would like to pay somebody to add the script necessary to E-mail the customer's choices to him/her and a copy to my company as well. I am going to try hooking up the price to my cart's database too and if I have trouble, I will pay for that also.

Basically I'm a computer tech, am an amateur in Javascript, PHP and MySQL. I excel in Photoshop, HTML and CSS.
Copy linkTweet thisAlerts:
@DokMay 15.2007 — Ok. It seems quite complex but if you can post an url then I will have a look at the code.
Copy linkTweet thisAlerts:
@pcjuiceauthorMay 16.2007 — This should not be complex.

The onload event picks up the base product price after the page loads and the starting price appears in the System Total line. It's a PC Configurator with a running total. Most PC Configurators have an Update Price button. I want an automatic price.

So, the onload="ChangePrice in the <body> line looks at the base price and posts it in the System Total line. Simple. But, my new website has the <body> line on a separate page. I have to find a way to make the onload="ChangePrice work WITHOUT the <body> line.

If this will help, at your DevX website I found this tip: Execute Form Processing Without a Body Tag. Here's the link: http://www.devx.com/tips/Tip/21060

His script is this:

function submitOnFormLoad()

{

try

{

document.myForm.submit();

}

catch(e)

{

submitOnFormLoad();

}

}

submitOnFormLoad();

I want the "myForm" changed to "ChangePrice". I've tried but am missing something.
×

Success!

Help @pcjuice spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...