Forums / General Questions / Can Anyone Help Me Make a Simple "Credit Account" Mod?

Can Anyone Help Me Make a Simple "Credit Account" Mod?

Views: 1,455

Results 1 to 20 of 26
20 Feb 2013, 4:41 PM
#1
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Can Anyone Help Me Make a Simple "Credit Account" Mod?

I have looked about any haven’t found anything basic that seems to do this. There is a mod that has the functionality but it changes way more stuff than I need.

Basically I want to develop a simple mod to the customers info page within the admin, whereby I can have an input field with a go button which when you enter a value in and hit go it adds that value to the customers GV balance and (not essential) but prefereably emails the customer to alert them that credit has been added to their account.

The reason for this is that I would like to apply credit rather than emailing a GV code for the customer to fill in and additionally be able select the customer based on their order id.
So a customer places an order. I then want to add credit to the account which placed order #1234. So I go to order #1234, select the customer details, which brings up the customers.php with the customer highlighted, then on the right there is the box that has the following:

[EDIT] [DELETE]
[ORDERS] [EMAIL]
Account Created: 11/26/2012
Last Modified: 12/30/2012
Last Logon: 01/07/2013
Number of Logons: 10
GV Balance £833.64
Number of Orders: 6
Last Order: 01/07/2013
Total: £0.00
Country: United Kingdom
Number of Reviews: 0
Customer Referral
1st Discount Coupon

What I would like to do is add above the GV Balance £833.64 something like this:

Add Credit [INTPUT FIELD] [GO BUTTON]

Then, once it’s clicked the GV Balance will now be updated with the new balance.

I find having to find the email address of a customer from their order, then going to gv_mail.php then trying to find that email on the drop down list is a bit of a pig.

If there is a mod that does exactly this can someone point me in the right direction?

If not, then does anyone know a simple way this can be achieved? is it a simple case of adding switch cases to the customers page code to run the db query?

Ta,

Phil Rogers
A problem shared is a problem solved.

20 Feb 2013, 5:29 PM
#2
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

So starting to look at the sql logic, so heres what i'm thinking for the sql:

SELECT EXISTS(SELECT * FROM coupon_gv_customer WHERE customer_id = 5170)

then if the result is 1 do this:
UPDATE coupon_gv_customer SET amount = amount + $_POST WHERE customer_id = $customer_id

if the result is 0 do this:
INSERT INTO coupon_gv_customer (amount, customer_id) ($_POST, $customer_id)

Does that sound right?

Phil Rogers
A problem shared is a problem solved.

20 Feb 2013, 6:31 PM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

philip937:

Basically I want to develop a simple mod to the customers info page within the admin, whereby I can have an input field with a go button which when you enter a value in and hit go it adds that value to the customers GV balance and (not essential) but prefereably emails the customer to alert them that credit has been added to their account.

The reason for this is that I would like to apply credit rather than emailing a GV code for the customer to fill in and additionally be able select the customer based on their order id.
Is this intended for handling returns? Or something else?
If it's for returns, it would make smarter sense to do this in a plugin that takes into account the many other things involved in a return also.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Feb 2013, 6:37 PM
#4
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

Is this intended for handling returns? Or something else?
If it's for returns, it would make smarter sense to do this in a plugin that takes into account the many other things involved in a return also.

No nothing to do with returns. Simply rewarding customers with credit. The customers to be rewarded will be identified to me by their order id so I will be looking up the order, then selecting the customer by clicking the customer details icon. From there I want to be able to apply credit to the GV balance.

Phil Rogers
A problem shared is a problem solved.

21 Feb 2013, 4:00 PM
#5
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

Dr Byte, i've started looking at the customers.php file and im a little lost if i'm honest.

I am assuming that i need to add my input feild and button somewhere which links to a new switch action? and for that case to run the db query based on the customer_id & value in the input field?

Would you be kind enough to point me in the right direction/area of code and i'll see how far I can get from there?

Many thanks,

Phil Rogers
A problem shared is a problem solved.

21 Feb 2013, 4:10 PM
#6
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,721
Plugin Contributions:
56

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

Why not use the built-in gift voucher utility?

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

21 Feb 2013, 4:16 PM
#7
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

swguy:

Why not use the built-in gift voucher utility?

swguy, mainly because trying to find a customer from the drop down list of thousands of emails is next to impossible. Also from memory dont the reciprients have to apply the voucher too?

I want to achieve two things really.

  1. be able to apply credit from a customers account information view/ customers view
  2. want the credit to apply instantly without them having to apply it themselves.

any thoughts?

Phil Rogers
A problem shared is a problem solved.

21 Feb 2013, 4:29 PM
#8
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,721
Plugin Contributions:
56

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

Use the built-in gift voucher utility. Enter his name in the Email To field. Yes, you would have to give up point 2, but my suggested solution doesn't involve writing a bunch of software.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

21 Feb 2013, 4:30 PM
#9
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

I guess a alternate solution (IF ITS POSSIBLE) would be to have a link to the gv page from the customers info page which sets a param which pre selects their email from the drop down?

still don't like the idea of them havin to apply the credit though as what I am doing is adding credit not offering a voucher as such.

Phil Rogers
A problem shared is a problem solved.

21 Feb 2013, 6:39 PM
#10
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

swguy:

Use the built-in gift voucher utility. Enter his name in the Email To field. Yes, you would have to give up point 2, but my suggested solution doesn't involve writing a bunch of software.

Why does anyone make mods?

To get zen cart to do something that it doesn't already offer.

I want to be able to credit accounts not send gift vouchers so I guess that's why I don't want to use the send gift voucher facility to add the credit.

I shall carry on scratching my head here.

Phil Rogers
A problem shared is a problem solved.

21 Feb 2013, 6:58 PM
#11
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

There is a mod that has the functionality but it changes way more stuff than I need.
You might best start by looking at that mod, and strip off the code that does extraneous things. Or at least use it as a guide to where to start building your desired function.

21 Feb 2013, 7:08 PM
#12
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

gjh42:

You might best start by looking at that mod, and strip off the code that does extraneous things. Or at least use it as a guide to where to start building your desired function.

Good suggestion gjh42, I will do that though I suspect it's probably a standalone mod from what I read of the description, and all I want to do is add an extra button to the customers.php page.

I'm think probably the easiest place for me to do it is in the edit section of the customers.php and then duplicate the update action OR incorporate the extra field I want in the update code.

Phil Rogers
A problem shared is a problem solved.

21 Feb 2013, 9:27 PM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

In /admin/orders.php there is a section of "case" statements in the first several hundred lines. Put the following directly above the "case: deleteconfirm" line: case 'push_gv_credit': if (isset($_POST['push_gv_amount'])) { $oID = zen_db_prepare_input($_POST['oID']); $amount = abs(preg_replace('/[^0-9.]/', '', $_POST['push_gv_amount'])); if ($amount <= 0 || (int)$oID == 0) break; $custinfo = $db->Execute("select customers_id, customers_email_address, customers_name from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); if ($custinfo->RecordCount() == 0) break; $customers_id = $custinfo->fields['customers_id']; $result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$customers_id . "'"); if ($result->RecordCount() > 0) { $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = amount + '" . $amount . "' where customer_id = '" . (int)$customers_id . "'"); } else { $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . (int)$customers_id . "', '" . $amount . "')"); } $custinfo = $db->Execute("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'"); $subject = 'Credit applied to your account'; $message = ''; $message .= "Please note that a Gift Voucher credit has been applied to your account in the amount of " . $currencies->format($amount) . ".\n\n"; $message .= "You can apply it to any future purchases during checkout.\n\nWe appreciate your business and look forward to serving your needs in the future."; $html_msg['EMAIL_MESSAGE_HTML'] = $message; $html_msg['EMAIL_FIRST_NAME'] = $custinfo->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $custinfo->fields['customers_lastname']; $message .= "\n\n\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; zen_mail($custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], $custinfo->fields['customers_email_address'], $subject , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'push_gv_credit'); $messageStack->add_session('GV amount of ' . $amount . ' applied to customer account: ' . $custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], 'success'); zen_redirect(zen_href_link(FILENAME_ORDERS, 'oID=' . (int)$oID . '&page=' . $_GET['page'], 'NONSSL')); } break;and then near the bottom of the file is a "default:" statement. Put this bit of code above the line shown:```
[B] $contents[] = array('text' => zen_draw_form('push_gv_credit', FILENAME_ORDERS, 'action=push_gv_credit&page=' . $_GET['page'], 'post', 'enctype="multipart/form-data"'));
$contents[] = array('text' => '<br>Give GV credit: <br>' . zen_draw_input_field('push_gv_amount') . zen_draw_hidden_field('oID', $oInfo->orders_id) . '</form>');
[/B] $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . zen_date_short($oInfo->date_purchased));


