X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   At long last - edit Gift Certificate numbers and values from your admin panel (https://forum.x-cart.com/showthread.php?t=48288)

necroflux 06-25-2009 09:43 AM

At long last - edit Gift Certificate amounts and codes from your admin panel
 
This nice little elegant mod will allow you to add value back to a Gift Certificate when necessary, or even change the code itself if you'd like to use a custom Gift Certificate code.

It's safe too because it requires entering "edit mode" before you can change any of these values, lessening the probability of an accidental edit.

First, in /admin/giftcerts.php, BEFORE:

Code:

        $expired_condition=($config["Gift_Certificates"]["gc_show_expired"]=="Y"?"":" and status!='E'");

Add (right after the else):

Code:

        if($_GET["mode"]=="edit_values") {
                $smarty->assign("edit_values", true);
        }


In /skin1/modules/Gift_Certificates/gc_admin.tpl, after:

Code:

<form name="gcform" action="giftcerts.php" method="post">
<input type="hidden" name="mode" value="" />
<input type="hidden" name="tpl_file" value="" />

{if $giftcerts ne ""}


Add:

Code:

{if $edit_values}
<div style="float:right"><a href="/cart/admin/giftcerts.php">Leave GC code/amount edit mode</a></div>
{else}
<div style="float:right"><a href="/cart/admin/giftcerts.php?mode=edit_values">Change GC code/amount</a></div>
{/if}


Find:

Code:

<td><a href="giftcerts.php?mode=modify_gc&amp;gcid={$giftcerts[gc_num].gcid}">{$giftcerts[gc_num].gcid}</a>{if $giftcerts[gc_num].orderid} &nbsp;<img src="{$ImagesDir}/lock.gif" />{/if}</td>

And replace it with:
Code:

        {if $edit_values}
        <td><input type="text" name="gcid-{$giftcerts[gc_num].gcid}" value="{$giftcerts[gc_num].gcid}" style="width:120px"></td>
        {else}
        <td><a href="giftcerts.php?mode=modify_gc&amp;gcid={$giftcerts[gc_num].gcid}">{$giftcerts[gc_num].gcid}</a>{if $giftcerts[gc_num].orderid} &nbsp;<img src="{$ImagesDir}/lock.gif" />{/if}</td>
        {/if}


Finally find:

Code:

        {include file="currency.tpl" value=$giftcerts[gc_num].debit}/{include file="currency.tpl" value=$giftcerts[gc_num].amount}

And replace it with:

Code:

        {if $edit_values}
        <input type="text" name="debit-{$giftcerts[gc_num].gcid}" value="{$giftcerts[gc_num].debit}" style="width:60px">  /{include file="currency.tpl" value=$giftcerts[gc_num].amount}
        {else}
        {include file="currency.tpl" value=$giftcerts[gc_num].debit}/{include file="currency.tpl" value=$giftcerts[gc_num].amount}
        {/if}


For appearances sake, I also prefer to change (on line 180):

Code:

<td align="center" nowrap="nowrap">

To:

Code:

<td align="left" nowrap="nowrap" style="padding-left:5px">

2coolbaby 07-23-2009 02:51 PM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
Will this work for 4.1.18?

I know I wish I could hide Gift Certificates without deleting. I have to delete them because they create an un-managable looooonnnnnggg list. But I would rather be able to keep them so I have a record of Gift Certificates sent.

It would also be nice to be able to sort by date added and add a visible note. Instead I have to make my note as the From field, so I know what it is for. Not very intiutive,. Anyone know of a mod that might have these features?

cherie 10-14-2009 03:09 PM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
Quote:

Originally Posted by 2coolbaby
Will this work for 4.1.18?


This worked fine with 4.1. I don't think GC changed much from 4.1 to 4.2.

MAPerformance Admin 10-27-2014 04:58 AM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
Can anyone help make this work on 4.4? I tried, but the step requiring replacing this code does not exist in 4.4's /skin/common_files/modules/Gift_Certificates/gc_admin.tpl

Code:

{include file="currency.tpl" value=$giftcerts[gc_num].debit}/{include file="currency.tpl" value=$giftcerts[gc_num].amount}

cherie 10-27-2014 07:48 AM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
Currency changed in 4.4 so change:
Code:

{include file="currency.tpl" value=...
to:
Code:

{currency value=...
This is untested in this code and there may be other changes with 4.4 that affect this customization.

MAPerformance Admin 10-27-2014 01:09 PM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
Thanks! I made that change, but unfortunately I'm not seeing anywhere to actually edit a gift certificate. Where does the interface change to allow the editing?

cherie 10-27-2014 01:14 PM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
Looks like there should be a new Change link added to gc_admin.tpl

MAPerformance Admin 10-28-2014 05:14 AM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
1 Attachment(s)
All right, I got this working on 4.4.3. All steps are the same as outlined in the OP, aside from these minor changes:

This file
Code:

/skin1/modules/Gift_Certificates/gc_admin.tpl

Is located in your site's skin directory, either
Code:

/skin/common_files/modules/Gift_Certificates/gc_admin.tpl

or
Code:

/skin/YOUR_SKIN/modules/Gift_Certificates/gc_admin.tpl

And this step:
Code:

{include file="currency.tpl" value=$giftcerts[gc_num].debit}/{include file="currency.tpl" value=$giftcerts[gc_num].amount}

should read:
Code:

{currency value=$giftcerts[gc_num].debit}/{currency value=$giftcerts[gc_num].amount}

The edit link appears in the Gift Certificate screen as shown in the attachment, and when clicked, changes the "GiftCert ID" and "Rem./Amount fields" into editable fields. One thing to note, is that the Amount field can not be changed to anything larger than the original value of the GC, but anything equal to or less is fine.

mcanitano 10-29-2014 08:28 AM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
Quote:

Originally Posted by MAPerformance Admin
All right, I got this working on 4.4.3. All steps are the same as outlined in the OP, aside from these minor changes:

This file
Code:

/skin1/modules/Gift_Certificates/gc_admin.tpl

Is located in your site's skin directory, either
Code:

/skin/common_files/modules/Gift_Certificates/gc_admin.tpl

or
Code:

/skin/YOUR_SKIN/modules/Gift_Certificates/gc_admin.tpl

And this step:
Code:

{include file="currency.tpl" value=$giftcerts[gc_num].debit}/{include file="currency.tpl" value=$giftcerts[gc_num].amount}

should read:
Code:

{currency value=$giftcerts[gc_num].debit}/{currency value=$giftcerts[gc_num].amount}

The edit link appears in the Gift Certificate screen as shown in the attachment, and when clicked, changes the "GiftCert ID" and "Rem./Amount fields" into editable fields. One thing to note, is that the Amount field can not be changed to anything larger than the original value of the GC, but anything equal to or less is fine.


I can confirm this works on 4.5.5 (mostly because X-Cart never changed the gc_admin.tpl file from XC v4.4.4 to 4.5.5. My file still says [v8 (xcart_4_4_4), etc....] at the top)! :)

Dougrun 10-29-2014 12:13 PM

Re: At long last - edit Gift Certificate numbers and values from your admin panel
 
anyone on 4.6.x try it?


All times are GMT -8. The time now is 10:16 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.