1 / 8
Mar 2011

After spending considerable time researching shopping carts and scripts in looking to find the right one to integrate into my website, I just recently happened upon e-junkie. In perusing the features, while I noticed that the cart supports variations and variants, I didn't happen to see anything with regard to variable pricing meaning, I would like to have the ability to enter a price for a product based upon input inside a form field by the customer. An example would be where the customer is required to enter their first name or initials inside a text field for a custom order. I then have another form field (readonly) next to the text field on my HTML page that calculates the value or price for this particular line item based upon the number of characters in the name entered into the text field.



In regard to the above, my first question is: Can e-junkie be set up to add a line item with a calculated price to my shopping cart? My second question is: If I have several similar line items beneath the one described above, can I also have only one 'Add to Cart' button to add all the line items to the shopping cart with just one click?

  • created

    Mar '11
  • last reply

    Oct '11
  • 7

    replies

  • 1.5k

    views

  • 2

    users

  • 11

    links

You would need some custom scripting in your page to calculate the price and insert that as the value for an "amount" parameter in the button's FORM fields or href/action URL, like so:



<input type="hidden" name="amount" value="12.34">



OR



2https://www.e-junkie.com/ecom/gb.php?c=cart&i=XXXXXX&cl=161295&ejc=2&amount=12.342



If you want to have one Add to Cart button that adds multiple items to the buyer's cart, then you could use our cart's multiAdd function as documented here:

http://www.e-junkie.com/bb/topic/4371



In that case, you'd want the scripting in your page to dynamically append all product variables to the URLs in your multiAdd array, like so for a product using Variations:



1https://www.e-junkie.com/ecom/gb.php?c=cart&i=XXXXXX&cl=161295&ejc=2&amount=12.34&on0=FirstName&os0=John&on1=LastName&os1=Smith1



If you'd need some help setting up that custom scripting, we can recommend the competent, E-junkie-experienced developers listed at the Developer Directory link at the top of every page on our site.

>You would need some custom scripting in your page to calculate the price and insert ...



As indicated in my initial post, this I have already done, so it would appear that the e-junkie shopping cart can be used to add a line item with a calculated price to my shopping cart. Only question I have is why did you designate the input type as 'hidden' as I intend to show the calculated value using readonly?



As for your answer to my second question w/regard to the one 'Add to Cart' button for adding multiple line items at once using the cart's multi-add function, am I correct in assuming that one of the line items can be like that mentioned in my first question?



Last but not least, I forgot to look but does e-junkie provide a trial period for their cart to allow me some time to test this myself b4 I decide to purchase? Also, just for the heck of it, can 'Fat Free' cart accommodate calculated values and does it by also provide the multi-add function that e-junkie features?

I only made the 'amount' field hidden presuming that you only wanted to pass an arbitrary price into the cart without necessarily showing it in the page or making it a user-editable field; also, if you pass the 'amount' value in the URL, then you don't need to pass it via a field -- any POST variable in an Add to Cart form can instead be passed as a GET variable in the button URL, and vice-versa. Note that the 'amount' value passed would get ADDED to the product's base price set in Seller Admin, which is perhaps another good reason to pass it in a hidden field or in the URL, rather than a visible readonly text field.



Using multiAdd, the basic principle would result in the Add to Cart button doing something like this:



<a href="javascript:EJEJC_multiAdd(Array(

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=XXXXXX&cl=161295&ejc=2&amount=12.34&on0=FirstName&os0=John&on1=LastName&os1=Smith',

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=XXXXXX&cl=161295&ejc=2&amount=56.78&on0=FirstName&os0=Bob&on1=LastName&os1=Jones'

));"><img src="http://www.e-junkie.com/ej/ejadd_to_cart.gif" alt="Add to Cart" border="0"/></a>



...though of course you'd have custom scripting to assemble the URLs for that array on the fly, based on what names the buyer enters on your site.



[UPDATE 10Oct2011: The following issue has been fixed]



Another caveat just occurred to me about passing an arbitrary 'amount' value into the cart like this. There's a technicality (verging on "bug" status) we just discovered, where any items in the cart which do not have their "Let buyer edit price" setting enabled in Admin would get reset to their base price as set in Admin when the buyer Removes any item from their cart, losing any 'amount' values that had been added to that price. Enabling "Let buyer edit price" eliminates that undesirable behavior, but it would let the buyer edit their item prices manually in the cart. You could delete the Remove checkboxes from the cart easily enough with our cart customization jQuery technique, but then buyers who want to remove an item and can't do so would likely just abandon their order entirely.

Another approach you could take, if this variable price is just a multiple of a flat per-letter rate based on the number of letters the buyer enters, just set the base item price to the per-letter price and pass a 'quantity' value to multiply that. You can disable "Let buyer edit quantity" for the product, so whatever value you pass into the cart for that would be retained as-is, without running afoul of the 'amount' technicality I described above. E.g., your multiAdd code would work effectively like this although your custom script would be generating the proper URLs to pass in the array:



<a href="javascript:EJEJC_multiAdd(Array(

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=XXXXXX&cl=161295&ejc=2&on0=FirstName&os0=John&on1=LastName&os1=Smith&quantity=9',

'https://www.e-junkie.com/ecom/gb.php?c=cart&i=XXXXXX&cl=161295&ejc=2&on0=FirstName&os0=Bob&on1=LastName&os1=Jones&quantity=7'

));"><img src="http://www.e-junkie.com/ej/ejadd_to_cart.gif" alt="Add to Cart" border="0"/></a>

As I haven't seen, much less am I familiar with, the inner workings of e-junkie shopping cart, my comments below are based upon my present setup in my HTML page.



I should reiterate as I think I may have confused you. In reply to the 'amount' hidden field, it's actually a price field to the right of a 'text' field where the customer enters/types in their first name or initials. To be clear, the price varies according to the length of the string (number of characters in the name) entered into the text field to determine the total price of the letters, priced at $2 each . The idea is let the customer see the actual price develop as they enter their name into the field. Granted, there are a multitude of other ways to accomplish this task, most of which are totally lame in that the customer is making a zillion selections while going back and forth between the shopping cart and the product page. Please understand that my primary goal is to make the shoppers experience a faster, easier and much more pleasant one than I am accustomed to seeing at the majority of other online stores. A good example or case in point is hipcandy.com Needless to say, ask anyone, my daughter and granddaughter included, and they will tell you that this is a complete total disaster to say the least.



Once again, while I am not familiar with e-junkie, as a programmer, it makes sense that I should be able to determine the cost of the letters for the shopping cart without having to use the calculated price field on my product page which is essentially for the customer only. Hence, this should really be no different than a line item with a fixed price meaning (depending upon how I can set this up in e-junkie), the shopping cart determines and shows the letters priced at 'x' amount of dollars based upon input inside the text field. If the customer should change his mind and decide to empty the cart, so be it, all goes back to 0.00. By not allowing the customer this option in order to satisfy my own needs is, IMO, a Big Mistake!



In fact, when you think about it, there should really be no need to begin with to disable the Buyers ability to edit Product in the shopping cart. If he/she decides to delete the letters (one item), he/she deletes all of them. I believe the confusion lays in the letters as they are not being added individually to the shopping cart in this scenario but rather as a group defining one price for one item in the cart as opposed to purchasing the letters individually. For all practical purposes, the description in the cart could be 'Letters', 'John'. Trust me, from what I've seen, most web designers/developers would have 10 separate drop down boxes (for the 10 maximum letters I allow in the text field) making a total of 10 separately priced items together with 10 trips to/fro from the shopping cart. I don't think so!



All in all, I have to say, it's amazing how I can accomplish tasks similar to this one in a matter of minutes using javascript inside a PDF form. As I am new to the shopping cart experience from a web designer/developer point of view (my other sites have never required one and I use Share-It to sell my digital software), I must add that looking to find a suitable shopping cart has been a virtual nightmare and education at the same time.



