Jump to content
Vger

[CONTRIBUTION] CCGV (trad)

Recommended Posts

The problem doesn't manifest itself when sending the Gift Voucher - only when someone tries to redeem it from the link in the email they receive. In admin/includes/languages/english/cg_mail.php you need to locate this code:

 

define('TEXT_OR_VISIT', 'or visit ');

 

and put a couple of spaces in (there are other ways of doing it):

 

define('TEXT_OR_VISIT', ' or visit ');

 

Otherwise, when people get the links they will get the Gift Voucher number plus the first two letters of the next line, as in:

 

567321or

 

and this makes the link invalid.

 

Vger

 

strange... what problem are you refering to? I never had a problem using the GV SEND fle in admin

 

I haven't had a problem before and I use 5.10+ patches

Share this post


Link to post
Share on other sites

Glad you got it sorted.

 

Vger

I thought it was configure.php, but could not get it fixed. :angry:

After a couple of tries I got it.

I found that my changes were not getting saved due to permissions not being set on server. :blush:

I changed them, fixed directory and presto!!! :D

Share this post


Link to post
Share on other sites

have just completely reinstalled it and still getting this error

 

 

Fatal error: Cannot redeclare create_coupon_code() (previously declared in /home/kickassc/public_html/admin/includes/add_ccgvdc_application_top.php:25) in /home/kickassc/public_html/admin/includes/add_ccgvdc_application_top.php on line 25

 

 

any idea on how to fix this as its saying the error is caused by the same line i think

Share this post


Link to post
Share on other sites

These are the only files in which that code is used:

 

create_account.php(248): $coupon_code = create_coupon_code();

gv_send.php(52): $id1 = create_coupon_code($mail['customers_email_address']);

admin\coupon_admin.php(95): $coupon_code = create_coupon_code();

admin\gv_mail.php(42): $id1 = create_coupon_code($mail['customers_email_address']);

admin\gv_mail.php(67): $id1 = create_coupon_code($HTTP_POST_VARS['email_to']);

admin\includes\add_ccgvdc_application_top.php(25): function create_coupon_code($salt="secret", $length=SECURITY_CODE_LENGTH) {

includes\add_ccgvdc_application_top.php(36): function create_coupon_code($salt="secret", $length = SECURITY_CODE_LENGTH) {

 

Look for extra references to the code, and look for white space (blank lines or spaces) before the opening or after the closing php tag in those files.

 

Only use a decent FTP programme to upload files to your server e.g. WS FTP or FileZilla.

 

Vger

Share this post


Link to post
Share on other sites

I've just uninstalled the old spaghetti CCGV (whew!) and have installed your new traditional version (the April 1 update). So far so good except I can't get the more info popup in the shopping cart info box to pop.

 

Any ideas what I could've done wrong?

 

Thanks,

jc

Share this post


Link to post
Share on other sites

Actually, I've been trying to get the forum moderators to delete that update. The two changes that were introduced were wrong - I made the mistake of taking other people's word for things and didn't check it out myself.

 

The change to checkout_process, to work with Authotize Net AIM, produces a class error, and the javascript popup in the shopping cart should be changed back to:

 

'<a href="java script:couponpopupWindow(\'' . tep_href_link(FILENAME_POPUP_COUPON_HELP, 'cID=' . $cc_id) . '\')">' . CART_COUPON_INFO . '</a>'

 

If that doesn't work you can always change that link to something like this:

 

'<a href="popup_coupon_help.php'' target="_blank">' . FILENAME_POPUP_COUPON_HELP . 'cID=' . $cc_id . CART_COUPON_INFO . '</a>'

 

Also, in that same section, where it says:

 

if (tep_session_is_registered('gv_id') && $gv_id)

 

it should say

 

if (tep_session_is_registered('cc_id') && $cc_id)

 

That was my own mistake ....sorry!

 

Vger

Edited by Vger

Share this post


Link to post
Share on other sites

Vger - Okay how's this for weird?

 

My popup window still doesn't work (javascript error - error on page).

 

THAT IS ... UNTIL I go into advanced search and pop up the help window. After I close that popup, then the coupon-more-info-popup will work just fine.

 

What could cause that? Is something not getting initialized, set?

 

By the by - the above only works if popupWindow is called popupWindow, not couponpopupWindow.

 

This is but a nit - your contribution is a lifesaver!

 

Thanks,

jc

Share this post


Link to post
Share on other sites

Hi,

 

I looked at this new package, good job Rhea! It looks like there is leftover in account.php. When I load your file on clean MS2, I get this message: syntax error, unexpected '}' in /blahblah/account.php on line 280, it looks like there is one extra } around line 257. Anyway, I think that there is no need to confuse a customer with link such as "Send Gift Voucher" if they can't send it with no balance anyway. It appears that this might be slightly better logic to that part of account:

<!--// CCGV ADDED - BEGIN //-->
 <?php
 if (tep_session_is_registered('customer_id')) {
$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
$gv_result = tep_db_fetch_array($gv_query);
if ($gv_result['amount'] > 0 ) {
?>
<tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo GIFT_VOUCHER_COUPON; ?></b></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td width="60"><?php echo tep_image(DIR_WS_IMAGES . 'ccgv.gif'); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
			<tr>
			<td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') ?> <?php echo CCGV_BALANCE .'' ?>
 <?php echo $currencies->format($gv_result['amount']); ?></td>
			</tr>
			</td>
			</tr>
			  <tr>
				<td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_GV_SEND, '', 'SSL') . '">' . CCGV_SENDVOUCHER . '</a>'; ?></td>
			  </tr>
			  <tr>
				<td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_GV_FAQ, '', 'SSL') . '">' . CCGV_FAQ . '</a>'; ?></td>
			  </tr>
			</table></td>
			<td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
} 
 }
