Jump to content
deep-silver

### POINTS AND REWARDS MODULE V1.00 ###

Recommended Posts

Hi,

 

I know this thread is old and may not be monitored anymore, but I have recently installed this addon and have 2 issues.

 

  1. There are 2 instances of the module in my admin configuration box
  2. When using points as payment (full or partial) and utilizing Paypal as my means of payment, I see the following:
  • the detailed invoice disappears
  • just a grand total that correctly reflects the redemption of points

 

There may be more involved than just this addon module, because in the Paypal invoice window all I normally see is the detail item descriptions with price and a total not reflecting tax / shipping. The shipping / tax / discounts do not show even though I have all of that configured in my admin site.

 

Any help / advice would be greatly appreciated.

Share this post


Link to post
Share on other sites

anyone know how to get this module to work with this payment module?

cardstream_form.php

<?php



class cardstream_form {



    var $code, $title, $description, $enabled;



    // class constructor

    function cardstream_form() {

	

	global $order;



	$this->code = 'cardstream_form';

	$this->version = "Cardstream";



	// Perform error checking of module's configuration ////////////////////////////////////////

	$critical_config_problem = false;



	$this->form_action_url = "https://gateway.cardstream.com/hosted/";



	$cardstream_form_config_messages = '';



	$cardstream_form_config_messages .= '<fieldset style="background: #d0d0d0; margin-bottom: 1.5em"><legend style="font-size: 1.2em; font-weight: bold">Module Version Information</legend>';

	$cardstream_form_config_messages .= '<p>File Version: ' . $this->version;

	$this->description = '';



	$this->title = "Credit or Debit Card";





	$this->enabled = ((MODULE_PAYMENT_CARDSTREAM_FORM_STATUS == 'True') ? true : false);

	$this->sort_order = MODULE_PAYMENT_CARDSTREAM_FORM_SORT_ORDER;



	if ((int) MODULE_PAYMENT_CARDSTREAM_FORM_ORDER_STATUS_ID > 0) {

	    $this->order_status = MODULE_PAYMENT_CARDSTREAM_FORM_ORDER_STATUS_ID;

	}



	if (is_object($order)) {

	    $this->update_status();

	}



	}