Last but not least, you forgot to answer my question about 'FatCart'. Is it capable of doing any of the tasks I have described above?

I must admit I'm having a hard time following what you're trying to describe. I'm not sure if it's because you want something so completely unique and purpose-built that you'd effectively need to have it developed from scratch, or maybe just that you're overthinking it and trying to reinvent our wheel which happens to have everything you really need built-in, but as a general-purpose tool it's just built differently from how you might imagine building one tailor-made for just your own specific situation, so that mismatch between expectation vs. actuality, and specific vs. general purposes, may be confusing both of us.



E-junkie is an "off the shelf", ready-made, "one size fits most" solution; we are a very simple, basic, general-purpose shopping cart service to suit most simple, basic, general-purpose needs for selling an established product line online. We are not a custom development shop available for hire to program a specific solution from scratch, nor is our solution designed with a lot of bells'n'whistles and radically flexible customization options. It works how it works, and we're glad to describe how it works and suggest approaches using our standard features in the standard manner, but if you need it to work completely differently, then we just may not be the right tool for your job. About the most radical customization we've heard of is a completely custom-programmed JavaScript replacement for our cart's entire buyer front-end:

http://successfulsoftware.net/2009/09/24/a-new-front-end-for-e-junkie/



That said, it seems like you may just need your page to have a field for buyers to enter some text, a way for your page to count the number of characters entered in that field and display a dynamically-varying price based on that char. count, and then a way for that item to be added to the buyer's cart with the text provided by the buyer and the proper price for that text. The live price-calculation shown in your page would not need to involve our cart at all; you'd just have a custom script in your page counting characters as they're entered in the field and displaying a dynamic price to the buyer, so that scripting would be entirely up to you. The text entered would use our Variations feature to pass that text into the cart as an option value for the product.



The easiest, most foolproof way to get the proper price into our cart would be to make the product itself a per-letter charge, set the price of that product in Admin to equal the per-letter cost, then have the letter-counting script in your page insert that letter-count as a 'quantity' value in the button URL.



E.g., the ready-made cart button code provided in your Seller Admin when you create the basic product would look like this:



<form action="https://www.e-junkie.com/ecom/gb.php?c=cart&i=XXXXXX&cl=161295&ejc=2" target="ejejc" method="POST" accept-charset="UTF-8">

<input type="hidden" name="on0" value="Letters"/>

Letters:<br/>

<input type="text" name="os0" maxlength="200"/>

<br/>

<input type="image" src="http://www.e-junkie.com/ej/ejadd_to_cart.gif" border="0" alt="Add to Cart" class="ec_ejc_thkbx" onClick="javascript:return EJEJC_lc(this.parentNode);"/>

</form>



Then it would be up to you to modify that code as needed and and integrate it with your own, custom scripting in the page to count letters entered in the "os0" field and insert that letter-count in a &quantity=X parameter added to the action= URL (or use a 'quantity' field in the form itself, whichever method you prefer to script).



FatFreeCart.com is a far more basic and even simpler solution than E-junkie cart. We do not provide any support or assistance whatsoever for that service, which is a major reason it's free. However, since all aspects of that cart and product configuration are done via the button code in the page itself, you may find it more adaptable to custom scripting in your page:

1http://www.fatfreecart.com/code.html1

6 months later
This issue has now been fixed:



E-junkieGuruAnother caveat just occurred to me about passing an arbitrary 'amount' value into the cart like this. There's a technicality (verging on "bug" status) we just discovered, where any items in the cart which do not have their "Let buyer edit price" setting enabled in Admin would get reset to their base price as set in Admin when the buyer Removes any item from their cart, losing any 'amount' values that had been added to that price. Enabling "Let buyer edit price" eliminates that undesirable behavior, but it would let the buyer edit their item prices manually in the cart. You could delete the Remove checkboxes from the cart easily enough with our cart customization jQuery technique, but then buyers who want to remove an item and can't do so would likely just abandon their order entirely.