Skip to content

Commit

Permalink
#32: Correct admin date dropdown display
Browse files Browse the repository at this point in the history
... by creating an admin "clone" of the storefront function, providing
the `$_SESSION['customer_id']` value that the storefront function
expects!
  • Loading branch information
lat9 committed Apr 30, 2019
1 parent 86f102c commit be21de3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,15 @@ function snap_submit_button($name, $text, $class = '', $parms = '')
}
return $submit_button;
}

// -----
// This function, used on the plugin's admin processing page, "adapts" the storefront date dropdown
// for admin-level use.
//
function snap_admin_get_date_dropdown($prefix, $selected_month, $selected_year, $referrer_customer_id)
{
$_SESSION['customer_id'] = $referrer_customer_id;
$dropdown = snap_get_date_dropdown($prefix, $selected_month, $selected_year);
unset($_SESSION['customer_id']);
return $dropdown;
}
4 changes: 2 additions & 2 deletions YOUR_ADMIN/includes/init_includes/init_snap_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
if (!defined('IS_ADMIN_FLAG') || IS_ADMIN_FLAG !== true) {
die('Illegal Access');
}
define('SNAP_MODULE_CURRENT_VERSION', '4.1.0');
define('SNAP_MODULE_UPDATE_DATE', '2019-04-25');
define('SNAP_MODULE_CURRENT_VERSION', '4.1.1-beta1');
define('SNAP_MODULE_UPDATE_DATE', '2019-04-30');

// -----
// Wait until an admin is logged in to perform any operations, so that any generated
Expand Down
2 changes: 1 addition & 1 deletion YOUR_ADMIN/referrers.php
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ function showHideDetails() {
<table class="table">
<tr>
<td><h3><?php echo TEXT_ORDER_HISTORY; ?></h3></td>
<td align="right"><?php echo TEXT_FROM . snap_get_date_dropdown('start', $start_mon, $start_year) . TEXT_TO . snap_get_date_dropdown('end', $end_mon, $end_year) . '&nbsp;&nbsp;' . snap_submit_button('choose', TEXT_CHOOSE); ?></td>
<td align="right"><?php echo TEXT_FROM . snap_admin_get_date_dropdown('start', $start_mon, $start_year, $referrers[$selected]['customers_id']) . TEXT_TO . snap_admin_get_date_dropdown('end', $end_mon, $end_year, $referrers[$selected]['customers_id']) . '&nbsp;&nbsp;' . snap_submit_button('choose', TEXT_CHOOSE); ?></td>
</tr>
</table></form>
</td>
Expand Down
9 changes: 8 additions & 1 deletion docs/snap_affiliates/readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<body>
<a name="top" id="top"></a>
<h1>Snap Affiliates for Zen Cart 1.5.5a and later</h1>
<h3>Version 4.1.0 by lat9</h3>
<h3>Version 4.1.1 by lat9</h3>
<p>Copyright &copy; 2013-2019 Vinos de Frutas Tropicales</p>
<p>Current support thread at Zen Cart Forums: <a href="http://www.zen-cart.com/showthread.php?206579-Snap-Affiliates-v2-0-for-Zen-Cart-v1-5-0-and-later" target="_blank">www.zen-cart.com/showthread.php?206579-Snap-Affiliates-v2-0-for-Zen-Cart-v1-5-0-and-later</a>. This software is provided for your use under the GNU General Public License v2.0.</p>

Expand Down Expand Up @@ -252,6 +252,13 @@ <h2 id="install">Installation</h2>
<h2>Version History:</h2>
<p>This plugin is based on v1.0.2.1 of the <a href="https://www.zen-cart.com/downloads.php?do=file&amp;id=898"><em>Snap Affiliates</em></a> add-on developed for the 1.3.x versions of Zen Cart&reg;, but this version (v4.0.0 and later) has been modified for v1.5.5 and later <em>only</em>.</p>
<ul>
<li>v4.1.1, 2019-04-xx:<ul>
<li>BUGFIX: Admin tool's date dropdown limited to current year.</li>
<li>The following files were changed:<ol>
<li>/YOUR_ADMIN/referrers.php</li>
<li>/YOUR_ADMIN/includes/functions/extra_functions/referrers_functions.php</li>
</ol></li>
</ul></li>
<li>v4.1.0, 2019-04-25:<ul>
<li>CHANGE: <b>Major</b> restructuring to support Zen Cart 1.5.6 and future PHP/MySQL versions. If you are upgrading <em>SNAP Affiliates</em> and have made changes to its template files, be sure to merge your changes with those provided in the plugin's <code>/includes/templates/template_default</code> sub-directory for continued operation!</li>
<li>CHANGE: Clarify the description of the <em>Order Status Exclusions</em> configuration setting.</li>
Expand Down

0 comments on commit be21de3

Please sign in to comment.