Skip to content

Instantly share code, notes, and snippets.

View apih's full-sized avatar
👻

Mohd Hafizuddin M Marzuki apih

👻
View GitHub Profile
@apih
apih / code.html
Created December 25, 2017 13:20
Code for reverting (partially) OnPay's order form to classic look
<script type="text/javascript">
$(document).ready(function() {
$("#submit-order").hide();
$("#payment_form").show();
$("#payment_form").submit(function(event) {
event.preventDefault();
return false;
});
$("#total_amount").change(function() {
@apih
apih / onpay-form-input-type-number.html
Last active October 16, 2018 08:49
JS code for using input type number element for quantity in OnPay form
<script type="text/javascript">
// Use input type number element for quantity
$("[name^='product_quantities']").each(function() {
var element = $(this);
element.replaceWith('<input type="number" class="form-control quantity" min="0" name="' + element.prop("name") + '" value="' + element.prop("value") + '">');
});
</script>
@apih
apih / code.html
Created August 23, 2017 05:50
Code for adding client email confirmation in OnPay form
<script type="text/html" id="client_email_confirmation_template">
<div class="form-group ">
<label for="client_email_confirmation" class="control-label col-md-3">Sahkan Emel<span class="glyphicon glyphicon-asterisk red-asterisk"></span></label>
<div class="col-md-7">
<input type="email" class="form-control" id="client_email_confirmation" name="client_email_confirmation" placeholder="Sahkan emel anda..." maxlength="100" value="">
</div>
</div>
</script>
<script type="text/javascript">
@apih
apih / code.html
Created August 11, 2017 12:54
CSS code for setting custom image to a payment method in OnPay form
<style>
.payment_method_label .logo.billplz {
background-image: url(//s28.postimg.org/lr4960ft9/billplz-demo.jpg);
background-size: auto;
background-position: 0;
width: 318px;
height: 158px;
}
</style>
@apih
apih / code.html
Created June 1, 2017 06:46
JS code for removing banks logo in payment method options in OnPay form
<script type="text/javascript">
// Remove banks logo in payment method options
$(".payment_method_label .logo.banks").remove();
</script>
@apih
apih / code.html
Last active May 29, 2017 16:12
JS code for selecting first shipping region if no shipping region is selected yet in OnPay form
<script type="text/javascript">
// Select first shipping region if no shipping region is selected yet
if ($("[name='shipping_region']:checked").length === 0) {
$("[name='shipping_region']:first").prop("checked", true);
}
</script>