[Pro] Cost Calculations?

http://intergrafix.co.uk/fi2/happytreefarm.html

I think I have succeeded in getting the total cost to the cart, but one last thing, how on earth do I get the width and length to the cart as well? I can add 2 extra fields in the customer detail form in the cart, but that would mean the customer has to put the measurements in again, and I can see problems arising there when the customer makes a mistake.

Tim


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You have certainly succeeded in getting the area to the cart - what method did you use for that. This can probably be adapted to incorporate the width and length.

I take it the ID References are just there to keep you right?

I can’t look at your code right now but I envisaged something a bit different

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 18 May 2010, 7:44 pm, DeltaDave wrote:

Walter did say

This makes the following assumptions:

You have only one form on your page.

So there must be a tweak required.

Right, but it’s really simple. The form is identified by the index number. The first form on the page is forms[0], the second is forms[1], and so forth.

It looks like you’re sending the area to your cart, but does your cart allow you to send a “notes” field of some sort along with the quantity (which is the area)? You could mush the width and height together, like this:

var f = $(document.forms[0]);
var updater = function(elm,values){
    vars = values.toQueryParams();
    var area = vars['length'] * vars['width'];
    $('total_cost').setValue(
        (Math.round(area *
        40 * 100) / 100).toFixed(2));
    $('total_area').setValue(area);
    $('notes').setValue(vars['length'] + 'x' + vars['width']);
}
new Form.Observer(f,0.3,updater);

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

That didn’t seem to make any difference Walter.

I have added a download for the file on the page now for you to take a look at what I have done so far.

http://intergrafix.co.uk/fi2/happytreefarm.html

I think when this is working properly, I will document it and add it as a tutorial. I’m sure I won’t be the only one to need this functionality.

Tim


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Well, by itself, adding the field wouldn’t do it, not unless the cart knows you are sending that field and is set to accept it. Area maps neatly onto Mals’ concept of “quantity” so it’s a natural there. But I haven’t used that cart, so I don’t know how you pass another field to it.

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This from Mals about Options

You can build up a list of options by posting more than one descriptor for each product. This is done by appending a pair of square brackets [ ] onto each field name:
<INPUT TYPE="HIDDEN" NAME="product[]" VALUE="Musto Ocean Jacket">
<INPUT TYPE="HIDDEN" NAME="product[]" VALUE="Yellow"#>
These two descriptions will appear in the cart separated by a comma:
Musto Ocean Jacket, Yellow

This might help Walter cause I have been trying and getting nowhere!

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

So what would I have to do to add these fields?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I would stash the dimensions in the product name. You currently have
this hidden field:

<input type="hidden" name="product" value="My product name">

If you look at my example code, I added a line to update the mythical
“notes” form field. You could modify this:

 $('notes').setValue(vars['length'] + 'x' + vars['width']);

…to be this (just be sure to add an ID to your product field, too):

var p = $('product')
p.setValue(p.getValue() + ': ' + vars['length'] + 'x' + vars['width']);

This should get you a product name that reads ‘Happy Cows: 2.8x5.1’ or
similar.

If the product field is being generated by the Action, then you might
not have access to it to add an ID. If that’s the case, you can use
this syntax instead to get it by its name:

var p = $$('input [name="product"]').first();

Hope this helps,

Walter

On May 19, 2010, at 9:10 AM, DillyDog wrote:

So what would I have to do to add these fields?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

OK Walter, I don’t want to seem stupid, but I am now quite baffled. I have only ever used Mals with Tim Plumb’s actions and I have no idea how to use it with HTML.

Can you look at the page here:

http://intergrafix.co.uk/fi2/happytreefarm.html

and download the file. If you have the time (naturally), could you see if you can make this work on that file. I feel I am so close to this working that it would be a shame to drop it now.

Many thanks in advance,

Tim


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I could probably make it work by editing the HTML, but I don’t have a
copy of Tim’s Actions here, so it’s probably going to be difficult for
me to edit the Freeway page and make it go. Can you answer this
question? Did you create any of the hidden form fields that Mals
requires by opening the Page / Form Setup dialog and manually creating
them there?

Let me know, and I’ll puzzle a bit more about how I could help you
remotely. There’s probably a tricky way to access that hidden form
element using Prototype, so you wouldn’t have to extend it with an ID
yourself.

Or Tim could be so good as to extend all form elements with an ID when
he makes them, that would make all sorts of Magick possible down the
road…

Walter

On May 19, 2010, at 1:19 PM, DillyDog wrote:

OK Walter, I don’t want to seem stupid, but I am now quite baffled.
I have only ever used Mals with Tim Plumb’s actions and I have no
idea how to use it with HTML.

Can you look at the page here:

intergrafix.co.uk

and download the file. If you have the time (naturally), could you
see if you can make this work on that file. I feel I am so close to
this working that it would be a shame to drop it now.

Many thanks in advance,

Tim


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Apart from the fact that you have linked to a native .freeway file which is not downloadable unless you Zip it first.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I hope you haven’t uploaded to your FTP from this file! The password
will be embedded in it. Even though it can’t be hacked out of the file
in a readable manner, the file itself could be uploaded without
knowing the password, and it would delete or deface your site in the
wrong hands.

If you link to the actual file for your site, one that you have used
before to upload through Freeway, then take it down immediately, and
change your FTP password for good measure.

Walter

On May 19, 2010, at 2:42 PM, DeltaDave wrote:

Apart from the fact that you have linked to a native .freeway file
which is not downloadable unless you Zip it first.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Whoops!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

OK, file zipped and with upload info removed. This isn’t a page that gets ftp’d, it’s just the page in question. This page will eventually become the master for all the wallpaper pages.

Walter: The quick answer is ‘no’. All done with actions except the ID set with Extended as instructed at the beginning of this thread. I have only used the e-Buy action set as supplied with Pro, does this make a difference?


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

OK Tim

Have a look at http://www.deltadzine.net/calculator.html

Give it a go - it has been bugging me for 24+hrs now.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

THAT’S IT!!!

Can you send me this file so I can see exactly how you did it.

One tiny little thing, is it possible to put some spaces either side of the ‘x’. It’s not the end of the world if it isn’t, just might make it easier for the customer to understand, (perhaps also add an ‘m’ after the dimension as well, OK, I’m just being picky now).

Cheers Dave

Tim


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’m just being picky now!

Yup - you are

See if you can add them yourself.

Revised version with download link http://www.deltadzine.net/calculator2.html

This page doesn’t use the actions at all - if you want to do it with the actions then I am stumped but this method is reasonably straightforward - mainly copy/paste between pages.

The last field in the form that contains the length x height is extended type:hidden so it doesn’t show on the published page.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

So is the e-shop Settings Folder Action not necessary then? I see it has been applied.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Yes it is required for the e-quantity action to work on the area field and also to set the malsettings.cfg file (which has cart appearance settings in it). It can probably be done differently/without but this worked for me so I didn’t pursue a different way.

Remember to use your own settings in the Page>Form Setup section and each page will need unique product names.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Here we are then, all seems to be working as required.

http://www.intergrafix.co.uk/fi2/happytreefarm.html

I can’t thank you and Walter enough. It will make my client a very happy man and may encourage him to write his cheque sooner rather than later.

OK, better start populating the site.

Thanks again

Tim


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options