Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2011
    Posts
    16
    Plugin Contributions
    0

    Default Javascript calculation based on contents of shopping basket?

    Hello all. I'm putting together a site that deals in energy efficient products. In an effort to incent sales I'd like to create a simple calculation that dynamically works out stuff based on the content of the shopper's basket.

    One of the pieces of information on all of our product records is the power rating of the item in question, I'd like to be able to do some maths with this number and the quantity in the basket and display my answers in a sidebox.

    Unfortunately my skills in javascript are pretty limited. I found some free scripts which I managed to modify to do the maths I want given inputs to an html table, and with the output written back to that table, so the maths part is doable.

    Thing is I'm not sure how I might a) get variables from the cart application or b) put the output numbers in a sidebox.

    Can anyone help?

    Cheers,
    Alex

  2. #2
    Join Date
    Aug 2011
    Posts
    16
    Plugin Contributions
    0

    Default Re: Javascript calculation based on contents of shopping basket?

    Please?

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,684
    Plugin Contributions
    123

    Default Re: Javascript calculation based on contents of shopping basket?

    You're going to have to hire someone to do this for you.
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Javascript calculation based on contents of shopping basket?

    Quote Originally Posted by 4lex View Post
    Thing is I'm not sure how I might a) get variables from the cart application or b) put the output numbers in a sidebox.
    This isn't as simple as it may appear. What gets added to the cart is performed on the server. What you are wanting to output using javascript is performed by the client, so each time the customer adds a new item to the cart you'll need to have the client query the server for the updated data in order for the new calculations/display. To do this you'll be needing to employ AJAX technology.

    If you are already comfortable with PHP and JavaScript then don't fear AJAX (too much), because this is a 'simple' technology that merges the two. There are lots of cut 'n' paste examples on the 'net that you can experiment with.

    FWIW, I just love what AJAX has to offer, but it really makes my head spin and causes me all sorts of grief when coding/debugging it though.

    Cheers
    Rod

 

 

Similar Threads

  1. Replies: 2
    Last Post: 8 Apr 2015, 08:24 PM
  2. v150 Customers sharing contents in shopping basket
    By mtncycling in forum General Questions
    Replies: 12
    Last Post: 15 Feb 2014, 09:19 AM
  3. Adding VAT in shopping basket/ cart contents page
    By Peace74 in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 3
    Last Post: 11 May 2012, 10:56 AM
  4. altering basket contents
    By nagelkruid in forum General Questions
    Replies: 7
    Last Post: 12 Jan 2010, 05:23 PM
  5. Email contents of basket to user?
    By wicked01 in forum General Questions
    Replies: 0
    Last Post: 15 Feb 2009, 01:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR