Closed abrookbanks closed 3 years ago
Please elaborate on this.
When editing a customer, the admin wants to review what exactly?
Did this customer buy the GC? And the details to show is that of the recipient and current status of the GC?
Are the details of the GC going to be editable?
Not sure yet. I fire fighting right now thanks to schools being closed. Literally half my day is looking after young kids thanks to this f@*king virus.
Hoping to be able to be 100% back by mid March.
Ok, I will start doing some things. Will not be editable to start. Simply shows details.
Thank you Brian. 🙏🏻
..... I'll be sure to use the new WIP tag.
I have put together something.
I still have the question: why? Have purchasers been calling and inquiring about the GCs usage?
Good question. All I know via support is that one of our merchants wanted to get it on behalf of a customer.
Do you think this will be a 'highly-used' and 'greatly appreciated' by a very large number of CubeCart admins?
Well, here are the code edits:
customers.index.php, find the fieldset for the password fields on the General tab.
Add this new fieldset above that:
<fieldset><legend>Gift Certificates From This Customer</legend>{* From CubeCart_coupons *}
<table width="100%">
<thead>
<tr>
<td width="5em">{$GCTHEAD.status}</td>
<td>{$GCTHEAD.code}</td>
<td>{$GCTHEAD.cart_order_id}</td>
<td>{$GCTHEAD.discount_price}</td>
<td width="5em">{$GCTHEAD.email_sent}</td>
</tr>
</thead>
<tbody>
{foreach $CUSTOMER.gift_certs as $gc}
<tr>
<td align="center">{if $gc.status==1}<i class="fa fa-check" title="{$LANG.common.yes}"></i>{else}<i class="fa fa-times" title="{$LANG.common.no}"></i>{/if}</td>
<td>{$gc.code}</td>
<td>{$gc.cart_order_id}</td>
<td>{$gc.discount_price}</td>
<td align="center">{if $gc.email_sent==1}<i class="fa fa-check" title="{$LANG.common.yes}"></i>{else}<i class="fa fa-times" title="{$LANG.common.no}"></i>{/if}</td>
</tr>
<tr>
<td colspan="5">
<div class="note">
{foreach $gc.custom as $gcdetail}
{if $gcdetail@last}
<strong>{$gcdetail@key|capitalize}:</strong> {$gcdetail|escape:'html'}
{else}
<strong>{$gcdetail@key|capitalize}:</strong> {$gcdetail|escape:'html'},
{/if}
{/foreach}
</div>
</td>
</tr>
{foreachelse}
<tr>
<td colspan="5" align="center"><strong>{$LANG.form.none}</strong></td>
</tr>
{/foreach}
</tbody>
</table>
</fieldset>
customers.index.inc.php, find:
$customer['subscription_status'] = $GLOBALS['db']->select('CubeCart_newsletter_subscriber', false, array('email' => $customer['email']));
}
Add after:
$gcthead_sort = array( 'status' => "Status", 'cart_order_id' => "Order", 'code' => "Code", 'discount_price' => "Balance", 'email_sent' => "Sent?"); $GLOBALS['smarty']->assign('GCTHEAD', $gcthead_sort);
$gift_cert_orders = $GLOBALS['db']->select('CubeCart_order_summary', array('cart_order_id'), array('customer_id' => $customer_id));
$gift_cert_orders_strings = array_map(function($x){ return "'".$x['cart_order_id']."'";}, $gift_cert_orders);
$gift_cert_inventory = $GLOBALS['db']->select('CubeCart_order_inventory as OI LEFT JOIN CubeCart_coupons as C ON OI.coupon_id = C.coupon_id', 'C.*,custom', 'OI.cart_order_id IN ('.implode(',',$gift_cert_orders_strings).') AND custom != ""');
array_walk($gift_cert_inventory, function(&$x){ $tempx = unserialize($x['custom']); switch ($tempx['method']) { case 'e':$tempx['method']='digital';break;case 'm':$tempx['method']='physical';break; } $x['custom'] = $tempx;});
$customer['gift_certs'] = $gift_cert_inventory;
As above. Currently there's no means for the administrator to review this.