Jump to content

Archived

This topic is now archived and is closed to further replies.

irishguy9

CCGV help

Recommended Posts

I am getting the following error:

 

Undefined variable: output_string in /home/giftboun/public_html/includes/classes/order_total.php on line 100

 

I am using the oscommerce from github if that makes a difference.

 

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";
        $output_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";
        reset($this->modules);
        $output_string = '';
        foreach($this->modules as $value) {
          $class = substr($value, 0, strrpos($value, '.'));
          if ($GLOBALS[$class]->enabled && $GLOBALS[$class]->credit_class) {
            $use_credit_string = $GLOBALS[$class]->use_credit_amount();

Share this post


Link to post
Share on other sites

What version are you using? "Github" tells us nothing. There are several versions floating around on Github.

 

My best guess is that the line

 

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

is a typo, and should be

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

Share this post


Link to post
Share on other sites

Now I am getting this error:

 

Notice: Undefined property: ot_subtotal::$credit_class in /home/giftboun/public_html/includes/classes/order_total.php on line 109

 

I changed this line:

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";
        $output1_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";
        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 != '') ) {

To the following, I am not sure it is right but I am getting the error above now:

function credit_selection() {
	  $output_string = '';
      $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";
        $output_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";
		  if (is_array($this->modules)) {
        foreach($this->modules as $value) {
			$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 != '') ) {

Share this post


Link to post
Share on other sites
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";//<--- as Mr Phil suggests
        $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";
        reset($this->modules);
        $output_string = '';//<-- this line should not through throw (durr) an error

Notice: Undefined property: ot_subtotal::$credit_class in /home/giftboun/public_html/includes/classes/order_total.php on line 109

 

Sounds like the file includes/classses/ot_subtotal.php should have some code added in for CCGV - have a look for a chunk maybe starting:

 

function credit_class() or a bit that creasytes $credit_class  (and if the latter see if there's anyplace that it is declared global)

Share this post


Link to post
Share on other sites

These are the errors I am getting:

 

There is no Function credit_class. However, there is $this->credit_class = true

 

I am confused because it worked before until I added $_SESSION variables could this be the case?

 

Notice: Undefined property: ot_subtotal::$credit_class in /home/giftboun/public_html/includes/classes/order_total.php on line 98 Call Stack # Time Memory Function Location 1 0.0015 296608 {main}( ) ../checkout_payment.php:0 2 0.0825 3745912 order_total->credit_selection( ) ../checkout_payment.php:260
( ! ) Notice: Undefined property: ot_shipping::$credit_class in /home/giftboun/public_html/includes/classes/order_total.php on line 98 Call Stack # Time Memory Function Location 1 0.0015 296608 {main}( ) ../checkout_payment.php:0 2 0.0825 3745912 order_total->credit_selection( ) ../checkout_payment.php:260
( ! ) Notice: Undefined property: ot_tax::$credit_class in /home/giftboun/public_html/includes/classes/order_total.php on line 98 Call Stack # Time Memory Function Location 1 0.0015 296608 {main}( ) ../checkout_payment.php:0 2 0.0825 3745912 order_total->credit_selection( ) ../checkout_payment.php:260
( ! ) Notice: Undefined property: ot_total::$credit_class in /home/giftboun/public_html/includes/classes/order_total.php on line 98

Share this post


Link to post
Share on other sites

I am also getting this error:

 

Notice: Array to string conversion in /home/giftboun/public_html/checkout_payment.php on line 260

 

that is line 260

 

<?php echo $order_total_modules->credit_selection();

Share this post


Link to post
Share on other sites

How about includes/modules/order_total/credit_(something).php -  - that file is there and the module installed vai the admin? The stack trace suggests that it cannotfind a selection() function from within the ccgv credit order total.

 

Sessions would not affect this.

 

The array to string is because there is no value for $order_total_modules->credit_selection()

Share this post


Link to post
Share on other sites

@@Bob Terveuren ok I fixed that now I have a problem that I noticed and not sure if in original code or not.

 

If you have a coupon for the complete amount of the cart, you cannot checkout for FREE.
There is no free payment available if the cart total is above $0.00 and the coupon is not applied until after the payment type is processed.

 

I was wondering maybe make a if statement but not sure on how to do this. Any help would be appreciated.

Share this post


Link to post
Share on other sites

@@drillsar...wow...things were really broken in your CCGV install...these are the only two files that should have $this->credit_class = true;

 

[xxxx@server1 order_total]$ grep credit_class *.php

ot_coupon.php:  $this->credit_class = true;
ot_gv.php:      $this->credit_class = true;

Ok...as for the credit covers...there is a $credit_covers session variable for that...if you don't you may need to re-read the CCGV installation readme to make sure that all the steps were followed, or implement it yourself...I kept with the CCGV I had started about 10 years ago (version 5.13???) and never look at the later updates as they were terrible and a lot of things had gotten broken since!!!!

 

I will give you an overall concept on how to accomplish this...

 

1) if you setup the order of the order_total classes properly...CCGV should set the session variable $credit_covers to true...

2) the magic happens in checkout_process, where $payment would set to be ''...

 

/* CCGV - BEGIN */
  if ($credit_covers) $payment='';
  $payment_modules = new payment($payment);
/* CCGV - END */

3) it's up to you on how to deal with the payment method in the checkout_confirmation.php page...I just just jQuery to disable and dim it...10 years ago when Javascript/jQuery was not the shiz I just simply not shown the payment module table row...this is how I do it now...it looks kinda cool and customers gotta really see that they are getting free stuff...

 

    <script>
      $(document).ready(function(){
        if (1 == <?php echo ($credit_covers == true ? 1 : 0); ?>) {
          $("#payment select").attr("disabled", "disabled");
          $("#payment input[type=text]").attr("disabled", "disabled");
          $("#payment").fadeTo('slow', 0.33);
        }
      });
    </script>

Best of luck...you gonna need it...Tim

Share this post


Link to post
Share on other sites

×