Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit Class/Gift Vouchers/Discount Coupons 5.10


Strider

Recommended Posts

When I click "redeem" on the checkout_payment.php page, when trying to add a coupon, it just comes up with the error -

The credit card information you entered contains an error. Please check it and try again.

The first four digits of the number entered are:
If that number is correct, we do not accept that type of credit card.
If it is wrong, please try again.

 

It seems that the redeem button for some reason is doing the same thing the Continue button would do? Like it's trying to process the order?

Link to comment
Share on other sites

  • Replies 4.8k
  • Created
  • Last Reply

Top Posters In This Topic

It seems that the redeem button for some reason is doing the same thing the Continue button would do? Like it's trying to process the order?

no i think it reloads the page and excutes the credit card information validation?! only a guess..

Link to comment
Share on other sites

I have been scouring this forum for hours. . I am sooo close to going live with this shop. . but the gift voucher etc is essential. . ..

 

OSC 2.2 RC1

CCGV 5.19

 

is what I'm running along with a few other contributions but as far as I can see they are not affecting the CCGV code modifications. (Well I thought maybe MyWishlist v1.3 was but still having this same problem after removing Wishlist--

 

I have seen this question asked a few times in 2003, and Strider would reply "do you have the code in your shopping_cart.php located in /catalog/includes/classes/

 

I do have the proper code and yet I have this message when ever I try to check out after having added the CCGV 5.19:

Fatal error: Call to undefined function: count_contents_virtual() in /home/virtual/site110/fst/var/www/html/catalog/checkout_payment.php on line 96

 

This is my checkout_payment.php

 

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();
 // #################### Added CGV ######################
 $total_count = $cart->count_contents_virtual(); //ICW ADDED FOR CREDIT CLASS SYSTEM
// #################### End Added CGV ######################

// load all enabled payment modules
 require(DIR_WS_CLASSES . 'payment.php');
 $payment_modules = new payment;

 

Line 96 being the //ICW ADDED FOR CREDIT CLASS SYSTEM

 

