Skip to content

Commit 243aa01

Browse files
authored
Merge pull request #4 from lukman008/patch/inventory
inventory patch
2 parents de5b68d + 9bb2dc9 commit 243aa01

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

admin/class-paystack-forms-admin.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,13 +577,11 @@ function kkd_pff_paystack_editor_add_quantity_data()
577577
if($useinventory == "yes" && $usequantity == "yes"){
578578
echo '<p>Total Inventory</p>';
579579
echo '<input type="number" min="'.$sold.'" name="_inventory" value="' . $inventory . '" class="widefat pf-number" />';
580-
echo '<p>In stock</p>';
581-
echo '<input type="number" readonly name="_in_stock" value="' . $stock . '" class="widefat pf-number" />
580+
echo '<p>Already sold</p>';
581+
echo '<input type="number" name="_sold" value="' . $sold . '" class="widefat pf-number" />
582582
<small></small>
583-
<br/>
584-
<div style="height:64px;">
585-
<input type="button" onclick="'. update_post_meta($post->ID, "_sold", 0) .';window.location.reload()" value="RESET STOCK" style="float: right;background-color: #007cba;border: none;color: white;margin-top: 15px;padding: 5px 12px;text-align: center;text-decoration: none;display: block;font-size: 12px;border-radius:3px;"/>
586-
</div>';
583+
<br/>'
584+
;
587585

588586
}
589587

@@ -718,6 +716,7 @@ function kkd_pff_paystack_save_data($post_id, $post)
718716
$form_meta['_recurplan'] = $_POST['_recurplan'];
719717
$form_meta['_usequantity'] = $_POST['_usequantity'];
720718
$form_meta['_quantity'] = $_POST['_quantity'];
719+
$form_meta['_sold'] = $_POST['_sold'];
721720
$form_meta['_quantityunit'] = $_POST['_quantityunit'];
722721

723722
$form_meta['_useagreement'] = $_POST['_useagreement'];

public/class-paystack-forms-public.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ function kkd_pff_paystack_send_invoice($currency, $amount, $name, $email, $code)
915915
function kkd_pff_paystack_send_receipt($id, $currency, $amount, $name, $email, $code, $metadata)
916916
{
917917
// echo date('F j,Y');
918-
error_log(print_r("Sending reciept", TRUE));
918+
// error_log(print_r("Sending reciept", TRUE));
919919
$user_email = stripslashes($email);
920920
$subject = get_post_meta($id, '_subject', true);
921921
$heading = get_post_meta($id, '_heading', true);
@@ -3462,6 +3462,11 @@ function kkd_pff_paystack_confirm_payment()
34623462
if ($usequantity = "yes") {
34633463
$quantity = $_POST["quantity"];
34643464
$sold = get_post_meta($payment_array->post_id, '_sold', true);
3465+
// error_log(print_r("sold", TRUE));
3466+
// error_log(print_r($sold, TRUE));
3467+
// error_log(print_r(" - - - -- - -- - - -- - ", TRUE));
3468+
// error_log(print_r("Qty", TRUE));
3469+
// error_log(print_r($quantity, TRUE));
34653470
if ($sold == '') {
34663471
$sold = '0';
34673472
}
@@ -3470,6 +3475,7 @@ function kkd_pff_paystack_confirm_payment()
34703475

34713476

34723477
if (get_post_meta($payment_array->post_id, '_sold', false)) { // If the custom field already has a value
3478+
34733479
update_post_meta($payment_array->post_id, '_sold', $sold);
34743480
} else { // If the custom field doesn't have a value
34753481
add_post_meta($payment_array->post_id, '_sold', $sold);

0 commit comments

Comments
 (0)