?>
<!--// CCGV ADDED - END//-->

 

What it does? No balance, no CCGV info. If you like it, use it. If not, delete the extra } around line 258 in original instructions.


Absinthe Original Liquor Store

Share this post


Link to post
Share on other sites

I have the 5.10 plus fixes and just the TREEVIEW from the very confused thread installed... I un-installed it just to make sure there was no interference and there wasn't. Now it is back to pure CCGV original :-)

 

I have a couple of problems and would appreciate a push in the right direction please. I just noticed two issues that need resolving....

 

i) If for whatever reason I un-install the coupons from the admin/modules... I cant re-install it. The install button appears but when I click it the same page with the same install button appears again. When I go to admin/coupons all of coupons are still there and active! The gift vouchers can be installed and un-installed without problems and the rest of the modules are fine too. The only way to get the coupons re-installed again is to go back to the back-up SQL

 

ii) After playing around with coupons I decided that if coupons were last in the order total, especially after gift vouchers - it generally means more money for the admin. But whenever I make the order total to show the coupons greater than the gift vouchers, the gift voucher checkbox vanishes from the catalog/checkout_payment page. EG:

 

coupons 9 + vouchers 740 is fine (as long as vouchers are greater than coupons)

coupons 9 + vouchers 8 is NOT fine (and problem remains if vouchers are less than coupons)

 

I did text diff with some files from this CCGV TRAD and my own, even adding the originals didnt help as they are same.

 

Could anyone please give me some pointers?

Edited by chooch

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

Hi Alex, Sorry about the extra curly bracket - thanks for pointing it out!

 

Vger

Hi,

 

I looked at this new package, good job Rhea! It looks like there is leftover in account.php. When I load your file on clean MS2, I get this message: syntax error, unexpected '}' in /blahblah/account.php on line 280, it looks like there is one extra } around line 257. Anyway, I think that there is no need to confuse a customer with link such as "Send Gift Voucher" if they can't send it with no balance anyway. It appears that this might be slightly better logic to that part of account:

<!--// CCGV ADDED - BEGIN //-->
 <?php
 if (tep_session_is_registered('customer_id')) {
$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
$gv_result = tep_db_fetch_array($gv_query);
if ($gv_result['amount'] > 0 ) {
?>
<tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
	  <tr>
		<td class="main"><b><?php echo GIFT_VOUCHER_COUPON; ?></b></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td width="60"><?php echo tep_image(DIR_WS_IMAGES . 'ccgv.gif'); ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
			  <tr>
			<tr>
			<td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') ?> <?php echo CCGV_BALANCE .'' ?>
 <?php echo $currencies->format($gv_result['amount']); ?></td>
			</tr>
			</td>
			</tr>
			  <tr>
				<td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_GV_SEND, '', 'SSL') . '">' . CCGV_SENDVOUCHER . '</a>'; ?></td>
			  </tr>
			  <tr>
				<td class="main"><?php echo tep_image(DIR_WS_IMAGES . 'arrow_green.gif') . ' <a href="' . tep_href_link(FILENAME_GV_FAQ, '', 'SSL') . '">' . CCGV_FAQ . '</a>'; ?></td>
			  </tr>
			</table></td>
			<td width="10" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
} 
 }
?>
<!--// CCGV ADDED - END//-->

 

What it does? No balance, no CCGV info. If you like it, use it. If not, delete the extra } around line 258 in original instructions.

Share this post


Link to post
Share on other sites
If for whatever reason I un-install the coupons from the admin/modules... I cant re-install it. The install button appears but when I click it the same page with the same install button appears again.

 

Make sure that your includes/modules/order_total/ot_coupon.php file is complete - and that permissions are set correctly on the folder the file is in.

 

