Jump to content
JuanIgnacio

Credit Class & Gift Vouchers (CCGV) for 2.3.1

Recommended Posts

The installation instructions in all the versions of CCVG don't work for osCommerce 2.3.1... they are for RC2 which has many differences from 2.3.1 and there even are files that doesn't exist anymore.

 

Has anyone installed CCGV in 2.3.1?

Is there any clean 2.3.1 files with CCGV in them to replace? Any instructions?

 

Regards

Share this post


Link to post
Share on other sites

I have this installed and working very well with the exception of the shopping cart box. Which is now under modules/boxes/bm_shopping_cart.php. The language quite different from the original boxes file, so I have not got that working yet. If you have been able to get this file working I would be very interested.

Share this post


Link to post
Share on other sites

You installed it into osCommerce 2.3.1?

 

I started comparing files and editing the original 2.3.1... I manage to port all the admin part (which I'll contribute later) but I can't fin the way to place the box where the user inputs his coupon code.

Share this post


Link to post
Share on other sites

Same here, I have all admin functions working and all catalog function except the shopping cart box. So it is useable. I am working on the shopping cart box but to no avail as of yet. Yes, I am working with osc v2.3.1.

Edited by lupole

Share this post


Link to post
Share on other sites

Found that

 

function credit_selection() { ... }

 

in /includes/modules/order_total/ot_coupon.php un line 61 is the responsable for outputting the coupon code input field text

 

You have to be sure that function is called in checkout_payment.php

 

 


// Start - CREDIT CLASS Gift Voucher Contribution
       echo $order_total_modules->credit_selection();
// End - CREDIT CLASS Gift Voucher Contribution 

 

but of course, all the checking and class creation code must be correctly on the first part of checkout_payment.php for it to work

 

I'll be posting more on this later

Share this post


Link to post
Share on other sites

JuanIgnacio

 

I have all the changes for checkout_payment, it you would like them. I get the coupon redemption box for coupons as well as the tic box to apply gift voucher balance's. Both calculate correctly.

Share this post


Link to post
Share on other sites

I will past checkout_payment here. I don't have time right now to add it. MVS changes are also on this in the source.

I also have account.php with all changes there as well. If you need.

 

<?php

/*

$Id$

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

$Mod: MVS V1.2.3 2011/04/13 JCK/CWG $

adapted for CCGV v5.20a 05/1/2011

 

Copyright © 2010 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

// Start - CREDIT CLASS Gift Voucher Contribution

if (tep_session_is_registered('cot_gv')) tep_session_unregister('cot_gv');

// End - CREDIT CLASS Gift Voucher Contribution

// MVS start

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);

 

// print 'Vendor Shipping: ' . SELECT_VENDOR_SHIPPING . "<br>\n";

// print 'Array Vendor Shipping: <pre>';

// print_r ($shipping);

// print '</pre>' . "<br>\n";

// print 'Vendor Count: ' . count ($shipping['vendor']) . "<br>\n";

// print 'Cart Vendor Count: ' . count ($cart->vendor_shipping) . "<br>\n";

 

// exit;

 

// If a shipping method has not been selected for all vendors, redirect the customer to the shipping method selection page

if (SELECT_VENDOR_SHIPPING == 'true') { // This test only works under MVS

if (!is_array ($shipping['vendor']) || count ($shipping['vendor']) != count ($cart->vendor_shipping)) { // No shipping selected or not all selected

tep_redirect (tep_href_link (FILENAME_CHECKOUT_SHIPPING, 'error_message=' . ERROR_NO_SHIPPING_SELECTED, 'SSL'));

}

}

// MVS end

 

// if the customer is not logged on, redirect them to the login page

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

// if there is nothing in the customers cart, redirect them to the shopping cart page

if ($cart->count_contents() < 1) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

}

 

// if no shipping method has been selected, redirect the customer to the shipping method selection page

if (!tep_session_is_registered('shipping')) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

 

// avoid hack attempts during the checkout procedure by checking the internal cartID

if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

if ($cart->cartID != $cartID) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

}

}

 

// Start - CREDIT CLASS Gift Voucher Contribution

if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');

if(tep_session_is_registered('cot_gv')) tep_session_unregister('cot_gv');

// End - CREDIT CLASS Gift Voucher Contribution

 

// Stock Check

if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {

$products = $cart->get_products();

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

if (tep_check_stock($products[$i]['id'], $products[$i]['quantity'])) {

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));

break;

}

}

}

 

// Start - CREDIT CLASS Gift Voucher Contribution

// #################### THIS MOD IS OPTIONAL! ######################

// load the selected shipping module

require(DIR_WS_CLASSES . 'shipping.php');

$shipping_modules = new shipping($shipping);

// #################### THIS MOD WAS OPTIONAL! ######################

// End - CREDIT CLASS Gift Voucher Contribution

 

// if no billing destination address was selected, use the customers own address as default

if (!tep_session_is_registered('billto')) {

tep_session_register('billto');

$billto = $customer_default_address_id;

} else {

// verify the selected billing address

if ( (is_array($billto) && empty($billto)) || is_numeric($billto) ) {

$check_address_query = tep_db_query("select count(*) as total from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customer_id . "' and address_book_id = '" . (int)$billto . "'");

$check_address = tep_db_fetch_array($check_address_query);

 

if ($check_address['total'] != '1') {

$billto = $customer_default_address_id;

if (tep_session_is_registered('payment')) tep_session_unregister('payment');

}

}

}

 

require(DIR_WS_CLASSES . 'order.php');

$order = new order;

// Start - CREDIT CLASS Gift Voucher Contribution

require(DIR_WS_CLASSES . 'order_total.php');

$order_total_modules = new order_total;

$order_total_modules->clear_posts();

// End - CREDIT CLASS Gift Voucher Contribution

 

if (!tep_session_is_registered('comments')) tep_session_register('comments');

if (isset($HTTP_POST_VARS['comments']) && tep_not_null($HTTP_POST_VARS['comments'])) {

$comments = tep_db_prepare_input($HTTP_POST_VARS['comments']);

}

 

$total_weight = $cart->show_weight();

$total_count = $cart->count_contents();

// Start - CREDIT CLASS Gift Voucher Contribution

$total_count = $cart->count_contents_virtual();

// End - CREDIT CLASS Gift Voucher Contribution

 

// load all enabled payment modules

require(DIR_WS_CLASSES . 'payment.php');

$payment_modules = new payment;

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PAYMENT);

 

$breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

$breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 

require(DIR_WS_INCLUDES . 'template_top.php');

?>

 

<script type="text/javascript"><!--

var selected;

<?php // Start - CREDIT CLASS Gift Voucher Contribution ?>

var submitter = null;

function submitFunction() {

submitter = 1;

}

<?php // End - CREDIT CLASS Gift Voucher Contribution ?>

function selectRowEffect(object, buttonSelect) {

 

// Start - CREDIT CLASS Gift Voucher Contribution

if (!document.checkout_payment.payment[0].disabled){

// End - CREDIT CLASS Gift Voucher Contribution

if (!selected) {

if (document.getElementById) {

selected = document.getElementById('defaultSelected');

} else {

selected = document.all['defaultSelected'];

}

}

 

if (selected) selected.className = 'moduleRow';

object.className = 'moduleRowSelected';

selected = object;

 

// one button is not an array

if (document.checkout_payment.payment[0]) {

document.checkout_payment.payment[buttonSelect].checked=true;

} else {

document.checkout_payment.payment.checked=true;

}

 

// Start - CREDIT CLASS Gift Voucher Contribution

}

// End - CREDIT CLASS Gift Voucher Contribution

}

 

function rowOverEffect(object) {

if (object.className == 'moduleRow') object.className = 'moduleRowOver';

}

 

function rowOutEffect(object) {

if (object.className == 'moduleRowOver') object.className = 'moduleRow';

}

 

<?php

// Start - CREDIT CLASS Gift Voucher Contribution

if (MODULE_ORDER_TOTAL_INSTALLED)

$temp=$order_total_modules->process();

$temp=$temp[count($temp)-1];

$temp=$temp['value'];

 

$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']>=$temp){ $coversAll=true;

 

?>

function clearRadeos(){

document.checkout_payment.cot_gv.checked=!document.checkout_payment.cot_gv.checked;

for (counter = 0; counter < document.checkout_payment.payment.length; counter++) {

// If a radio button has been selected it will return true

// (If not it will return false)

if (document.checkout_payment.cot_gv.checked){

document.checkout_payment.payment[counter].checked = false;

document.checkout_payment.payment[counter].disabled=true;

} else {

document.checkout_payment.payment[counter].disabled=false;

}

}

}

<?php

} else {

$coversAll=false;?>

 

function clearRadeos(){

document.checkout_payment.cot_gv.checked=!document.checkout_payment.cot_gv.checked;

}<?php } ?>

//--></script>

<?php // echo $payment_modules->javascript_validation(); ?>

<?php echo $payment_modules->javascript_validation($coversAll); ?>

<?php // End - CREDIT CLASS Gift Voucher Contribution ?>

 

<h1><?php echo HEADING_TITLE; ?></h1>

 

<?php /* Start - CREDIT CLASS Gift Voucher Contribution */ ?>

<?php /* echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"', true); */ ?>

<?php /* End - CREDIT CLASS Gift Voucher Contribution */ ?>

 

<div class="contentContainer">

 

<?php

if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {

?>

 

<div class="contentText">

<?php echo '<strong>' . tep_output_string_protected($error['title']) . '</strong>'; ?>

 

<p class="messageStackError"><?php echo tep_output_string_protected($error['error']); ?></p>

</div>

 

<?php // Start - CREDIT CLASS Gift Voucher Contribution ?>

<?php // #################### THIS MOD IS OPTIONAL! ###################### ?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><b><?php echo HEADING_PRODUCTS; ?></b><? echo ' <a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><span class="orderEdit">(' . EDIT . ')</span></a>'; ?></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">

<?php

//}

 

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

echo ' <tr>' . "\n" .

' <td width="10%" class="main" align="right" valign="top" width="30">' . $order->products[$i]['qty'] . ' x</td>' . "\n" .

' <td width="60%" class="main" valign="top">' . $order->products[$i]['name'];

 

if (STOCK_CHECK == 'true') {

echo tep_check_stock($order->products[$i]['id'], $order->products[$i]['qty']);

}

 

if ( (isset($order->products[$i]['attributes'])) && (sizeof($order->products[$i]['attributes']) > 0) ) {

for ($j=0, $n2=sizeof($order->products[$i]['attributes']); $j<$n2; $j++) {

echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . $order->products[$i]['attributes'][$j]['value'] . '</i></small></nobr>';

}

}

 

echo ' </td>' . "\n";

 

if (sizeof($order->info['tax_groups']) > 1) echo ' <td class="main" valign="top" align="right">' . tep_display_tax_value($order->products[$i]['tax']) . '% </td>' . "\n";

 

echo ' <td width="30%"class="main" align="right" valign="top">' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . ' </td>' . "\n" .

' </tr>' . "\n";

}

?>

<tr>

<td COLSPAN="3" valign="top" align="right">

<table border="0" cellspacing="0" cellpadding="3">

<?php

if (MODULE_ORDER_TOTAL_INSTALLED) {

echo $order_total_modules->output();

}

?>

</table>

</td>

</tr>

</table>

</td>

</tr>

</table></td>

</tr>

<?php // #################### THIS MOD WAS OPTIONAL! ###################### ?>

<?php // End - CREDIT CLASS Gift Voucher Contribution ?>

 

<?php

}

