Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 11-28-2009 10:20:55

Tanushiheadbash
Member
From: Stirling, Scotland
Registered: 07-20-2009
Posts: 82

Modified multi add script- some info needed

Hi
As I have posted elsewhere I am looking to have a function whereby my client can offer multiple products on one page (each of which has a multiple select option) In basis its very like the multi add option in ECP but with the crucial difference that  instead of having the big linear from list with quatity boxes and a single add to cart button at the foot- we want to have each product with an independent Buy button.
This means having a different form for each product- we are not bothering with the quantity field (the value will be hardcoded as 1) and the products will show across the page in their own box not down the page in a sortable list.

The code that does the existing function lives in prodmulti.php in the ecom includes.

I have done some fairly significant modifications to this script (after backing up the original) but can't get it working satisfactorily though its VERY close. I don't understand whats breaking it. I was hoping someone here might have a better grasp of how the form data is handled.
The big issue with displaying each item with its selection option box and form button has been that when you select the item and the data is posted to the cart,  I get random results.
1) About 1 time in 3 the item selected appears in the cart properly listed and priced
2) About two times in three the item selected appears in the cart but also the first item from the page  where my multiple forms lives (the content set up by prodmulti.php)
3) About 1 time in 10 when I delete one of these items from the cart the top item from the list formed by prodmulti.php mysteriously appears and replaces it!

I have checked my HTTP POST DATA over a considerable number of scenarios and cannot see a difference in any of the form data being posted which results in one of the three scenarios above- in each case the form element names and contents are identical- none contain the top item from the product list yet still it appears in the cart more times than not.

Does anyone understand what it is I need to send to make this work. As you can imagine I have played around with different settings but I still end up with the first item from the prodmulti.php script list more often than not.

This is the header sent where the correct item appeared in my cart:
Content-Type: multipart/form-data; boundary=---------------------------276443266232757
Content-Length: 1455
-----------------------------276443266232757
Content-Disposition: form-data; name="sid"

30hfy8p08ft9d3o0337vd48a96l3e970
-----------------------------276443266232757
Content-Disposition: form-data; name="ns"

addcart
-----------------------------276443266232757
Content-Disposition: form-data; name="app"

ecom
-----------------------------276443266232757
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--quantity"

1
-----------------------------276443266232757
Content-Disposition: form-data; name="prodall[]"

prodmemsansd
-----------------------------276443266232757
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--referref"

catmemsdh
-----------------------------276443266232757
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--referns"

catshow
-----------------------------276443266232757
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--optall"

prodoptsansd
-----------------------------276443266232757
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--optreq"

prodoptsansd
-----------------------------276443266232757
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--prodoptsansd"

optselsansd2g
-----------------------------276443266232757
Content-Disposition: form-data; name="SUBMIT"

Add To Cart
-----------------------------276443266232757--

This is the header sent when the correct item PLUS the first item in the list appeared in the cart- other than the separation field they are identical

Content-Type: multipart/form-data; boundary=---------------------------974127529778
Content-Length: 1419
-----------------------------974127529778
Content-Disposition: form-data; name="sid"

30hfy8p08ft9d3o0337vd48a96l3e970
-----------------------------974127529778
Content-Disposition: form-data; name="ns"

addcart
-----------------------------974127529778
Content-Disposition: form-data; name="app"

ecom
-----------------------------974127529778
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--quantity"

1
-----------------------------974127529778
Content-Disposition: form-data; name="prodall[]"

prodmemsansd
-----------------------------974127529778
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--referref"

catmemsdh
-----------------------------974127529778
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--referns"

catshow
-----------------------------974127529778
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--optall"

prodoptsansd
-----------------------------974127529778
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--optreq"

prodoptsansd
-----------------------------974127529778
Content-Disposition: form-data; name="ecom--prodaddtocartM--prodmemsansd--prodoptsansd"

optselsansd2g
-----------------------------974127529778
Content-Disposition: form-data; name="SUBMIT"

Add To Cart
-----------------------------974127529778--

I have also adjusted code so each form has a unique name by injecting a random string to the form name but this does not help.
Any ideas would be greatfully received as I am struggling now

Kenny

Last edited by Tanushiheadbash (11-28-2009 10:25:09)

Offline

 

#2 11-29-2009 14:26:30

Tanushiheadbash
Member
From: Stirling, Scotland
Registered: 07-20-2009
Posts: 82

Re: Modified multi add script- some info needed

After many hours of frustratingly going no where trying to get the right items in my cart , I have done this a different way and also managed to implement graphical Add to cart  buttons- I had to modify a fair few files ( an new display function) and create a new xhtml include but works well as far as I can see and client appears to be happy.

Would still love to hear from anyone who uderstands how the cart updating works when fed from a product multi add  page- or even point me at the files- actually with the info I have gained today I might be able to identify this myself now.
K

Last edited by Tanushiheadbash (11-29-2009 14:28:09)

Offline

 

Board footer