Vger

Share this post


Link to post
Share on other sites

Hi Vger,

 

I'm quite new to OsC but I think I know some PHP. So forgive me my question, but maybe you know the problem already and can save me a lot of time (maybe I get some of the time I wasted on the dreaded "new" CCGV back).

 

So first: Thanks for the great Contribution, worked out very smooth, even with the contr. multi stores.

 

My Problem: After installing CCGV I cannot install any modules. I always get the following error:

 

Warning: Cannot add header information - headers already sent by (output started at /home/kunden/unicenation/public_html/stores/nichenation/admin/includes/application_top.php:551) in /home/kunden/unicenation/public_html/stores/nichenation/admin/includes/functions/general.php on line 22

 

The strange thing: It appears as "installed" even if I cannot access the "Welcome Gift Voucher" Page in Configuration. With other modules it is the same.

 

Maybe it is also a problem of the multi store contr. But I just wanted to ask to make sure.

 

An other small Bug:

In admin/includes/languages/add_ccgvdc_english.php are some of the constants misspelled which causes a small error (the constants names appear in the admin panel).

 

Thanks,

DTA

Share this post


Link to post
Share on other sites

I solved the problem. It was caused by the multi stores contr. which moved the block with the session handling. So I just had to move the line

 

require(DIR_WS_INCLUDES . 'add_ccgvdc_application_top.php'); // CCGV

 

Right over

 

// lets start our session

tep_session_start();

 

Thanks.

Share this post


Link to post
Share on other sites
Make sure that your includes/modules/order_total/ot_coupon.php file is complete - and that permissions are set correctly on the folder the file is in.

 

Vger

Many thanks Vger, I have text-diffed your ot_coupons file with mine and added/removed snipets and lo and behold I can add/remove the coupons :-)

 

I have also narrowed down the final CCGV problem in the checkout payment page where evrything is fine until I change the order in admin/modules to make teh coupons greater than vouchers - then the gift voucher text and checkbox vanishes, leaving the coupons box and textfield intact.

 

Here's the code I have in classes/order_total

===========================================================

function credit_selection() {

$selection_string = '';

$close_string = '';

$credit_class_string = '';

if (MODULE_ORDER_TOTAL_INSTALLED) {

$header_string = '<tr>' . "\n";

$header_string .= ' <td><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";

$header_string .= ' <tr>' . "\n";

$header_string .= ' <td class="main"><b>' . TABLE_HEADING_CREDIT . '</b></td>' . "\n";

$header_string .= ' </tr>' . "\n";

$header_string .= ' </table></td>' . "\n";

$header_string .= ' </tr>' . "\n";

$header_string .= '<tr>' . "\n";

$header_string .= ' <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">' . "\n";

$header_string .= ' <tr class="infoBoxContents"><td><table border="0" width="100%" cellspacing="0" cellpadding="2">' ."\n";

$header_string .= ' <tr>' . "\n";

$header_string .= ' <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";

$close_string = ' </table></td>';

$close_string .= '';

$close_string .= '</tr></table></td></tr></table></td>';

$close_string .= '<tr></tr>';

reset($this->modules);

$output_string = '';

while (list(, $value) = each($this->modules)) {

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {

$use_credit_string = $GLOBALS[$class]->use_credit_amount();

if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();

if ( ($use_credit_string !='' ) || ($selection_string != '') ) {

$output_string .= '';

$output_string = ' ' . "\n" .

' ' .

'' . $use_credit_string;

$output_string .= '';

$output_string .= '' . "\n";

$output_string .= $selection_string;

}

 

}

}

if ($output_string != '') {

$output_string = $header_string . $output_string;

$output_string .= $close_string;

}

}

return $output_string;

}

 

===========================================================

 

but when I text-diff with Vger's file and edit something, I get the correct layout with the words "Gift Vouchers/Discount Coupons" the but NOT the checkbox. It should say soemthing like "check the box to redeem your voucher balance"

 

here'sthe code that shows the roll over hihlight and text but not the checkbox:

 

============================================================

 