?>

 

<h2><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></h2>

 

<div class="contentText">

<div class="ui-widget infoBoxContainer" style="float: right;">

<div class="ui-widget-header infoBoxHeading"><?php echo TITLE_BILLING_ADDRESS; ?></div>

 

<div class="ui-widget-content infoBoxContents">

<?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />'); ?>

</div>

</div>

 

<?php echo TEXT_SELECTED_BILLING_DESTINATION; ?><br /><br /><?php echo tep_draw_button(IMAGE_BUTTON_CHANGE_ADDRESS, 'home', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL')); ?>

</div>

 

<div style="clear: both;"></div>

 

<h2><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></h2>

 

<?php

// Start - CREDIT CLASS Gift Voucher Contribution

echo $order_total_modules->credit_selection();

// End - CREDIT CLASS Gift Voucher Contribution ?>

<?php // Start - CREDIT CLASS Gift Voucher Contribution ?>

<?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"'); ?>

<?php // End - CREDIT CLASS Gift Voucher Contribution ?>

 

 

<?php

$selection = $payment_modules->selection();

 

if (sizeof($selection) > 1) {

?>

 

<div class="contentText">

<div style="float: right;">

<?php echo '<strong>' . TITLE_PLEASE_SELECT . '</strong>'; ?>

</div>

 

<?php echo TEXT_SELECT_PAYMENT_METHOD; ?>

</div>

 

<?php

} elseif ($free_shipping == false) {

?>

 

<div class="contentText">

<?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?>

</div>

 

<?php

}

?>

 

<div class="contentText">

 

<?php

$radio_buttons = 0;

for ($i=0, $n=sizeof($selection); $i<$n; $i++) {

?>

 

<table border="0" width="100%" cellspacing="0" cellpadding="2">

 

<?php

if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {

echo ' <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

} else {

echo ' <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";

}

?>

 

<td><strong><?php echo $selection[$i]['module']; ?></strong></td>

<td align="right">

 

<?php

if (sizeof($selection) > 1) {

echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment));

} else {

echo tep_draw_hidden_field('payment', $selection[$i]['id']);

}

?>

 

</td>

</tr>

 

<?php

if (isset($selection[$i]['error'])) {

?>

 

<tr>

<td colspan="2"><?php echo $selection[$i]['error']; ?></td>

</tr>

 

<?php

} elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) {

?>

 

<tr>

<td colspan="2"><table border="0" cellspacing="0" cellpadding="2">

 

<?php

for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {

?>

 

<tr>

<td><?php echo $selection[$i]['fields'][$j]['title']; ?></td>

<td><?php echo $selection[$i]['fields'][$j]['field']; ?></td>

</tr>

 

<?php

}

?>

 

</table></td>

</tr>

 

<?php

}

?>

 

</table>

 

<?php

$radio_buttons++;

}

 

 

 

// Start - CREDIT CLASS Gift Voucher Contribution

if (tep_session_is_registered('customer_id')) {

if ($gv_result['amount']>0){

echo ' <tr><td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td colspan=2>' . "\n" .

' <table border="0" cellpadding="2" cellspacing="0" width="100%"><tr class="moduleRow" onmouseover="rowOverEffect(this)" onclick="clearRadeos()" onmouseout="rowOutEffect(this)" >' . "\n" .

' <td width="10">' . tep_draw_separator('pixel_trans.gif', '10', '1') .'</td><td class="main">' . $gv_result['text'];

 

echo $order_total_modules->sub_credit_selection();

}

}

// End - CREDIT CLASS Gift Voucher Contribution

?>

</div>

 

<h2><?php echo TABLE_HEADING_COMMENTS; ?></h2>

 

<div class="contentText">

<?php echo tep_draw_textarea_field('comments', 'soft', '60', '5', $comments); ?>

</div>

 

<div class="contentText">

<div style="float: left; width: 60%; padding-top: 5px; padding-left: 15%;">

<div id="coProgressBar" style="height: 5px;"></div>

 

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td align="center" width="33%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>

<td align="center" width="33%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>

<td align="center" width="33%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>

</tr>

</table>

</div>

 

<div style="float: right;"><?php echo tep_draw_button(IMAGE_BUTTON_CONTINUE, 'triangle-1-e', null, 'primary'); ?></div>

</div>

</div>

 

<script type="text/javascript">

$('#coProgressBar').progressbar({

value: 66

});

</script>

 

</form>

 

<?php

require(DIR_WS_INCLUDES . 'template_bottom.php');

require(DIR_WS_INCLUDES . 'application_bottom.php');

?>

Share this post


Link to post
Share on other sites

I have it installed in 2.3.1 here:

 

http://www.chasethecup1.com

 

This is NOT A TEST SITE.

 

The contribution works perfectly. I will say that it was a straight 24 hours of code modifications, one page at a time, but well worth it.

 

