Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

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

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 06-25-2009, 09:43 AM
 
necroflux necroflux is offline
 

Advanced Member
  
Join Date: Feb 2009
Posts: 47
 

Default 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">
__________________
-----------------
X-cart version 4.2.1
Reply With Quote
  #2  
Old 07-23-2009, 02:51 PM
  2coolbaby's Avatar 
2coolbaby 2coolbaby is offline
 

eXpert
  
Join Date: Sep 2004
Location: TN moving to FL
Posts: 265
 

Default 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?
__________________
Mary Lee
-------------------
Dinner and a Murder Mystery Games
http://www.dinnerandamurder.com

x-cart version 4.7.5 / Mac OS 10.10.5 and Windows 8/10 sometimes - Ideal Responsive Template
Reply With Quote
  #3  
Old 10-14-2009, 03:09 PM
  cherie's Avatar 
cherie cherie is online now
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #4  
Old 10-27-2014, 04:58 AM
 
MAPerformance Admin MAPerformance Admin is offline
 

Advanced Member
  
Join Date: Jun 2013
Posts: 44
 

Default 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}
__________________
X-cart 4.4.3 Gold
Modern Automotive Performance
Reply With Quote
  #5  
Old 10-27-2014, 07:48 AM
  cherie's Avatar 
cherie cherie is online now
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote

The following user thanks cherie for this useful post:
MAPerformance Admin (10-27-2014)
  #6  
Old 10-27-2014, 01:09 PM
 
MAPerformance Admin MAPerformance Admin is offline
 

Advanced Member
  
Join Date: Jun 2013
Posts: 44
 

Default 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?
__________________
X-cart 4.4.3 Gold
Modern Automotive Performance
Reply With Quote
  #7  
Old 10-27-2014, 01:14 PM
  cherie's Avatar 
cherie cherie is online now
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #8  
Old 10-28-2014, 05:14 AM
 
MAPerformance Admin MAPerformance Admin is offline
 

Advanced Member
  
Join Date: Jun 2013
Posts: 44
 

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

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.
Attached Thumbnails
Click image for larger version

Name:	Untitled-7.jpg
Views:	317
Size:	33.6 KB
ID:	3967  
__________________
X-cart 4.4.3 Gold
Modern Automotive Performance
Reply With Quote
  #9  
Old 10-29-2014, 08:28 AM
  mcanitano's Avatar 
mcanitano mcanitano is offline
 

eXpert
  
Join Date: Feb 2006
Location: Melbourne, FL
Posts: 216
 

Default 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)!
__________________
Marcello Canitano
New Site: X-Cart v4.5.5 GOLD
X-Cart Mobile v1.4.3
X-Payments v1.0.6
CDSEO Pro v2
Total Server Solutions xCDN

www.silverhorseracing.com
Reply With Quote

The following user thanks mcanitano for this useful post:
MAPerformance Admin (10-29-2014)
  #10  
Old 10-29-2014, 12:13 PM
 
Dougrun Dougrun is online now
 

X-Adept
  
Join Date: Apr 2012
Posts: 897
 

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

anyone on 4.6.x try it?
__________________
4.7.x xcart store
Business 5.4xx
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 03:31 AM.

   

 
X-Cart forums © 2001-2020