Wordpress integration of form call, this should be easy, or is it?

Easy for a PHP junkie not me that is!

I want to pass a parameter into a shopping cart call on a wordpress page.

The following is representative call to the e-junkie shopping cart, passes a parameter in through the URL which is "discount_code"

<form action="http://www.e-junkie.com/ecom/gb.php?c=cart;i=B061120;cl=123300;ejc=2;discount_code=ACODE" target="ej_ejc" method="POST" accept-charset="UTF-8">

<input type="image" src="http://www.e-junkie.com/ej/ej_add_to_cart.gif" border="0" alt="Add to Cart" class="ec_ejc_thkbx"/>

</form>

The above works......and allows also calls other than discount_code eg to quantity=123 or amount=123 to override quantity

All I want is an extra TEXT formfield that allows the user to enter the discount_code in text and passes it in through the parameter above

BTW - vbulletin seems to be hijacking that string and formatting it wrongly it should say
discount_code=ACODE

Is that hard or easy ..?


[NB e-junkie used to allow passing on "buy it now" via a parameter os0 name "Promotion" and on0 - doesnt work on addtocart]
 
Last edited by a moderator:
Easy for a PHP junkie not me that is!

I want to pass a parameter into a shopping cart call on a wordpress page.

The following is representative call to the e-junkie shopping cart, passes a parameter in through the URL which is "discount_code"

<form action="http://www.e-junkie.com/ecom/gb.php?c=cart;i=B061120;cl=123300;ejc=2;discount_code=ACODE" target="ej_ejc" method="POST" accept-charset="UTF-8">

<input type="image" src="http://www.e-junkie.com/ej/ej_add_to_cart.gif" border="0" alt="Add to Cart" class="ec_ejc_thkbx"/>

</form>

The above works......and allows also calls other than discount_code eg to quantity=123 or amount=123 to override quantity

All I want is an extra TEXT formfield that allows the user to enter the discount_code in text and passes it in through the parameter above

BTW - vbulletin seems to be hijacking that string and formatting it wrongly it should say
discount_code=ACODE

Is that hard or easy ..?


[NB e-junkie used to allow passing on "buy it now" via a parameter os0 name "Promotion" and on0 - doesnt work on addtocart]

BTW - as incentive to give me a solution that works, I will paypal £20 to the first one that gives me a bit of code that does the job!

It can only be a couple of lines surely!

Come on geeks where are you?
 
Upvote 0
BTW - as incentive to give me a solution that works, I will paypal £20 to the first one that gives me a bit of code that does the job!

It can only be a couple of lines surely!

Come on geeks where are you?

Come on guys help!!

Isnt this as easy as putting the URL call above into its own PHP myphp.php file from which itis executed - with a form embedded in the wordpress containing suitable hidden parameters for the product descriptions ( the numbers) and a submit button to execute the PHP as an action=myphp.php ...or something?

Dont know the detail, but it sounds kind of right...

So what else needs to go
 
Upvote 0
Thanks...

Here is as far as I got..

In the meantime since asking, I created the myphp.php as literally the file...

http://www.crazypricelaptops.co.uk/code/ejpass.php

Containing this.

<?php
$prod1 = $_POST['prod1'];
$cust1 = $_POST['cust1'];
$coup1 = $_POST['coup1'];
$url1= "Location:http://www.e-junkie.com/ecom/gb.php?c=cart;i=".$prod1.";cl=".$cust1.";ejc=2;discount_code=".$coup1.";";
$cmd1= 'header("'.$url1.'")';
header("HTTP/1.1 301 Moved Permanently");
eval($cmd1);
exit();
?>


The form call as follows.

<form action="http://www.crazypricelaptops.co.uk/code/ejpass.php" target="ej_ejc" method="POST" accept-charset="UTF-8">
<input type="hidden" name="prod1" value="B061120"/>
<input type="hidden" name="cust1" value="123300"/>
Enter the Coupon Code if you have one:<br />
<input type="text" name="coup1"/>
<input type="image" src="http://www.e-junkie.com/ej/ej_add_to_cart.gif" border="0" alt="Add to Cart" class="ec_ejc_thkbx"/>
</form>

An echo - in place of the eval - confirms it does indeed create the $url1 is
http://www.e-junkie.com/ecom/gb.php?c=cart;i=B061120;cl=123300;ejc=2;discount_code=CRAZY;

Which happily runs..

$cmd1 is header("Location:http://www.e-junkie.com/ecom/gb.php?c=cart;i=B061120;cl=123300;ejc=2;discount_code=CRAZY;")

But the eval does not...work!!

The eval tries to transfer but gives "windows explorer cannot open the page!"

Any ideas - the point is , having constructed the correct URL as $url1 how to Iget it to transfer to the page? if not as a redirect? by eval of $cmd1
 
Last edited by a moderator:
Upvote 0

Latest Articles

Join UK Business Forums for free business advice