I do have a full file set that I could clean up and contribute, but I'm working on so many things, that it would be a while before I could get to it.

Share this post


Link to post
Share on other sites

I have it installed in 2.3.1 here:

 

I also have it installed and working with the exception of /includes/modules/boxes/bm_shopping_cart.php. I am receiving this error When logged in, with a gift voucher balance.

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/myshop/public_html/includes/functions/database.php on line 99

 

And no gift voucher information is displayed within the shopping cart box. Could you send me or post your changes for bm_shopping_cart.php? Thank you in advance.

Edited by lupole

Share this post


Link to post
Share on other sites

code for working bm_shopping cart file:

 

<?php
/*
 $Id$

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2010 osCommerce

 Released under the GNU General Public License
*/

class bm_shopping_cart
{
var $code = 'bm_shopping_cart';
var $group = 'boxes';
var $title;
var $description;
var $sort_order;
var $enabled = false;


function bm_shopping_cart()
{
$this->title = MODULE_BOXES_SHOPPING_CART_TITLE;
$this->description = MODULE_BOXES_SHOPPING_CART_DESCRIPTION;
if ( defined('MODULE_BOXES_SHOPPING_CART_STATUS') )
	{
	$this->sort_order = MODULE_BOXES_SHOPPING_CART_SORT_ORDER;
	$this->enabled = (MODULE_BOXES_SHOPPING_CART_STATUS == 'True');
	$this->group = ((MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT == 'Left Column') ? 'boxes_column_left' : 'boxes_column_right');
	}
}

function execute()
{
global $customer_id, $cart, $new_products_id_in_cart, $currencies, $oscTemplate;
// Start - CREDIT CLASS Gift Voucher Contribution
$cart_contents_string ="<script language=\"javascript\">function couponpopupWindow(url) {window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')}//--></script>";
// End - CREDIT CLASS Gift Voucher Contribution
if ($cart->count_contents() > 0)
	{
	$cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0" class="ui-widget-content infoBoxContents">';
	$products = $cart->get_products();
	for ($i=0, $n=sizeof($products); $i<$n; $i++)
		{
		$cart_contents_string .= '<tr><td align="right" valign="top">';

		if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id']))
			{
			$cart_contents_string .= '<span class="newItemInCart">';
			}

		$cart_contents_string .= $products[$i]['quantity'] . ' x ';

		if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id']))
			{
			$cart_contents_string .= '</span>';
			}

		$cart_contents_string .= '</td><td valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

		if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id']))
			{
			$cart_contents_string .= '<span class="newItemInCart">';
			}

		$cart_contents_string .= $products[$i]['name'];

		if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id']))
			{
			$cart_contents_string .= '</span>';
			}

		$cart_contents_string .= '</a></td></tr>';

		if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id']))
			{
			tep_session_unregister('new_products_id_in_cart');
			}
		}

	$cart_contents_string .= '<tr><td colspan="2" style="padding-top: 5px; padding-bottom: 2px;">' . tep_draw_separator() . '</td></tr>' .
	                         '<tr><td colspan="2" align="right">' . $currencies->format($cart->show_total()) . '</td></tr>' .
	                         '</table>';
	}
else
	{
	$cart_contents_string .= '<div class="ui-widget-content infoBoxContents">' . MODULE_BOXES_SHOPPING_CART_BOX_CART_EMPTY . '</div>';
	}
// Start - CREDIT CLASS Gift Voucher Contribution
	if (tep_session_is_registered('customer_id'))
		{
		$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . (int)$customer_id . "'");
		$gv_result = tep_db_fetch_array($gv_query);
		if ($gv_result['amount'] > 0 )
			{
			$cart_contents_string .= '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td align=center>' . VOUCHER_BALANCE . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($gv_result['amount']) . '</td></tr></table>';
			$cart_contents_string .= '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td align=center><a href="'. tep_href_link(FILENAME_GV_SEND) . '">' . BOX_SEND_TO_FRIEND . '</a></td></tr></table>';
			}
		}
	if (tep_session_is_registered('gv_id'))
		{
		$gv_query = tep_db_query("select coupon_amount from " . TABLE_COUPONS . " where coupon_id = '" . $gv_id . "'");
		$coupon = tep_db_fetch_array($gv_query);
		$cart_contents_string .= '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td  align=center>' . VOUCHER_REDEEMED . '</td><td class="smalltext" align="right" valign="bottom">' . $currencies->format($coupon['coupon_amount']) . '</td></tr></table>';
		}
	if (tep_session_is_registered('cc_id') && $cc_id)
		{
		$coupon_query = tep_db_query("select * from " . TABLE_COUPONS . " where coupon_id = '" . $cc_id . "'");
		$coupon = tep_db_fetch_array($coupon_query);
		$coupon_desc_query = tep_db_query("select * from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . $cc_id . "' and language_id = '" . $languages_id . "'");
		$coupon_desc = tep_db_fetch_array($coupon_desc_query);
		$text_coupon_help = sprintf("%s",$coupon_desc['coupon_name']);
		$cart_contents_string .= '<table cellpadding="0" width="100%" cellspacing="0" border="0"><tr><td  align=center>' . CART_COUPON . $text_coupon_help . '<br>' . '</td></tr></table>';
		}  

// End - CREDIT CLASS Gift Voucher Contribution

$data = '<div class="ui-widget infoBoxContainer">' .
      '  <div class="ui-widget-header infoBoxHeading"><a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . MODULE_BOXES_SHOPPING_CART_BOX_TITLE . '</a></div>' .
      '  ' . $cart_contents_string .
      '</div>';

$oscTemplate->addBlock($data, $this->group);
}

function isEnabled()
{
return $this->enabled;
}

function check()
{
return defined('MODULE_BOXES_SHOPPING_CART_STATUS');
}

function install()
{
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Shopping Cart Module', 'MODULE_BOXES_SHOPPING_CART_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT', 'Right Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_SHOPPING_CART_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
}

function remove()
{
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys()
{
return array('MODULE_BOXES_SHOPPING_CART_STATUS', 'MODULE_BOXES_SHOPPING_CART_CONTENT_PLACEMENT', 'MODULE_BOXES_SHOPPING_CART_SORT_ORDER');
}
}
?>

Share this post


Link to post
Share on other sites

code for working bm_shopping cart file:

 

 

Thank you very much. My whole CCGV system now works, and looks fantastic with osc v2.3.1

Share this post


Link to post
Share on other sites

This does not work if you drop files over a working 2.31 install :(

 

any chance you can upload a ver that does? thanks

I may misunderstand what you're saying, so correct me if I'm wrong. You're talking about dropping files over an existing site that has already been modified in one way or another?

 

I installed this on a FRESH 2.3.1 site with NO modifications and it works.

 

If you have a site that has been modified in any way, it is not recommended that you just drop the files (for any contribution). File drops are only recommended for clean installs, and usually, it's best to pick the most complicated contribution to drop, because after that, everything else needs to be manually done.

 

And no, there's no way to customize a 'contribution' for a site that is already operating with modifications. Contributions are generic, and need to be customized on a site per site basis.

 

This does not work if you drop files over a working 2.31 install :(

 

any chance you can upload a ver that does? thanks

Share this post


Link to post
Share on other sites

maybe i am missing something?

 

you have a couple files outside of the catalog dir, do i need to use those as well?

Share this post


Link to post
Share on other sites

maybe i am missing something?

 

you have a couple files outside of the catalog dir, do i need to use those as well?

 

 

my install is fresh with no mods as well

Share this post


Link to post
Share on other sites

Umm, yep. That would definitely cause problems. I replaced a couple files, but apparently put them in the zip file and not necessarily in the correct directories. I uploaded the fix, and you should be able to drop this package right over what you already have.

 

Make sure you perform the sql query as well (found outside the catalog folder).

Share this post


Link to post
Share on other sites

Hi

 

I got a clean install of osc 2.3.1 and i installed the CCGV module but i am not quit understanding how its works..

 

I create a product with a name "GIFT Voucher 25 euros" in the product model i put GIFT_25 and then i order it? Then i see it's in the queue when i release it, it's available to me. How do i use it in the store because the mail says you can mail this voucher to a friend etc, but there is nothing to mail right? Since it's a product and not a discount coupon code?

 

Am i missing something?

 

Also with a clean install + CCGV 6.0 the layout is messed up

 

Doesn't look that good really... maybe you can provide me some help please?

Edited by poNgz0r

Share this post


Link to post
Share on other sites
I create a product with a name "GIFT Voucher 25 euros" in the product model i put GIFT_25 and then i order it? Then i see it's in the queue when i release it, it's available to me. How do i use it in the store because the mail says you can mail this voucher to a friend etc, but there is nothing to mail right? Since it's a product and not a discount coupon code?

 

When you log back in as a customer, the voucher balance will appear below the shopping cart box (located in the columns). As a customer, if you purchase something, then when you get to checkout, there will be a check box giving you the option of using the voucher balance. You can also email the gift voucher to someone else as a gift to them and they can use it. The thought is that if you're purchasing a gift voucher, then you're purchasing it as a gift for someone else, although you can also use it yourself if you choose. It is a product for sale. After it is purchased, it becomes a store credit - no coupon code required.

 

On what page are you having layout problems?

Share this post


Link to post
Share on other sites

This appears to be a very useful contribution and thanks to those responsible for spending the time to make it. I have a modified store is there documentation that shows me what files to modify or do I have to go through each one. Thanks

Share this post


Link to post
Share on other sites

There was no detailed installation instructions with the original contribution, and none were made for this modification. The easiest way to install is to use a file compare tool. I personally think that's easier/faster than following line by line install instructions.

Share this post


Link to post
Share on other sites

I have installed the files and it did work perfect ;) :)

 

Now I needed to update a part of files. And I lost a part.

I did reinstall the files. when I use the original file checkout conformation I cannot enter the payment page.

If I use the file from my backup I get a original buton to redeam the code.

and the system after entering and pressing dous not work anymore.

I go directly to checkout without checking the code. Either with the redeam as the continue buton the result is the same.

I;m totaly stupid.... but a little help is welcome.

 

Thanks a lot.

 

regards

 

Frank

Share this post


Link to post
Share on other sites

small add. when I upload the original file from the package. I can fill in the code and make a credit. How ever when I would like to Order Confirmation it is not possile. it seems to become an endless loop.

 

regards

 

Frank

Share this post


Link to post
Share on other sites

small add. when I upload the original file from the package. I can fill in the code and make a credit. How ever when I would like to Order Confirmation it is not possile. it seems to become an endless loop.

 

regards

 

Frank

 

If you installed it and it worked, and then you made other changes to your files, then I'm afraid, you probably aren't going to find much help. This is the reason it is so important to backup your files before you make any changes that are too difficult to reverse and also to backup when you make changes, test them, and it does work. Once you go losing and replacing things, there is no telling what went wrong.

 

What you're talking about is a redirect loop. Your script is redirecting back and forth between two pages (it could even be going through 3 or 4 pages) until it times out and gives you the redirect error. Things that cause a redirect are empty shopping cart, zero order total, not selecting a payment method, or a shipping method, etc... In those cases, it'll send you back to the shopping cart or the checkout. I've only encountered the loop when using one page checkout, which (when certain conditions happen) redirects to checkout_shipping.php, which in turn redirects back to checkout.php. In my case it occurred because the cart contained only free items. I'm not sure what would cause it if you're using the regular checkout.

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

×