Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shopping cart help


lrgayle25

Recommended Posts

Hello,

 

I am new to this post I spend hours and install the separate pricing and this is the error that I am getting

products_new.php

 

Not sure if anyone can help me

 

Fatal error: Call to undefined method shoppingCart::get_popup_product() in public_html/includes/modules/boxes/h_shopping_cart.php on line 156

 

 

 

   $product = $cart->get_popup_product(   $popUpContent = '';
   $product = $cart->get_popup_product($new_products_id_in_cart, $new_products_atribute);$new_products_id_in_cart, $new_products_atribute);
   
   $popUpContent ='';
   $popUpContent .= '<div class="popup-container">'.
        ' <div class="popup-heading">'.MODULE_BOXES_HEADER_SHOPPING_CART_SUCCESS.'</div>'.
        ' <div class="product-image">'.
        '  <a href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product['id']).'">'.tep_image(DIR_WS_IMAGES . $product['image'], $product['name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT).'</a>'.
        ' </div>'.
        ' <div class="product-info">'.
        '  <a class="product-name" href="'.tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $product['id']).'">'.$product['name'].'</a>'.
        '  <div class="price">'.$currencies->display_price($product['final_price'], tep_get_tax_rate($product['tax_class_id'])).'</div>'.
        '  <div class="popup-button">'. tep_draw_button(HEADER_TITLE_CART_CONTENTS, 'btn btn-default', tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL')).'</div>'.
        ' </div>'.
        '</div>';
 

Link to comment
Share on other sites

I have not used this addon before, but I just downloaded the files to see what it involves. I do not see this particular file anywhere in the addon or my site files either, so not know what it is for: 

 

includes/modules/boxes/h_shopping_cart.php

 

Did you add that file for another addon perhaps?

Link to comment
Share on other sites

Here is my original file

 

<?php
  require('includes/application_top.php');
 
  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCTS_NEW);
  $current_page = FILENAME_PRODUCTS_NEW;
  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW));
 
  require(DIR_WS_INCLUDES . 'template_top.php');
?>
 
<h1 class="page-heading product-list"><span><?php echo HEADING_TITLE; ?></span></h1>
<div class="block-content">
  <?php
  $products_new_array = array();
 
  $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name, m.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";
  $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);
if ($products_new_split->number_of_rows > 0) {
echo tep_gridlist_build();
}
  if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <div class="listing-panel top-panel top-view">
    <div class="row">
      <div class="col-xs-6 displayText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></div>
      <div class="col-xs-6"><?php echo $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))) . '<span class="resultText">'. TEXT_RESULT_PAGE . '</span>'; ?></div>
    </div>
  </div>
  <?php
  }
?>
  <?php
  if ($products_new_split->number_of_rows > 0) {
?>
  <ul class="row product-listing">
    <?php
// BOF Separate Pricing Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id
  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
    $customer_group_id = $_SESSION['sppc_customer_group_id'];
  } else {
    $customer_group_id = '0';
  }
 
    $products_new_query = tep_db_query($products_new_split->sql_query);
    $no_of_products_new = tep_db_num_rows($products_new_query);
    while ($_products_new = tep_db_fetch_array($products_new_query)) {
      $products_new[] = $_products_new;
      $list_of_prdct_ids[] = $_products_new['products_id'];
    }
 
  $select_list_of_prdct_ids = "products_id = '" . $list_of_prdct_ids[0] . "' ";
   if ($no_of_products_new > 1) {
     for ($n = 1 ; $n < count($list_of_prdct_ids) ; $n++) {
       $select_list_of_prdct_ids .= "or products_id = '" . $list_of_prdct_ids[$n] . "' ";
     }
   }
 
// get all customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id zero
if ($customer_group_id != '0') {
  $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from products_groups pg where (" . $select_list_of_prdct_ids . ") and pg.customers_group_id = '" . $customer_group_id . "'");
while ($pg_array = tep_db_fetch_array($pg_query)) {
 $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '');
}
 
   for ($x = 0; $x < $no_of_products_new; $x++) {
// replace products prices with those from customers_group table
// originally they would be obtained with an extra query for every new product:
//   if ($new_price = tep_get_products_special_price($products_new['products_id'])) {
 
     if (!empty($new_prices)) {
       for ($i = 0; $i < count($new_prices); $i++) {
         if ($products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
           $products_new[$x]['products_price'] = $new_prices[$i]['products_price'];
         }
       }
     } // end if (!empty($new_prices)
   } // end for ($x = 0; $x < $no_of_products_new; $x++)
} // end if ($customer_group_id != '0')
 
// an extra query is needed for all the specials
 
$specials_query = tep_db_query("select s.products_id, specials_new_products_price from " . TABLE_SPECIALS . " s  where (".$select_list_of_prdct_ids.") and status = '1' and s.customers_group_id = '" .$customer_group_id. "'");
while ($specials_array = tep_db_fetch_array($specials_query)) {
 $new_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price']);
}
 
// replace specials_new_products_price with those those for the customers_group_id
for ($x = 0; $x < $no_of_products_new; $x++) {
 
      if (!empty($new_prices)) {
        for ($i = 0; $i < count($new_prices); $i++) {
          if ( $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
            $products_new[$x]['specials_new_products_price'] = $new_prices[$i]['specials_new_products_price'];
          }
        }
      } // end if (!empty($new_prices)
 
if (tep_not_null($products_new[$x]['specials_new_products_price'])) {
       $products_price = '<s>' . $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products_new[$x]['specials_new_products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</span>';
} else {
$products_price = $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id']));
}
?>
          <tr>
            <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new[$x]['products_image'], $products_new[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
            <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '"><b><u>' . $products_new[$x]['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new[$x]['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new[$x]['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
            <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
          </tr>
          <tr>
            <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
<?php // EOF Separate Pricing Per Customer
   } // end for ($x = 0; $x < $no_of_products_new; $x++)
 }  else {
 
 
$products_new_content .= tep_product_block_build(
  $productId = $products_new['products_id'],
$productImage = $products_new['products_image'], 
$productName = $products_new['products_name'],
$productAdded = $products_new['products_date_added'],
$productManufacturerId = $products_new['manufacturers_id'],
$productManufacturerName = $products_new['manufacturers_name'],
$productPrice = $products_price,
$productPriceNew = $products_price_new,
$productWeight = '', 
$productQuantity = '', 
$productModel = '',
$productDescription = $p_desc_list.$p_desc_grid,
$productButtons = true,
$pageComming = FILENAME_PRODUCTS_NEW,
$elCount =$i
);
    }
 
echo $products_new_content;
?>
  </ul>
  <?php
  } else {
?>
  <div class="alert alert-info"> <?php echo TEXT_NO_NEW_PRODUCTS; ?> </div>
  <?php
  }
 
  if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>
  <div class="listing-panel bottom-panel">
    <div class="row">
      <div class="col-xs-6 displayText"><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></div>
      <div class="col-xs-6"><?php echo $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))) . '<span class="resultText">'. TEXT_RESULT_PAGE . '</span>'; ?></div>
    </div>
  </div>
  <?php
  }
?>
</div>
<?php
  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Link to comment
Share on other sites

this is what I was supposed to changed with the contribution 

 

Lines 79-97 [80-98]
**REPLACE**

 

$products_new_query = tep_db_query($products_new_split->sql_query);
    while ($products_new = tep_db_fetch_array($products_new_query)) {
      if ($new_price = tep_get_products_special_price($products_new['products_id'])) {
        $products_price = '<s>' . $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';
      } else {
        $products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));
      }
?>
          <tr>
            <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
            <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><b><u>' . $products_new['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
            <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
          </tr>
          <tr>
            <td colspüan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
<?php
    }
  } else {
 
**WITH**
 
// BOF Separate Pricing Per Customer
//  global variable (session): $sppc_customers_group_id -> local variable $customer_group_id
  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
    $customer_group_id = $_SESSION['sppc_customer_group_id'];
  } else {
    $customer_group_id = '0';
  }
 
    $products_new_query = tep_db_query($products_new_split->sql_query);
    $no_of_products_new = tep_db_num_rows($products_new_query);
    while ($_products_new = tep_db_fetch_array($products_new_query)) {
      $products_new[] = $_products_new;
      $list_of_prdct_ids[] = $_products_new['products_id'];
    }
 
  $select_list_of_prdct_ids = "products_id = '" . $list_of_prdct_ids[0] . "' ";
   if ($no_of_products_new > 1) {
     for ($n = 1 ; $n < count($list_of_prdct_ids) ; $n++) {
       $select_list_of_prdct_ids .= "or products_id = '" . $list_of_prdct_ids[$n] . "' ";
     }
   }
 
// get all customers_group_prices for products with the particular customer_group_id
// however not necessary for customer_group_id zero
if ($customer_group_id != '0') {
  $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from products_groups pg where (" . $select_list_of_prdct_ids . ") and pg.customers_group_id = '" . $customer_group_id . "'");
while ($pg_array = tep_db_fetch_array($pg_query)) {
 $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '');
}
 
   for ($x = 0; $x < $no_of_products_new; $x++) {
// replace products prices with those from customers_group table
// originally they would be obtained with an extra query for every new product:
//   if ($new_price = tep_get_products_special_price($products_new['products_id'])) {
 
     if (!empty($new_prices)) {
       for ($i = 0; $i < count($new_prices); $i++) {
         if ($products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
           $products_new[$x]['products_price'] = $new_prices[$i]['products_price'];
         }
       }
     } // end if (!empty($new_prices)
   } // end for ($x = 0; $x < $no_of_products_new; $x++)
} // end if ($customer_group_id != '0')
 
// an extra query is needed for all the specials
 
$specials_query = tep_db_query("select s.products_id, specials_new_products_price from " . TABLE_SPECIALS . " s  where (".$select_list_of_prdct_ids.") and status = '1' and s.customers_group_id = '" .$customer_group_id. "'");
while ($specials_array = tep_db_fetch_array($specials_query)) {
 $new_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price']);
}
 
// replace specials_new_products_price with those those for the customers_group_id
for ($x = 0; $x < $no_of_products_new; $x++) {
 
      if (!empty($new_prices)) {
        for ($i = 0; $i < count($new_prices); $i++) {
          if ( $products_new[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
            $products_new[$x]['specials_new_products_price'] = $new_prices[$i]['specials_new_products_price'];
          }
        }
      } // end if (!empty($new_prices)
 
if (tep_not_null($products_new[$x]['specials_new_products_price'])) {
       $products_price = '<s>' . $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($products_new[$x]['specials_new_products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id'])) . '</span>';
} else {
$products_price = $currencies->display_price($products_new[$x]['products_price'], tep_get_tax_rate($products_new[$x]['products_tax_class_id']));
}
?>
          <tr>
            <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new[$x]['products_image'], $products_new[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
            <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '"><b><u>' . $products_new[$x]['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new[$x]['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new[$x]['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>
            <td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
          </tr>
          <tr>
            <td colspan="3"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
          </tr>
<?php // EOF Separate Pricing Per Customer
   } // end for ($x = 0; $x < $no_of_products_new; $x++)
 }  else {
Link to comment
Share on other sites

@@lrgayle25

 

Yes that's the contribution and v2.3.4

 

That add on is for the Bootstrap version....is that the version of osC that you installed?

 

Dan

Link to comment
Share on other sites

@@lrgayle25 it will be very difficult for you to install this addon without a significant amount of changes to the core code in your store. If you do not need all features of this addon i would recommend http://addons.oscommerce.com/info/9416

 

SPPC takes significant skill to install - and again, because of the number of changes to the core code you risk building a store that is difficult to maintain.

Link to comment
Share on other sites

  • 1 month later...

Archived

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

×
×
  • Create New...