add discount amount field after apply the coupon code in cart page - magento-1.7

I want to add the discount after apply the coupon code in the cart page.I'm having the output as follows:
Now I want to add the Dsicount with its corresponding amount after subtotal
Thank in advance! Guide me!

If you are using discount in amount in add to cart form :
<input type="hidden" value=".50" name="discount_amount">
<input type="hidden" value=".50" name="discount_amount2">
If you are using discount in rate in add to cart form:
<input type="hidden" value="50" name="discount_rate">
<input type="hidden" value="50" name="discount_rate2">
You can try this solution.
Regrads,
shahana

Related

MechanicalSoup - Set hidden fields?

Using MechanicalSoup, does one have to set values for hidden fields in a form as well? Or can we just ignore them?
Here is their code in the HTML form:
<input type="hidden" name="details[sid]" />
<input type="hidden" name="details[page_num]" value="1" />
<input type="hidden" name="details[page_count]" value="1" />
<input type="hidden" name="details[finished]" value="0" />
<input type="hidden" name="form_build_id" value="form-OoBDi0_aQvgHZN-Iyc" />
<input type="hidden" name="form_id" value="webform_client_form_337" />
<input type="hidden" name="honeypot_time" value="1519679330|-x8kCHBe6qh7E" />
Hidden fields are typically used internally by the website you're browsing: they are generated with a value, and this value is sent together with non-hidden fields when you submit the form.
MechanicalSoup does what you expect here: it sends the values of hidden fields when you submit the form, so essentially you don't have to care about them: their value will be set by the website you're visiting, and then taken into account by MechanicalSoup just like a normal browser.
You shouldn't need to modify their value, because when using the website with a real browser, the user has no simple way to set a value (that's the point of hiding the fields ...).
You can add your own hidden input name:value pairs using the new_control() method. I've had to do this when the form used javascript to set a hidden element before form submission.
browser.new_control('hidden','name','value')
https://mechanicalsoup.readthedocs.io/en/stable/mechanicalsoup.html#mechanicalsoup.Form.new_control

Payfort Error code: 00002 Invalid parameter format

I'm trying to add payfort as a payent gateway to a new section in a website. The same code works correctly in another section. I always get "Error code: 00002 Invalid parameter format"
<form method="post" action="https://checkout.payfort.com/FortAPI/paymentPage" class="pay_form" name="form1">
<input type="hidden" name="access_code" value="access_code">
<input type="hidden" name="amount" value="1000.00">
<input type="hidden" name="command" value="PURCHASE">
<input type="hidden" name="currency" value="USD">
<input type="hidden" name="customer_email" value="user#mail.com">
<input type="hidden" name="customer_name" value="customer name">
<input type="hidden" name="language" value="en">
<input type="hidden" name="merchant_identifier" value="identifier_code">
<input type="hidden" name="merchant_reference" value="order_id">
<input type="hidden" name="return_url" value="my_return_url">
<input type="hidden" name="signature" value="form_signature">
</form>
I compared this form to another form in the other section and they are similar to each other but order id, return url and amount are different but the first form works without any issues. Any ideas?
It's because payfort only accepts whole number as amount. You need to multiply the actual amount by 100 and before sending request to payfort make sure its whole number.

Validate multiple checked Checkbox

is there a way to validate multiple checked checkboxes properly?
How are the data been sent?
Something like eyeColor[0] = blue?
<form action="send" method="POST" id="send-form">
<input type="checkbox" id="eyeColor" name="eyeColor[]" value="blue">
<input type="checkbox" id="eyeColor" name="eyeColor[]" value="brown">
<input type="checkbox" id="eyeColor" name="eyeColor[]" value="green">
</form>
"eyeColor" -> seq(text.verifying(enum(eyeColor().keySet.map(_.toString), "error.searchProfile.eyeColor")))
In your controller you get eyeColor as a List[String], as if it was a multiple select. You can not see the ones that are not selected (they're not passed in the http request).

I need to create a custom postage price depending on quantity ordered for Paypal button

For example item price is £6.78 postage and packaging should be:
Single copy: £1.50
2-3 copies £3.00
4-6 copies: £4.00
7-8 copies: £5.00
9 copies: £6.00
10 or more free
Any idea how I can do this? The current code for the item is:
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="CUWB7BQEL337J">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
I read somewhere that I need to do something like:
<input type="hidden" name="shipping" value="1.50">
<input type="hidden" name="shipping2" value="3.00">
<input type="hidden" name="shipping3" value="3.00">
<input type="hidden" name="shipping4" value="4.00">
<input type="hidden" name="shipping5" value="4.00">
<input type="hidden" name="shipping6" value="4.00">
<input type="hidden" name="shipping7" value="5.00">
<input type="hidden" name="shipping8" value="5.00">
<input type="hidden" name="shipping9" value="6.00">
<input type="hidden" name="shipping10" value="0.00">
Where would this go as when I tried it it didn't work.
it looks like your on the right lines (although you might try 'shipping_1', 'shipping_2',etc. you have missed out the underscore) but you may find that you are need to send "shipping_1 = £1.00", "Quantity_1 = 2", which Paypal may interpret as 'shipping = 2 times £1.00', but I think it will assume shipping_1 is for the button item as a whole because you are using a button to specify a specific item not a bunch of items (i.e. 1 button = 1 item).
What happens if the person presses the button twice, im not sure. The only thing I've found in Paypal's documentation talks about setting up weight's for postage costs within your Paypal account, then prices per weight (i.e. 1 item weighs 1kg, cost = £1.00, 2 items weigh 2kg, cost = 2 x 1kg weight = £2.00, etc.). You could also look into this area.
I found the buttons to restictive and built my own shopping cart in my code behind including shipping costs (which I calculate), then send just one "shipping_1 = x.xx" cost to paypal along with the items details, this works fine.
I think I may add a new post on here with my working code for a shopping cart to help others, just need to tidy it up a bit. (I'll add a link from this post if your interested).
You could try referring to this page.
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/cart_upload/
Trev.

PayPal Item Name/Description on separate lines using forms

I am processing a simple form to PayPal's Express Checkout using the basic standard free account and the standard form "_xclick" option.
When passing through the item name or description, I understand you are limited to 144 characters but I want to have the information inside the title or the description on different lines to separate the information when on PayPals checkout area so the user can clearly see what they are paying for.
I have tried to use "\r" and "\n" to seperate the lines, as seen below in the "item_name" input using "This is line 1\r\nThis is line 2\r\nThis is line 3", but it just ignores the "\r" and the "\n" when passed through to the PayPal payment page and when sent in the receipt email.
Current Example Code:
<form name="TheForm" method="post" action="https://www.sandbox.paypal.com/cgi-bin/webscr">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="item_name" value="This is line 1\r\nThis is line 2\r\nThis is line 3">
<input type="hidden" name="price" id="price" value="" />
<input type="hidden" name="business" value="test#test.com">
<input type="hidden" name="amount" value="">
<input type="hidden" name="no_shipping" value="1">
<input type="submit" name="Submit" id="Submit" value="Process Payment" />
</form>
I have also tried using
, 
, <br> and <br /> and none of these work either and are passed through as text.
How can I achieve separating the item information on seperate lines using the form option INPUT value, as shown above, for the item description or title please as the way I have tried does not work and I cannot find any solution?
Thanks.
Currently there is not a way to do this. The standard buy now buttons do not support this. The closest you can come to putting things on a different line would be using a cart upload method. Instead of passing over 1 item, with 3 values in the item name that you want displayed on 3 different lines you would pass over 3 individual items which would cause them to be on 3 different lines.