function credit_selection() {

$selection_string = '';

$close_string = '';

$credit_class_string = '';

if (MODULE_ORDER_TOTAL_INSTALLED) {

$header_string = '<tr>' . "\n";

$header_string .= ' <td><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";

$header_string .= ' <tr>' . "\n";

$header_string .= ' <td class="main"><b>' . TABLE_HEADING_CREDIT . '</b></td>' . "\n";

$header_string .= ' </tr>' . "\n";

$header_string .= ' </table></td>' . "\n";

$header_string .= ' </tr>' . "\n";

$header_string .= '<tr>' . "\n";

$header_string .= ' <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">' . "\n";

$header_string .= ' <tr class="infoBoxContents"><td><table border="0" width="100%" cellspacing="0" cellpadding="2">' ."\n";

$header_string .= ' <tr>' . "\n";

$header_string .= ' <td colspan="2"><table border="0" width="100%" cellspacing="0" cellpadding="2">' . "\n";

$close_string = ' </table></td>';

$close_string .= '';

$close_string .= '</tr></table></td></tr></table></td>';

$close_string .= '<tr></tr>';

reset($this->modules);

$output_string = '';

while (list(, $value) = each($this->modules)) {

$class = substr($value, 0, strrpos($value, '.'));

if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {

$use_credit_string = $GLOBALS[$class]->use_credit_amount();

if ($selection_string =='') $selection_string = $GLOBALS[$class]->credit_selection();

if ( ($use_credit_string !='' ) || ($selection_string != '') ) {

$output_string .= '<tr colspan="4"><td colspan="4" width="100%">' . tep_draw_separator('pixel_trans.gif', '100%', '10') . '</td></tr>';

$output_string = ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" >' . "\n" .

' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td>' .

' <td class="main"><b>' . $GLOBALS[$class]->header . '</b></td>' . $use_credit_string;

$output_string .= '<td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') . '</td>';

$output_string .= ' </tr>' . "\n";

$output_string .= $selection_string;

}

 

}

}

if ($output_string != '') {

$output_string = $header_string . $output_string;

$output_string .= $close_string;

}

}

return $output_string;

}

 

 

 

============================================================

 

PLEASE stay with me on this....

 

the key factor in all this is: in admin/modules/ordertotal I originally had the vouchers greater than coupons so in catalog I could tick the checkbox and move to the checkout_confirmation where the order total of my preference showed correctly....

 

... so to test it all, I then went back to admin/modules and made vouchers less than coupons, then returned to catalog and the gv redeem text and checkbox vanished but by going forward in the IE browser I saw that the order total and coupons/gv redeemed remained correct in checkout confirmation - THIS didn't happen before until I applied parts of Vger's code. Before applying Vger's text-diff code the checkout_confirmation would remove the vouchers the moment vouchers were set less than coupons inorder total.

 

So if I can get the checkbox to show the rest of mod now seems to be running fine and that seems to be attached to includes/classes/order_total

 

I am pretty sure I can't be the only person this is happening to if the order totals in admin are set to show the coupons greater than vouchers... I am looking for a fix but if anyone has any idea please post them

 

Thanks


Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

Hello,

I installed your CCGV Contrib and manually edited most of the files(due to a diff contrib). After all is said and done, I did a test checkout and when I get to the last part I get this error:

 

Fatal error: Call to a member function on a non-object in (path to my dir)/catalog/checkout_process.php on line 50

 

I moved the line to the original place and it works but I assume that it was moved for a reason. Do I have to download and install your updated contrib to fix the problem?

 

Also, where do I enter the coupon code in the checkout process?

 

Thanks!

 

-Adam

Share this post


Link to post
Share on other sites

The update of a few days ago was incorrect, which was why I updated a new version last night - which returned that line of code in checkout_process.php to its original place.

 

In order to see the Redeem Box during the checkout process you have to create a Discount Coupon, or set up Gift Vouchers for sale.

 

Vger

Edited by Vger

Share this post


Link to post
Share on other sites

The checkout_process.php in your updated file still has that line in it. The original line isn't commented out anymore so you must have just missed that first one.

 

I created a coupon and still can't see the Redeem Coupon anywhere during checkout. What page should it be on? Thanks again!

 

-Adam

 

NOTE: I put up a fresh copy of osC and just copied all the CCGV files to it with the same results.

Share this post


Link to post
Share on other sites

Did you go to Modules --> Order Total and enable both the Coupon and Gift Voucher modules?

 

Vger

Share this post


Link to post
Share on other sites

Thats the problem! I missed that in the readme file. Thanks for your help! And thanks for spending the time to combine that big messy pile of downloads into a updated, one download contrib!

 

-Adam

Share this post


Link to post
Share on other sites

In the next version I'll update the sql file so that the two Order Total modules are auto-installed. Most people miss those.

 

Vger

Share this post


Link to post
Share on other sites

Hello again Vger,

Is there a way to change it so that on the checkout_confirmation.php page it shows the final total with the discount and not just the subtotal then the discount amout underneith?

So it would say something like

 

Sub-total: XX.XX

Shipping: XX.XX

Discount: XX.XX

Total: XX.XX

 

I'm looking for the answer but got a feeling its gonna be beyong my abilities. Thanks again!

 

-Adam

Share this post


Link to post
Share on other sites

In Modules --> Order Total try reordering it so that Coupons or Vouchers comes before Total.

 

Vger

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×