If you wanted to do it in the /admin/customers.php file instead, it would look like the following. Same placement idea applies. A good spot for this one is above "case: update":```
      case 'push_gv_credit':
        if (isset($_POST['push_gv_amount']))
        {
          $amount = abs(preg_replace('/[^0-9.]/', '', $_POST['push_gv_amount']));
          if ($amount <= 0) break;
          $result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$customers_id . "'");
          if ($result->RecordCount() > 0) {
            $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = amount + '" . $amount . "' where customer_id = '" . (int)$customers_id . "'");
          } else {
            $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . (int)$customers_id . "', '" . $amount . "')");
          }
          $custinfo = $db->Execute("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'");
          $subject = 'Credit applied to your account';
          $message = '';
          $message .= "Please note that a Gift Voucher credit has been applied to your account in the amount of " . $currencies->format($amount) . ".\n\n";
          $message .= "You can apply it to any future purchases during checkout.\n\nWe appreciate your business and look forward to serving your needs in the future.";
          $html_msg['EMAIL_MESSAGE_HTML'] = $message;
          $html_msg['EMAIL_FIRST_NAME'] = $custinfo->fields['customers_firstname'];
          $html_msg['EMAIL_LAST_NAME']  = $custinfo->fields['customers_lastname'];
          $message .= "\n\n\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
          zen_mail($custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], $custinfo->fields['customers_email_address'], $subject , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'push_gv_credit');
          $messageStack->add_session('GV amount of ' . $amount . ' applied to customer account: ' . $custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], 'success');
          zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . (int)$customers_id . '&page=' . $_GET['page'], 'NONSSL'));
        }
        break;
```And at the bottom:```
        $contents[] = array('text' => '<br />' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customer_gv_balance));
        $contents[] = array('text' => zen_draw_form('push_gv_credit', FILENAME_CUSTOMERS, 'action=push_gv_credit&page=' . $_GET['page'], 'post', 'enctype="multipart/form-data"'));
        $contents[] = array('text' => '<br>Give GV credit: <br>' . zen_draw_input_field('push_gv_amount') . zen_draw_hidden_field('cID', $cInfo->customers_id) . '</form>');

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

21 Feb 2013, 9:31 PM
#14
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

DrByte:

In /admin/orders.php there is a section of "case" statements in the first several hundred lines. Put the following directly above the "case: deleteconfirm" line: case 'push_gv_credit': if (isset($_POST['push_gv_amount'])) { $oID = zen_db_prepare_input($_POST['oID']); $amount = abs(preg_replace('/[^0-9.]/', '', $_POST['push_gv_amount'])); if ($amount <= 0 || (int)$oID == 0) break; $custinfo = $db->Execute("select customers_id, customers_email_address, customers_name from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); if ($custinfo->RecordCount() == 0) break; $customers_id = $custinfo->fields['customers_id']; $result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$customers_id . "'"); if ($result->RecordCount() > 0) { $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = amount + '" . $amount . "' where customer_id = '" . (int)$customers_id . "'"); } else { $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . (int)$customers_id . "', '" . $amount . "')"); } $custinfo = $db->Execute("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'"); $subject = 'Credit applied to your account'; $message = ''; $message .= "Please note that a Gift Voucher credit has been applied to your account in the amount of " . $currencies->format($amount) . ".\n\n"; $message .= "You can apply it to any future purchases during checkout.\n\nWe appreciate your business and look forward to serving your needs in the future."; $html_msg['EMAIL_MESSAGE_HTML'] = $message; $html_msg['EMAIL_FIRST_NAME'] = $custinfo->fields['customers_firstname']; $html_msg['EMAIL_LAST_NAME'] = $custinfo->fields['customers_lastname']; $message .= "\n\n\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n"; zen_mail($custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], $custinfo->fields['customers_email_address'], $subject , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'push_gv_credit'); $messageStack->add_session('GV amount of ' . $amount . ' applied to customer account: ' . $custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], 'success'); zen_redirect(zen_href_link(FILENAME_ORDERS, 'oID=' . (int)$oID . '&page=' . $_GET['page'], 'NONSSL')); } break;and then near the bottom of the file is a "default:" statement. Put this bit of code above the line shown:```
[B] $contents[] = array('text' => zen_draw_form('push_gv_credit', FILENAME_ORDERS, 'action=push_gv_credit&page=' . $_GET['page'], 'post', 'enctype="multipart/form-data"'));
$contents[] = array('text' => '<br>Give GV credit: <br>' . zen_draw_input_field('push_gv_amount') . zen_draw_hidden_field('oID', $oInfo->orders_id) . '</form>');
[/B] $contents[] = array('text' => '<br />' . TEXT_DATE_ORDER_CREATED . ' ' . zen_date_short($oInfo->date_purchased));

