Avatar of xiss
xissFlag for Netherlands

asked on 

Cannot 'while loop' with one row

Hi guys,

I created a product configurator for our company, which uses javascript to add, multiple etc prices in a form, depending on the amounts that are filled in. It is showcased at http://shop.cloud2.nl/configurator.

If you look at the Server Backup Lite/Basic tab, it works like a charm. But when you check the Server Backup Pro tab, if you fill in the amount under "Aantal", nothing happens. The price for one server is 0.00. However, when you add another item with "Server Toevoegen", the price is changed from 0.00 to whatever amount you filled in times the value of the field.

I managed to figure out it does not work with one row, seeing as the Server Backup Lite/Basic tab works fine. But for the life of me I can't seem to figure out how to solve it.

Does anyone have a solution to this? I have included the code in the .php, the css and js for the tabs come from tabber.js and example.css (See source code or attachments).

Thanks a lot!
configurator.php
example.css
tabber.js
JavaScriptPHPHTML

Avatar of undefined
Last Comment
xiss
Avatar of Member_5340450
Member_5340450

line 502 and 503 of configurator's html close the head and start the body, but that's already done at lines 75, 76.

calc totals refers to incorrect cart name cart_sbp should be cart_sbb
ASKER CERTIFIED SOLUTION
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Gary
Gary
Flag of Ireland image

I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
Avatar of xiss
xiss
Flag of Netherlands image

ASKER

Hi guys,

My apologies for the late reply, I was quite busy and totally forgot about this. @Slick812: You are definitely right about the large amount of Javscript. This is one of the major downsides of Magento, and I have been working on fixing this.

In the end there was as slight mistake in the code regarding variable/function naming which caused it to fail. Although it still needs some work, for now this issue is solved.

Thanks!
Avatar of xiss
xiss
Flag of Netherlands image

ASKER

Although it does not solve the actual problem, it did give me some ideas as to how to clean up the code.
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo