Zen Cart Logo
Forums / Addon Payment Modules / COD by IP Address

COD by IP Address

Views: 654

Results 1 to 1 of 1
23 Sep 2012, 5:51 PM
#1
fooddudes avatar

fooddudes

New Zenner

Join Date:
Nov 2008
Posts:
33
Plugin Contributions:
0

COD by IP Address

I have COD by IP Address installed in zen cart version 1.38a.
http://www.zen-cart.com/downloads.php?do=file&id=578
I have a tipfield installed on the tpl_checkout_payment_default.php and would like to remove this from showing when we are taking phone orders using COD by IP. Using one ip address under the configuration/mystore the tipfield doesn't show with the following conditional statement.

<?php $cod_ips=array(COD_IP); for ($ip = 0; $ip < count($cod_ips); $ip++) { $exprow = explode (",", $cod_ips[$ip]); for ($exp = 0; $exp < count($exprow); $exp++) { if (!$_SERVER['REMOTE_ADDR'] == $exprow[$exp]) { ?> <fieldset id="tipfield"> <legend><?php echo "Gratuity"; ?></legend> <div id="tipcont"> Select a percentage from the drop down list below<br/><br/> <option value="0">None</option> <option value="10">10%</option> <option value="12">12%</option> <option value="15" SELECTED>15%</option> <option value="18">18%</option> <option value="20">20%</option> <option value="22">22%</option> <option value="25">25%</option> <option value="28">28%</option> <option value="30">30%</option> <?php $curtotal = $order->info['total'] - $_SESSION['paytipval']; ?> </select> <input type="hidden" id="tot" name="tot" value="<?php echo $curtotal; ?>"> <span id='selectedResult'></span> </div> </fieldset> <?php } } } ?>

When I add more than one ip addressing using a comma, the conditional statement no longer works and the tipfield is repeated on the page for each additional ip address. (e.g. 3 ip addresses would then show 2 tip fields)

Do i need to change the conditional statement or the sql statement?

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES ('COD IP', 'COD_IP', 'yourip', 'These IPs will see the COD payment option. Enter IP addresses serpated by a comma', 1, 24, now(), now(), NULL, NULL);

Thanks in advance.