> 
> If you wanted to do it in the /admin/customers.php file instead, it would look like the following. Same placement idea applies. A good spot for this one is above "case: update":```
      case 'push_gv_credit':
        if (isset($_POST['push_gv_amount']))
        {
          $amount = abs(preg_replace('/[^0-9.]/', '', $_POST['push_gv_amount']));
          if ($amount <= 0) break;
          $result = $db->Execute("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$customers_id . "'");
          if ($result->RecordCount() > 0) {
            $db->Execute("update " . TABLE_COUPON_GV_CUSTOMER . " set amount = amount + '" . $amount . "' where customer_id = '" . (int)$customers_id . "'");
          } else {
            $db->Execute("insert into " . TABLE_COUPON_GV_CUSTOMER . " (customer_id, amount) values ('" . (int)$customers_id . "', '" . $amount . "')");
          }
          $custinfo = $db->Execute("select customers_email_address, customers_firstname, customers_lastname from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'");
          $subject = 'Credit applied to your account';
          $message = '';
          $message .= "Please note that a Gift Voucher credit has been applied to your account in the amount of " . $currencies->format($amount) . ".\n\n";
          $message .= "You can apply it to any future purchases during checkout.\n\nWe appreciate your business and look forward to serving your needs in the future.";
          $html_msg['EMAIL_MESSAGE_HTML'] = $message;
          $html_msg['EMAIL_FIRST_NAME'] = $custinfo->fields['customers_firstname'];
          $html_msg['EMAIL_LAST_NAME']  = $custinfo->fields['customers_lastname'];
          $message .= "\n\n\n-----\n" . sprintf(EMAIL_DISCLAIMER, STORE_OWNER_EMAIL_ADDRESS) . "\n\n";
          zen_mail($custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], $custinfo->fields['customers_email_address'], $subject , $message, STORE_NAME, EMAIL_FROM, $html_msg, 'push_gv_credit');
          $messageStack->add_session('GV amount of ' . $amount . ' applied to customer account: ' . $custinfo->fields['customers_firstname'] . ' ' . $custinfo->fields['customers_lastname'], 'success');
          zen_redirect(zen_href_link(FILENAME_CUSTOMERS, 'cID=' . (int)$customers_id . '&page=' . $_GET['page'], 'NONSSL'));
        }
        break;
```And at the bottom:```
        $contents[] = array('text' => '<br />' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customer_gv_balance));
        $contents[] = array('text' => zen_draw_form('push_gv_credit', FILENAME_CUSTOMERS, 'action=push_gv_credit&page=' . $_GET['page'], 'post', 'enctype="multipart/form-data"'));
        $contents[] = array('text' => '<br>Give GV credit: <br>' . zen_draw_input_field('push_gv_amount') . zen_draw_hidden_field('cID', $cInfo->customers_id) . '</form>');

Dude you are amazing. Will try this tomorrow thank you so much! Will report back as soon as I have :)

Phil Rogers
A problem shared is a problem solved.

22 Feb 2013, 3:25 PM
#15
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

$contents[] = array('text' => '<br />' . TEXT_INFO_GV_AMOUNT . ' ' . $currencies->format($customer_gv_balance));
        $contents[] = array('text' => zen_draw_form('push_gv_credit', FILENAME_CUSTOMERS, 'action=push_gv_credit&page=' . $_GET['page'], 'post', 'enctype="multipart/form-data"'));
        $contents[] = array('text' => '<br>Give GV credit: <br>' . zen_draw_input_field('push_gv_amount') . zen_draw_hidden_field('cID', $cInfo->customers_id) . '</form>');

DrByte,

Just trying it now. struggling a little with the placement of the last bit of code for the customers.php file.

I placed it at the bottom of the file, the field is output to the right side of the list of customers. was this how you intended or is it an additional field for the edit customers view? I ask because there is no button so I assumed you had made it for there?

Phil Rogers
A problem shared is a problem solved.

22 Feb 2013, 3:36 PM
#16
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

Tested for both customers with a GV balance and customers with no GV balance. Works perfectly!! thanks so much

Phil Rogers
A problem shared is a problem solved.

22 Feb 2013, 3:37 PM
#17
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

is there a way I can properly include a go button? at the moment I just have the input field and and pressing <CR> to initiate. other than that, PERFECT!!

Phil Rogers
A problem shared is a problem solved.

22 Feb 2013, 3:53 PM
#18
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

just had a thought. probably should wrap an if statement around the input field so that it only shows when GV is enabled??

Phil Rogers
A problem shared is a problem solved.

22 Feb 2013, 6:43 PM
#19
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

philip937:

the field is output to the right side of the list of customers. was this how you intended
Yes

philip937:

Tested for both customers with a GV balance and customers with no GV balance. Works perfectly!! thanks so much
:clap:
Shameless plug: donations always appreciated: https://www.zen-cart.com/donate

philip937:

is there a way I can properly include a go button? at the moment I just have the input field and and pressing <CR> to initiate. other than that, PERFECT!!
You could add a zen_submit_button function call anywhere before the closing </form> in the additional code bit at the bottom of the file.
Indeed there is much that could stand to be "prettified" about it.

philip937:

just had a thought. probably should wrap an if statement around the input field so that it only shows when GV is enabled??
You could do that by checking whether MODULE_ORDER_TOTAL_GV_STATUS is defined.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

22 Feb 2013, 7:20 PM
#20
philip937 avatar

philip937

Totally Zenned

Join Date:
Aug 2009
Location:
Bedford, England
Posts:
968
Plugin Contributions:
0

Re: Can Anyone Help Me Make a Simple "Credit Account" Mod?

DrByte:

Yes

:clap:
Shameless plug: donations always appreciated: https://www.zen-cart.com/donate

You could add a zen_submit_button function call anywhere before the closing </form> in the additional code bit at the bottom of the file.
Indeed there is much that could stand to be "prettified" about it.

You could do that by checking whether MODULE_ORDER_TOTAL_GV_STATUS is defined.

Donation sent :-)

I shall dabble a bit more with it to get it finished off :)

Phil Rogers
A problem shared is a problem solved.