	function update_status() {

      global $order;



      if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_CARDSTREAM_FORM_ZONE > 0) ) {

        $check_flag = false;

        $check = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_CARDSTREAM_FORM_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");

        while (!$check->EOF) {

          if ($check->fields['zone_id'] < 1) {

            $check_flag = true;

            break;

          } elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {

            $check_flag = true;

            break;

          }

          $check->MoveNext();

        }



        if ($check_flag == false) {

          $this->enabled = false;

        }

      }

    }



	function javascript_validation() {

	    return false;

	}



	function selection() {

	    return array('id' => $this->code,

		'module' => $this->title);

	}



	function pre_confirmation_check() {

	    return false;

	}



	function confirmation() {

	    return false;

	}



	function process_button() {

	    global $order, $currencies, $currency, $customer_id, $cart, $products, $contents;



	    $amount = round($order->info['total']*100);



		$transU = md5(mktime());

		$retURL = tep_href_link(FILENAME_CHECKOUT_PROCESS, tep_session_name() . '=' . tep_session_id(), 'SSL', false);

	    $process_button_string = '';



		$fields = array(

			'transactionUnique' => $transU,

			'amount' => $amount,

			'merchantID' => MODULE_PAYMENT_CARDSTREAM_FORM_MERCHANT_ID,

			'countryCode' => MODULE_PAYMENT_CARDSTREAM_FORM_COUNTRY_ID,

			'currencyCode' => MODULE_PAYMENT_CARDSTREAM_FORM_CURRENCY_ID,

			'redirectURL' => $retURL,

			'customerName' => $order->customer['firstname'].' '.$order->customer['lastname'],

			'customerAddress' => $order->customer['street_address']."\n".$order->customer['city']."\n".$order->customer['state'],

			'customerPostcode' => $order->customer['postcode'],

			'customerPhone' => $order->customer['telephone'],

			'customerEmail' => $order->customer['email_address']

		);



		ksort($fields);

		$fields['signature'] = hash('SHA512',http_build_query($fields, '', '&').MODULE_PAYMENT_CARDSTREAM_FORM_PRE_SHARED_KEY).'|'.implode(',',array_keys($fields));



		foreach($fields as $k => $v){

			$process_button_string .= tep_draw_hidden_field($k, $v);

		}



	    return $process_button_string;

	}



	function after_order_create($zf_order_id)

	{

		global $order, $currencies, $currency, $customer_id, $cart, $products, $contents;

		// Save response from cardstream in the database

		$cardstream_form_response_array = array(

			'transid' => $_POST['transactionUnique'],

			'zen_order_id' => $zf_order_id,

			'received' => $_POST['amountReceived'],

			);

		zen_db_perform("cardstream_form", $cardstream_form_response_array);

	}



	function get_error(){

	    return array('title' => "Payment Error",

		 'error' => "There has been an error with your payment. Please try again.");

	}



	function admin_notification($zf_order_id)

	{



		$sql = "

			SELECT

				*

			FROM

				cardstream_form

			WHERE

				zen_order_id = '" . $zf_order_id . "'";



		$cardstream_form_transaction_info = tep_db_query($sql);



		require(DIR_FS_CATALOG. DIR_WS_MODULES .

			'payment/cardstream_form/cardstream_form_admin_notification.php');



		return $output;

	}

	

	function before_process() {

	    global  $messageStack,$order,$code;



	    $amount = round($order->info['total']*100);



	    if (($_POST["responseCode"] != "0") || ($_POST["amountReceived"] != $amount)) {

		    //$errorcode = "Payment Failed. Please try again.";



		    tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . (tep_not_null($error) ? '&error=' . $error : ''), 'SSL'));

	    }



	}



	function after_process() {

	    return false;

	}



	function check() {

	    if (!isset($this->_check)) {

		$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_PAYMENT_CARDSTREAM_FORM_STATUS'");

		$this->_check = tep_db_num_rows($check_query);

	    }

	    return $this->_check;

	}



	function install() {

	    // General Config Options

	    $background_colour = '#d0d0d0';

	    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 ('</b><fieldset style=\"background: " . $background_colour . "; margin-bottom: 1.5em;\"><legend style=\"font-size: 1.4em; font-weight: bold\">General Config</legend><b>Enable Cardstream Module', 'MODULE_PAYMENT_CARDSTREAM_FORM_STATUS', 'True', 'Do you want to accept Cardstream payments?', '6', '0', '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, date_added) values ('Merchant ID', 'MODULE_PAYMENT_CARDSTREAM_FORM_MERCHANT_ID', '', '', '2', '1', now())");

	    tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Merchant Signature Key', 'MODULE_PAYMENT_CARDSTREAM_FORM_PRE_SHARED_KEY', '', '', '2', '1', now())");

	    tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Front End Name', 'MODULE_PAYMENT_CARDSTREAM_FORM_CATALOG_TEXT_TITLE', '', '', '3', '1', now())");

	    tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Currency ID', 'MODULE_PAYMENT_CARDSTREAM_FORM_CURRENCY_ID', '', '', '4', '1', now())");

	    tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Country ID', 'MODULE_PAYMENT_CARDSTREAM_FORM_COUNTRY_ID', '', '', '5', '1', now())");

	    $background_colour = '#eee';

	}



	function remove() {

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

	}



	function keys() {

	    return array(

		'MODULE_PAYMENT_CARDSTREAM_FORM_MERCHANT_ID',

		'MODULE_PAYMENT_CARDSTREAM_FORM_CURRENCY_ID',

		'MODULE_PAYMENT_CARDSTREAM_FORM_PRE_SHARED_KEY',

		'MODULE_PAYMENT_CARDSTREAM_FORM_CATALOG_TEXT_TITLE',

		'MODULE_PAYMENT_CARDSTREAM_FORM_COUNTRY_ID',

		'MODULE_PAYMENT_CARDSTREAM_FORM_STATUS'

	    );

	}



    }



?>

Share this post


Link to post
Share on other sites

Hi

 

i got this module from http://addons.oscommerce.com/info/9193

 

yet it still says to ask for support here....

 

first  thing i note is that at checkout_process.php i get:

 

Parse error: syntax error, unexpected end of file in /var/www/xn--pizzalg-v1a.dk/public_html/checkout_process.php on line 423

 

the file looks like this:

 

http://pastebin.com/FrEXgnpv

 

send these mails directly also:

 

--------------------MAIL1-----------------------------

also i noted that the account.php was in the modified files folder, but you did not make any changes to the file

 
also under catalog\includes\modules\payment\ there are the paypal_standard.php
 
i dont have that one as i dont use paypal... but i assume that i should add the same to all my payment modules
 
at the beginning of the file i see: // Points/Rewards Module V3.0 balance customer points BOF
 
but i never see a EOF 
 
the next i see is: /*#### Points/Rewards Module V3.0 for osc2.3.4 balance customer points BOF ####*/
 
so i assume there are no changes before the the 2nd edit
 
 
just writing this so you can update the module and maybe explain it a bit better.... but otherwise i like the way you have done... still missing a lot of files but i like to write over several mails so i dont forget
 
--------------------MAIL2-----------------------------
in \includes\classes\payment.php
 
//Points/Rewards Module V3.0 BOF
 
but i dont see a EOF...
 
is this a fault?

 

--------------------MAIL3-----------------------------

 

in includes\

 
you have a boxes folder... oscommerce does not have that...
 
was this a fault?

Quo plus habent, eo plus cupiunt

Share this post


Link to post
Share on other sites

also i see this when i access http://xn--pizzalg-v1a.dk/my_points_help.php

 

