/    Sign up×
Community /Pin to ProfileBookmark

have i reached the limits of php?

talking wordpress if that helps

so…

i created a paypal form/cart loop within my php page – worked great
i made it so the price would change depending on variables selected using on0, os0 system – worked great
i rejigged a java discount coupon code – worked great on fixed price items

but…

doesn’t work on variable price items because I’m using the variables on0, os0, for example

<input type=”hidden” name=”option_select0″ value=”10cm”><input type=”hidden” name=”option_amount0″ value=”10″>
<input type=”hidden” name=”option_select1″ value=”20cm”><input type=”hidden” name=”option_amount1″ value=”20″>
<input type=”hidden” name=”on0″ value=”Height”>
<input type=”hidden” name=”os0″ value=”‘; echo $height.’cm’; echo'”>

but the discount coupon code works on the variable ‘baseamt’

I’m racking my brains how I can change the value of baseamt whilst still changing the paypal variable os0

or some other workaround


————

I’m good in html, .css, php but I’m thinking it might be time to learn java jquery

can anyone suggest a way of doing this with php first?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogOct 05.2015 — Afraid I have almost no idea what your problem is. ? I think we (or at least I) need a bit clearer explanation of what it is that does not work.

Also, please remember that Java and JavaScript are two completely different things. I'm guessing you're actually referring to JavaScript, since you mention it in the same virtual breath as jQuery, which is a JavaScript framework. (And also remember that JS runs on the browser side [in most cases], so you may not want to depend on it to set prices, since a malicious user could easily circumvent it.)
Copy linkTweet thisAlerts:
@quietconauthorOct 05.2015 — ok, when manually creating a paypal shopping cart there are predefined variables that paypal will recognise

on0, os0

on1, os1

on2, os2 etc

on0 is the name of the field

os0 is the value of the field

for example :

on0 = "height"

os0 = "10cm"


-------

using an option index you can create a third value, and add a different price for each variation or height, e.g.

<input type="hidden" name="on0" value="Height">

<input type="hidden" name="option_index" value="0">

<input type="hidden" name="option_select0" value="10cm"><input type="hidden" name="option_amount0" value="15">

<input type="hidden" name="option_select1" value="20cm"><input type="hidden" name="option_amount1" value="30">

these options will then automatically display the options selected in the shopping cart, i.e. the height of the item and the price of that height


-------------

this is all fine

however - when I add a javascript to calculate a discount coupon it doesn't work because the option_amount field from the index takes priority over the variable used to calculate the price


------

note if I don't use an index and have a set price for each item the javascript works






variable 1 (height) = e.g. 10cm

variable 2 = 10cm (os0 - in paypal)

variable 3 (baseamt)
×

Success!

Help @quietcon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...