Here is my /catalog/includes/classes/shopping_cart.php (one post was resolved after the person with the problem found a typo, but he didn't elaborate as to what the typo or fix was)

 

<?php
/*
 $Id: shopping_cart.php,v 1.35 2003/06/25 21:14:33 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class shoppingCart {
var $contents, $total, $weight, $cartID, $content_type;

function shoppingCart() {
  $this->reset();
}

function restore_contents() {
  // ############Added CCGV Contribution ##########
  global $customer_id, $gv_id, $REMOTE_ADDR;
//	  global $customer_id;
// ############ End Added CCGV Contribution ##########

  if (!tep_session_is_registered('customer_id')) return false;

// insert current cart contents in database
  if (is_array($this->contents)) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) {
	  $qty = $this->contents[$products_id]['qty'];
	  $product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	  if (!tep_db_num_rows($product_query)) {
		tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . tep_db_input($qty) . "', '" . date('Ymd') . "')");
		if (isset($this->contents[$products_id]['attributes'])) {
		  reset($this->contents[$products_id]['attributes']);
		  while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
			tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
		  }
		}
	  } else {
		tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . tep_db_input($qty) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	  }
	}
	// ############ Added CCGV Contribution ##########
	if (tep_session_is_registered('gv_id')) {
	  $gv_query = tep_db_query("insert into  " . TABLE_COUPON_REDEEM_TRACK . " (coupon_id, customer_id, redeem_date, redeem_ip) values ('" . $gv_id . "', '" . (int)$customer_id . "', now(),'" . $REMOTE_ADDR . "')");
	  $gv_update = tep_db_query("update " . TABLE_COUPONS . " set coupon_active = 'N' where coupon_id = '" . $gv_id . "'");
	  tep_gv_account_update($customer_id, $gv_id);
	  tep_session_unregister('gv_id');
	}
// ############ End Added CCGV Contribution ##########

  }

// reset per-session cart contents, but not the database contents
  $this->reset(false);

  $products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
  while ($products = tep_db_fetch_array($products_query)) {
	$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);
// attributes
	$attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
	while ($attributes = tep_db_fetch_array($attributes_query)) {
	  $this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
	}
  }

  $this->cleanup();
}

function reset($reset_database = false) {
  global $customer_id;

  $this->contents = array();
  $this->total = 0;
  $this->weight = 0;
  $this->content_type = false;

  if (tep_session_is_registered('customer_id') && ($reset_database == true)) {
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");
  }

  unset($this->cartID);
  if (tep_session_is_registered('cartID')) tep_session_unregister('cartID');
}

function add_cart($products_id, $qty = '1', $attributes = '', $notify = true) {
  global $new_products_id_in_cart, $customer_id;

  $products_id_string = tep_get_uprid($products_id, $attributes);
  $products_id = tep_get_prid($products_id_string);

  if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$qty > MAX_QTY_IN_CART)) {
	$qty = MAX_QTY_IN_CART;
  }

  $attributes_pass_check = true;

  if (is_array($attributes)) {
	reset($attributes);
	while (list($option, $value) = each($attributes)) {
	  if (!is_numeric($option) || !is_numeric($value)) {
		$attributes_pass_check = false;
		break;
	  }
	}
  }

  if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) {
	$check_product_query = tep_db_query("select products_status from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	$check_product = tep_db_fetch_array($check_product_query);

	if (($check_product !== false) && ($check_product['products_status'] == '1')) {
	  if ($notify == true) {
		$new_products_id_in_cart = $products_id;
		tep_session_register('new_products_id_in_cart');
	  }

	  if ($this->in_cart($products_id_string)) {
		$this->update_quantity($products_id_string, $qty, $attributes);
	  } else {
		$this->contents[$products_id_string] = array('qty' => (int)$qty);
// insert into database
		if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");

		if (is_array($attributes)) {
		  reset($attributes);
		  while (list($option, $value) = each($attributes)) {
			$this->contents[$products_id_string]['attributes'][$option] = $value;
// insert into database
			if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
		  }
		}
	  }

	  $this->cleanup();

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
	  $this->cartID = $this->generate_cart_id();
	}
  }
}

function update_quantity($products_id, $quantity = '', $attributes = '') {
  global $customer_id;

  $products_id_string = tep_get_uprid($products_id, $attributes);
  $products_id = tep_get_prid($products_id_string);

  if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$quantity > MAX_QTY_IN_CART)) {
	$quantity = MAX_QTY_IN_CART;
  }

  $attributes_pass_check = true;

  if (is_array($attributes)) {
	reset($attributes);
	while (list($option, $value) = each($attributes)) {
	  if (!is_numeric($option) || !is_numeric($value)) {
		$attributes_pass_check = false;
		break;
	  }
	}
  }

  if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity) && ($attributes_pass_check == true)) {
	$this->contents[$products_id_string] = array('qty' => (int)$quantity);
// update database
	if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "'");

	if (is_array($attributes)) {
	  reset($attributes);
	  while (list($option, $value) = each($attributes)) {
		$this->contents[$products_id_string]['attributes'][$option] = $value;
// update database
		if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "'");
	  }
	}
  }
}

function cleanup() {
  global $customer_id;

  reset($this->contents);
  while (list($key,) = each($this->contents)) {
	if ($this->contents[$key]['qty'] < 1) {
	  unset($this->contents[$key]);
// remove from database
	  if (tep_session_is_registered('customer_id')) {
		tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
		tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
	  }
	}
  }
}

function count_contents() {  // get total number of items in cart 
  $total_items = 0;
  if (is_array($this->contents)) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) {
	  $total_items += $this->get_quantity($products_id);
	}
  }

  return $total_items;
}

function get_quantity($products_id) {
  if (isset($this->contents[$products_id])) {
	return $this->contents[$products_id]['qty'];
  } else {
	return 0;
  }
}

function in_cart($products_id) {
  if (isset($this->contents[$products_id])) {
	return true;
  } else {
	return false;
  }
}

function remove($products_id) {
  global $customer_id;

  unset($this->contents[$products_id]);
// remove from database
  if (tep_session_is_registered('customer_id')) {
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
  }

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
  $this->cartID = $this->generate_cart_id();
}

function remove_all() {
  $this->reset();
}

function get_product_id_list() {
  $product_id_list = '';
  if (is_array($this->contents)) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) {
	  $product_id_list .= ', ' . $products_id;
	}
  }

  return substr($product_id_list, 2);
}

function calculate() {
	// ############ Added CCGV Contribution ##########
  $this->total_virtual = 0; // CCGV Contribution
// ############ End Added CCGV Contribution ##########
  global $currencies;

  $this->total = 0;
  $this->weight = 0;
  if (!is_array($this->contents)) return 0;

  reset($this->contents);
  while (list($products_id, ) = each($this->contents)) {
	$qty = $this->contents[$products_id]['qty'];

// products price
	$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	if ($product = tep_db_fetch_array($product_query)) {
		// ############ Added CCGV Contribution ##########
	  $no_count = 1;
	  $gv_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
	  $gv_result = tep_db_fetch_array($gv_query);
	  if (ereg('^GIFT', $gv_result['products_model'])) {
		$no_count = 0;
	  }
// ############ End Added CCGV Contribution ##########
	  $prid = $product['products_id'];
	  $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
	  $products_price = $product['products_price'];
	  $products_weight = $product['products_weight'];

	  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows ($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  }
// ############ Added CCGV Contribution ##########
	  $this->total_virtual += tep_add_tax($products_price, $products_tax) * $qty * $no_count;// ICW CREDIT CLASS;
	  $this->weight_virtual += ($qty * $products_weight) * $no_count;// ICW CREDIT CLASS;
// ############ End Added CCGV Contribution ##########
	  $this->total += $currencies->calculate_price($products_price, $products_tax, $qty);
	  $this->weight += ($qty * $products_weight);
	}

// attributes price
	if (isset($this->contents[$products_id]['attributes'])) {
	  reset($this->contents[$products_id]['attributes']);
	  while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
		$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
		$attribute_price = tep_db_fetch_array($attribute_price_query);
		if ($attribute_price['price_prefix'] == '+') {
		  $this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
		} else {
		  $this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
		}
	  }
	}
  }
}

function attributes_price($products_id) {
  $attributes_price = 0;

  if (isset($this->contents[$products_id]['attributes'])) {
	reset($this->contents[$products_id]['attributes']);
	while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
	  $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
	  $attribute_price = tep_db_fetch_array($attribute_price_query);
	  if ($attribute_price['price_prefix'] == '+') {
		$attributes_price += $attribute_price['options_values_price'];
	  } else {
		$attributes_price -= $attribute_price['options_values_price'];
	  }
	}
  }

  return $attributes_price;
}

function get_products() {
  global $languages_id;

  if (!is_array($this->contents)) return false;

  $products_array = array();
  reset($this->contents);
  while (list($products_id, ) = each($this->contents)) {
	$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
	if ($products = tep_db_fetch_array($products_query)) {
	  $prid = $products['products_id'];
	  $products_price = $products['products_price'];

	  $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
	  if (tep_db_num_rows($specials_query)) {
		$specials = tep_db_fetch_array($specials_query);
		$products_price = $specials['specials_new_products_price'];
	  }

	  $products_array[] = array('id' => $products_id,
								'name' => $products['products_name'],
								'model' => $products['products_model'],
								'image' => $products['products_image'],
								'price' => $products_price,
								'quantity' => $this->contents[$products_id]['qty'],
								'weight' => $products['products_weight'],
								'final_price' => ($products_price + $this->attributes_price($products_id)),
								'tax_class_id' => $products['products_tax_class_id'],
								'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''));
	}
  }

  return $products_array;
}

function show_total() {
  $this->calculate();

  return $this->total;
}

function show_weight() {
  $this->calculate();

  return $this->weight;
}
// ############ Added CCGV Contribution ##########
function show_total_virtual() {
  $this->calculate();

  return $this->total_virtual;
}

function show_weight_virtual() {
  $this->calculate();

  return $this->weight_virtual;
}
// ############ End Added CCGV Contribution ##########
function generate_cart_id($length = 5) {
  return tep_create_random_value($length, 'digits');
}

function get_content_type() {
  $this->content_type = false;

  if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) {
	  if (isset($this->contents[$products_id]['attributes'])) {
		reset($this->contents[$products_id]['attributes']);
		while (list(, $value) = each($this->contents[$products_id]['attributes'])) {
		  $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id");
		  $virtual_check = tep_db_fetch_array($virtual_check_query);

		  if ($virtual_check['total'] > 0) {
			switch ($this->content_type) {
			  case 'physical':
				$this->content_type = 'mixed';

				return $this->content_type;
				break;
			  default:
				$this->content_type = 'virtual';
				break;
			}
		  } else {
			switch ($this->content_type) {
			  case 'virtual':
				$this->content_type = 'mixed';

				return $this->content_type;
				break;
			  default:
				$this->content_type = 'physical';
				break;
			}
		  }
		}
		// ############ Added CCGV Contribution ##########
	  } elseif ($this->show_weight() == 0) {
		reset($this->contents);
		while (list($products_id, ) = each($this->contents)) {
		  $virtual_check_query = tep_db_query("select products_weight from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
		  $virtual_check = tep_db_fetch_array($virtual_check_query);
		  if ($virtual_check['products_weight'] == 0) {
			switch ($this->content_type) {
			  case 'physical':
				$this->content_type = 'mixed';

				return $this->content_type;
				break;
			  default:
				$this->content_type = 'virtual';
				break;
			}
		  } else {
			switch ($this->content_type) {
			  case 'virtual':
				$this->content_type = 'mixed';

				return $this->content_type;
				break;
			  default:
				$this->content_type = 'physical';
				break;
			}
		  }
		}
// ############ End Added CCGV Contribution ##########
	  } else {
		switch ($this->content_type) {
		  case 'virtual':
			$this->content_type = 'mixed';

			return $this->content_type;
			break;
		  default:
			$this->content_type = 'physical';
			break;
		}
	  }
	}
  } else {
	$this->content_type = 'physical';
  }

  return $this->content_type;
}

function unserialize($broken) {
  for(reset($broken);$kv=each($broken);) {
	$key=$kv['key'];
	if (gettype($this->$key)!="user function")
	$this->$key=$kv['value'];
  }
}

 }

 // ############ Added CCGV Contribution ##########
  // amend count_contents to show nil contents for shipping
  // as we don't want to quote for 'virtual' item
  // GLOBAL CONSTANTS if NO_COUNT_ZERO_WEIGHT is true then we don't count any product with a weight
  // which is less than or equal to MINIMUM_WEIGHT
  // otherwise we just don't count gift certificates

function count_contents_virtual() {  // get total number of items in cart disregard gift vouchers
  $total_items = 0;
  if (is_array($this->contents)) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) {
	  $no_count = false;
	  $gv_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
	  $gv_result = tep_db_fetch_array($gv_query);
	  if (ereg('^GIFT', $gv_result['products_model'])) {
		$no_count=true;
	  }
	  if (NO_COUNT_ZERO_WEIGHT == 1) {
		$gv_query = tep_db_query("select products_weight from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($products_id) . "'");
		$gv_result=tep_db_fetch_array($gv_query);
		if ($gv_result['products_weight']<=MINIMUM_WEIGHT) {
		  $no_count=true;
		}
	  }
	  if (!$no_count) $total_items += $this->get_quantity($products_id);
	}
  }
  return $total_items;
}
// ############ End Added CCGV Contribution ##########
 ?>

 

I was using the install instruction from v5.16 as those are the last offered.

 

I am sooo frustrated.

 

The GV is added as a product with the model number GIFT_25

 

Download enabled, DC and GV modules installed and what ever other suggestions were thrown around on the forum in the posts that I read.

 

I admit I only read 36 pages, but my eyes are burning. :)

 

Please if someone could help! Thank you in advance for your consideration!

 

Thanks again!!

Kyla

Rangeline Design

Michigan USA

Link to comment
Share on other sites

Many thanks to Strider!!

 

I too had a typo, though I will relay the results below. . . I had a } out of place at the very end of the shopping_cart.php file

 

Here is the way it should be. . . I had an extra } before the last comment and I need a } before the last ?>

 

Here is how it should have looked:

 

	function unserialize($broken) {
  for(reset($broken);$kv=each($broken);) {
	$key=$kv['key'];
	if (gettype($this->$key)!="user function")
	$this->$key=$kv['value'];
  }
}


 // ############ Added CCGV Contribution ##########
  // amend count_contents to show nil contents for shipping
  // as we don't want to quote for 'virtual' item
  // GLOBAL CONSTANTS if NO_COUNT_ZERO_WEIGHT is true then we don't count any product with a weight
  // which is less than or equal to MINIMUM_WEIGHT
  // otherwise we just don't count gift certificates

function count_contents_virtual() {  // get total number of items in cart disregard gift vouchers
  $total_items = 0;
  if (is_array($this->contents)) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) {
	  $no_count = false;
	  $gv_query = tep_db_query("select products_model from " . TABLE_PRODUCTS . " where products_id = '" . $products_id . "'");
	  $gv_result = tep_db_fetch_array($gv_query);
	  if (ereg('^GIFT', $gv_result['products_model'])) {
		$no_count=true;
	  }
	  if (NO_COUNT_ZERO_WEIGHT == 1) {
		$gv_query = tep_db_query("select products_weight from " . TABLE_PRODUCTS . " where products_id = '" . tep_get_prid($products_id) . "'");
		$gv_result=tep_db_fetch_array($gv_query);
		if ($gv_result['products_weight']<=MINIMUM_WEIGHT) {
		  $no_count=true;
		}
	  }
	  if (!$no_count) $total_items += $this->get_quantity($products_id);
	}
  }
  return $total_items;
}


// ############ End Added CCGV Contribution ##########
 }

?>

 

Hope this helps someone!

 

Take care!

Kyla

Rangeline Design

Michigan USA

Link to comment
Share on other sites

I have a huge problem trying to use this contrib. How do you guys edit orders that have a discount coupon applied to them?

 

The popular "Order Editor" contrib converts the discount into a positive and I don't think it can handle creating the discount from the result: "subtotal - discount = *result*", rather it takes the discount off the subtotal after changes are made to the order. Coupons work fine on their own, I just can't find a way to edit orders that have had coupons applied to them.

Link to comment
Share on other sites

  • 2 weeks later...

Hello everyone,

 

For those who are getting this error: Fatal error: Call to undefined function: clear_posts() in /home/sxxxxx/public_html/catalog/checkout_payment.php...

 

Problem found: a lot of code was missing in catalog/includes/classes/order_total.php in version CCGV5.18

 

Solution: uploaded a copy of catalog/includes/classes/order_total.php from version 5.13d. I had that version on my harddrive already. Will post copy if anyone requests.

 

Hope it helps someone :D

Link to comment
Share on other sites

Hi. I have version 5.16 of the CCGV contribution installed and working great, except for one minor issue:

 

On checkout_payment.php, after someone enters a coupon code and hits 'apply', the page refreshes (if they didn't also put in their CC info) and in the URL I see messages like:

 

/checkout_payment.php?payment_error=ot_coupon&error=Invalid+Coupon+Code (if a bad code was entered), and at the same time a section appears just above "Products Ordered" and it says:

 

Coupon Redemption

and then there is a blank red-shaded area below it, where I assume the Invalid Coupon Code error text is supposed to appear, but it doesn't.

 

I've checked my code over and over in the ot_coupon.php file and I can't see any errors.

 

Does anyone have any suggestions on what else I can look for that may be causing this problem?

 

Thanks!

 

-- Josh

Link to comment
Share on other sites

Hi,

 

I installed version 5.19 and am having a problem with the order totaling up correctly.

 

The VAT (tax) and also if a coupon code is applied the coupon code also is not added to the price.

 

Here's an example here -

 

examplelb0.png

 

It correctly applies the shipping charge, but not the tax (VAT) or the discount coupon.

 

I tried seeing if this had anything to do with my files and I replaced my customized files with all the files included in the 5.19 CCGV package. It still did not calculate the order total correctly. What file processes the order total and why would this be happening?

 

The modules I have installed include CGV, CCGV, bundles, and paypal WPP.

 

If maybe I knew what files processed the order total and would make this happen I could look into it further? I don't understand why replacing all the files with the default files wouldn't have fixed it.

 

Thanks

Edited by rjckicks1
Link to comment
Share on other sites

I fixed my problems.

 

The problem was that the sort order for discount coupons had to go before the total, and that fixed it.

 

For the tax it was becuase products were set to show price after tax, I had to set that to false so that products would show prices before tax.

Link to comment
Share on other sites

Hi,

 

there's a problem in this case :

 

- you have a basket of 15€ of products

- the costs of your carriage is 5.99€

- you have a Discount Coupon which gives the free carriage costs so you have -5.99€ to balance.

- you have 17€ of Gift Voucher

 

the total amount is 0.00€ but the error "ERROR_NO_PAYMENT_MODULE_SELECTED" appears

cause the total of the amount is 20.99€ (15+5.99) before the -5.99€.

 

i'm almost sure that the error is here

in "catalog/checkout_confirmation.php".

(around line 70)

// ################# Added CGV Contribution ##################"

// if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {

if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {

// ################# End Added CGV Contribution ##################"

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}

 

thanks a lot

Loic

Link to comment
Share on other sites

http://www.oscommerce.com/community/contri...all/search,ccgv

 

This is one of the most difficult and frustrating addons to install.

that worries me a bit even before i am going to install it and there don't seem to be manual instructions for installing this. that is if you already have an osc set up with other contributions trying to upgrade to this. instructions are just to copy the entire catalog folder to your webserver.

 

is this even worth the risk or effort ?

Link to comment
Share on other sites

that worries me a bit even before i am going to install it and there don't seem to be manual instructions for installing this. that is if you already have an osc set up with other contributions trying to upgrade to this. instructions are just to copy the entire catalog folder to your webserver.

 

is this even worth the risk or effort ?

I think the instructions say along the lines of if you have a new shop (no contributions) you can upload the files and overwrite the existing. Even on a fresh install of osc, this is risky for any contribution.

 

You should compare the files in the contrib with those of your shop and manually edit to make the required changes.

Link to comment
Share on other sites

Hi,

 

there's a problem in this case :

 

- you have a basket of 15€ of products

- the costs of your carriage is 5.99€

- you have a Discount Coupon which gives the free carriage costs so you have -5.99€ to balance.

- you have 17€ of Gift Voucher

 

the total amount is 0.00€ but the error "ERROR_NO_PAYMENT_MODULE_SELECTED" appears

cause the total of the amount is 20.99€ (15+5.99) before the -5.99€.

 

i'm almost sure that the error is here

in "catalog/checkout_confirmation.php".

(around line 70)

// ################# Added CGV Contribution ##################"

// if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {

if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {

// ################# End Added CGV Contribution ##################"

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}

 

thanks a lot

Loic

 

I have the same problem and what's worst is that when the order is $0.00 (Example: Order is $20 and the Gift Certificate is $20) and the customer wants to pay by Paypal, Paypal gives an error since Paypal is expecting some sort of dollar amount.

 

FLIBIU :'(

Link to comment
Share on other sites

I have the same problem and what's worst is that when the order is $0.00 (Example: Order is $20 and the Gift Certificate is $20) and the customer wants to pay by Paypal, Paypal gives an error since Paypal is expecting some sort of dollar amount.

 

FLIBIU :'(

It should not do that if you have it installed correctly.

Link to comment
Share on other sites

indeed, this case is normally works.

However, my case don't work.

This case is very important for our website, cause we offer the carriage costs regularly.

So you need to carefully check the edits you did to install it.

Link to comment
Share on other sites

Hi,

 

there's a problem in this case :

 

- you have a basket of 15€ of products

- the costs of your carriage is 5.99€

- you have a Discount Coupon which gives the free carriage costs so you have -5.99€ to balance.

- you have 17€ of Gift Voucher

 

the total amount is 0.00€ but the error "ERROR_NO_PAYMENT_MODULE_SELECTED" appears

cause the total of the amount is 20.99€ (15+5.99) before the -5.99€.

 

i'm almost sure that the error is here

in "catalog/checkout_confirmation.php".

(around line 70)

// ################# Added CGV Contribution ##################"

// if ( ( is_array($payment_modules->modules) && (sizeof($payment_modules->modules) > 1) && !is_object($$payment) ) || (is_object($$payment) && ($$payment->enabled == false)) ) {

if ( (is_array($payment_modules->modules)) && (sizeof($payment_modules->modules) > 1) && (!is_object($$payment)) && (!$credit_covers) ) {

// ################# End Added CGV Contribution ##################"

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_NO_PAYMENT_MODULE_SELECTED), 'SSL'));

}

 

thanks a lot

Loic

 

Hey loic_425,

 

Did you find a fix for "No payment method selected" message?

If I don't select a payment method, then I can't checkout. If I do select Paypal and the order is $0.00 after the Gift Certificate is applied then Paypal gives me this error, "The link you have used to enter the PayPal system contains an incorrectly formatted item amount."

 

99% there,

FLIBIU

Link to comment
Share on other sites

Hey loic_425,

 

Did you find a fix for "No payment method selected" message?

If I don't select a payment method, then I can't checkout. If I do select Paypal and the order is $0.00 after the Gift Certificate is applied then Paypal gives me this error, "The link you have used to enter the PayPal system contains an incorrectly formatted item amount."

 

99% there,

FLIBIU

 

I don't use paypal payment. We use a payment with a french bank.

and the 0€ amount return this :

erreur2.JPG

 

to illustrate this is the details of the costs :

erreur1.JPG

in french sorry...

sub-total : 16.74

Carriage costs : 5.99

taxes : 2.74

sponsorship : -1.37

Gift voucher : -5.99 (the carriage costs which is free)

Total : 15.07

and i Have 17€ of voucher balance...

 

i have of course the checkbox of "payment with gift voucher" checked

 

So you need to carefully check the edits you did to install it.

 

I make the new version of our site with oscommerce which is not yet "online".

Link to comment
Share on other sites

Wassup everyone Took me days and a very upset girlfriend to get this right... Hope it works for everyone as I am working hard to debug this contrib. OK...

 

OPEN CATALOG/CHECKOUT_CONFIRMATION

FIND THIS....(AROUND 65 - 69)

 

if (isset($_POST['gv_redeem_code']) && ($_POST['gv_redeem_code'] == null)) {tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 

THEN ADD: // IN FRONT TO SILENT THAT CODE

 

SHOULD WORK. HOLLA BACK...

 

ALSO, FOUND A LIL TEMP FIX FOR THOSE WHO CONTINUE BUTTON DOESN'T WORK. BE BACK WITH FULL DETAIL.

SORRY FOR THE TEASER

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...