Deprecated: Function split() is deprecated in /var/www/xn--pizzalg-v1a.dk/public_html/includes/languages/danish/my_points_help.php on line 215

 

 

 

EDIT: Admin side seems to work as it should, i just need to translate it to danish

 

 

 

EDIT2: if i add a point to my test account in the shop i get this at checkout_Payment:

 

 

Deprecated: Function split() is deprecated in /var/www/xn--pizzalg-v1a.dk/public_html/includes/functions/redemptions.php on line 103

Deprecated: Function split() is deprecated in /var/www/xn--pizzalg-v1a.dk/public_html/includes/functions/redemptions.php on line 104

Deprecated: Function split() is deprecated in /var/www/xn--pizzalg-v1a.dk/public_html/includes/functions/redemptions.php on line 316

Deprecated: Function split() is deprecated in /var/www/xn--pizzalg-v1a.dk/public_html/includes/functions/redemptions.php on line 317

Edited by boelle

Quo plus habent, eo plus cupiunt

Share this post


Link to post
Share on other sites

removed this part in checkout process and it let me go on:

#### Points/Rewards Module V3.0 balance customer points BOF ####
  if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
// customer pending points added 
      if ($order->info['total'] > 0) {
              $points_toadd = get_points_toadd($order);
              $points_comment = 'TEXT_DEFAULT_COMMENT';
              $points_type = 'SP';
              if ((get_redemption_awards($customer_shopping_points_spending) == true) && ($points_toadd >0)) {
                      tep_add_pending_points($customer_id, $insert_id, $points_toadd, $points_comment, $points_type);
              }
      }
// customer referral points added 
      if ((tep_session_is_registered('customer_referral')) && (tep_not_null(USE_REFERRAL_SYSTEM))) {
              $referral_twice_query = tep_db_query("select unique_id from " . TABLE_CUSTOMERS_POINTS_PENDING . " where orders_id = '". (int)$insert_id ."' and points_type = 'RF' limit 1");
              if (!tep_db_num_rows($referral_twice_query)) {
                      $points_toadd = USE_REFERRAL_SYSTEM;
                      $points_comment = 'TEXT_DEFAULT_REFERRAL';
                      $points_type = 'RF';
                      tep_add_pending_points($customer_referral, $insert_id, $points_toadd, $points_comment, $points_type);
              }
      }
// customer shoppping points account balanced 
      if ($customer_shopping_points_spending) {
              tep_redeemed_points($customer_id, $insert_id, $customer_shopping_points_spending);
      }
  }

Quo plus habent, eo plus cupiunt

Share this post


Link to post
Share on other sites

also just noted that the copyright notice in admin says module is V2 even thou i got it from the addon page where it says V3


Quo plus habent, eo plus cupiunt

Share this post


Link to post
Share on other sites

bummer... the module award points for everything.... ie if i restrict to a single product it also tells about points for other products  :(


Quo plus habent, eo plus cupiunt

Share this post


Link to post
Share on other sites

Deprecated: Function split() is deprecated 

 

fixed that by replacing split with explode in the code... 

 

so besides translation and the fact that is gives points for everything its pretty close to "useable"

 

i assume the problem in checkout_process is just a small thing but cant see it


Quo plus habent, eo plus cupiunt

Share this post


Link to post
Share on other sites

i strongly doubt that the link to ver3 in the addons library is really v3...

 

just translating the admin section and found:

 

define('MOD_VER', '2.00');


Quo plus habent, eo plus cupiunt

Share this post


Link to post
Share on other sites

Hi All,

 

I recently use this addons on fresh OSC.

 

I have setup all the settings and also read all available documents for this.

 

When i test this, i think it did not work correctly.

 

When any user signup or place an order, the user gets credit of points his/her account. But when i try to use points on checkout, it is not deduct from the total amount.

 

What could i missed here?

 

anybody have any idea about such issue?

 

Regards

Tejas

Share this post


Link to post
Share on other sites

Hello

 

Get this error on checkout:

 

0ddsd

Warning: Cannot modify header information - headers already sent by (output started at /home/httpd/vhosts/mydomain.com/httpdocs/shop/checkout_confirmation.php:57) in /home/httpd/vhosts/mydomain.com/httpdocs/shop/includes/functions/general.php on line 49

 

What is that 0ddsd???

 

That comes form checkout_confirmation.php

 

echo tep_calc_shopping_pvalue($customer_shopping_points_spending);

    if (isset($HTTP_POST_VARS['customer_shopping_points_spending'])&&tep_calc_shopping_pvalue($customer_shopping_points_spending) < $order->info['total'] && !is_object($$payment)) {
     echo "ddsd";
 
Why is this?
Thank you for your help!

 

Share this post


Link to post
Share on other sites

After new install, I am getting this error if I choose pay with Shopping Points Redemptions

 

"Points value are not enough to cover the cost of your purchase. Please select another payment method"

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

×