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.
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
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);
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.
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!
…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:
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.
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.
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.
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.
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.
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?
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).
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.
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.