Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I'm having a weird problem since trying to get hide products and categories from customer groups for SPPC up and running. If I am logged in as a Retail customer, I can go through the checkout process just fine.

 

If, however; I am logged in as a Wholesale customer - I can't get past the Shopping Cart page. It doesn't matter which "Checkout" link I use - all it does is re-load the shopping_cart.php page :huh:

 

Any thoughts?

 

Thank you,

 

PS - I did do a WinMerge comparison on the classes/shopping_cart.php file I have on the site and the one that came with the hide products and categories for SPPC contrib. and they are identical.

~Tracy
 

Link to comment
Share on other sites

Hi All,

 

I had SPPC installed and required the Price Break features, so manually upgraded with Price Breaks SPPC_Price_Break_v1_02, and my site is still working except for :-

 

In my products_listing the Description is not showing up.

In my products_info the Description is not showing.

 

This is just for the single item I have set Price Breaks for, the other products are showing the Description in both places.....

 

Any hints on which bits I may have got wrong ?

 

I suspect the both the catalog/includes/modules/product_listing.php and catalog/product_info.php ,,, but I could be wrong :)

 

The database table products_description has the field Description set to the text I would normally see.....

 

I have SEO Urls, Register Globals, CSS Menus, Header Tags, SPPC +PB contribs installed.

 

TIA

Link to comment
Share on other sites

Please forgive my error in prevoius post....

 

It seems it is the product_name not description, that is not showing up, in product_listing, product_info, and it seems in the Admin Categories in the Categories list, and in the Admin/Categories/Products/Edit function of catalog/admin/categories.php.

 

The Edit Product Screen has Products Description: just under the Manufacturers drop down, instead of the Products Name: that a default categories.php shows in that location, and the Description field is duplicated under the section of screen where you define the Price Breaks

 

 

 

 

 

Hi All,

 

I had SPPC installed and required the Price Break features, so manually upgraded with Price Breaks SPPC_Price_Break_v1_02, and my site is still working except for :-

 

In my products_listing the Description is not showing up.

In my products_info the Description is not showing.

 

This is just for the single item I have set Price Breaks for, the other products are showing the Description in both places.....

 

Any hints on which bits I may have got wrong ?

 

I suspect the both the catalog/includes/modules/product_listing.php and catalog/product_info.php ,,, but I could be wrong :)

 

The database table products_description has the field Description set to the text I would normally see.....

 

I have SEO Urls, Register Globals, CSS Menus, Header Tags, SPPC +PB contribs installed.

 

TIA

Link to comment
Share on other sites

Further, my problem acutally stems from the Edit product bit of the catalog/admin/categories.php

 

When I added the first items price breaks I did not notice the Name field had been replaced by the Description field, and the update to set the price breaks had actually over written the Name field with null..... so there was nothing to show in the product_listing or product_info pages for the Name field.

 

So it seems as though the bit of admin/categories.php that should present the Name field need to be looked at, as it is confused with the Description field ...

Link to comment
Share on other sites

Once more I add useless messages.....

 

Found my error I think....

I seems when I updated to the Header Tags contribution, my admin/categories.php had the Name field erased.

 

By adding the lines that display the Name field table row back to the categories.php, my edit products no longer erased the products_name.

 

So in short my problem had nothing to do with SPPC + PB but a previous contrib, that I had not fully tested......

Link to comment
Share on other sites

Dear Community,

 

thanks very much for this great contribution which now I was able to include in my already hardcoded scripts.

 

At this time I am just missing one thing:

 

Is there a possibility to notify automatically the customer upon assigning it to a certain customer group in the admin section ?

 

Thanks again.

 

 

Robin

Link to comment
Share on other sites

I'm having a weird problem since trying to get hide products and categories from customer groups for SPPC up and running. If I am logged in as a Retail customer, I can go through the checkout process just fine.

 

If, however; I am logged in as a Wholesale customer - I can't get past the Shopping Cart page. It doesn't matter which "Checkout" link I use - all it does is re-load the shopping_cart.php page :huh:

 

Any thoughts?

 

Thank you,

 

I finally got the Hide Products for SPPC working with Master Products so that the slave products are actually hidden correctly - YAY!! :D :D

 

But I still have this problem with my shopping cart and I have no idea what is causing the problem. I am not finding anything in the code that stands out as something that would cause only Retail Customers to be able to checkout - but not allow Wholesale Customers to checkout. Nothing in my cart is hidden from wholesale customers - yet when I click on Checkout I just get the shopping cart page reloaded :blink:

 

Here's my shopping_cart.php file:

<?php
/*
 $Id: shopping_cart.php,v 1.35 2003/06/25 21:14:33 hpdl Exp $
 adapted for Separate Pricing Per Customer v4.1, Hide products and categories for groups 2006/06/22

 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() {
 // BOF Separate Pricing Per Customer 
  global $customer_id, $sppc_customer_group_id;

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

  if(!tep_session_is_registered('sppc_customer_group_id')) { 
	$this->cg_id = '0';
	  } else {
	$this->cg_id = $sppc_customer_group_id;
 }
// EOF Separate Pricing Per Customer

// 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) . "', '" . $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 = '" . $qty . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	  }
	}
  }

// 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 . "'");
  // BOF SPPC hide products and categories from groups
		$no_of_products_in_basket = 0;
  while ($_products = tep_db_fetch_array($products_query)) {
	$temp_post_get_array[] = $_products['products_id'];
			$products[] = $_products;
			$no_of_products_in_basket += 1;
		}
 if ($no_of_products_in_basket > 0) {
			$hide_status_products = array();
			$hide_status_products = tep_get_hide_status($hide_status_products, $this->cg_id, $temp_post_get_array);
			for ($i=0; $i < $no_of_products_in_basket; $i++) {
				foreach($hide_status_products as $key => $subarray) {
					if ($subarray['products_id'] == tep_get_prid($products[$i]['products_id']) && $subarray['hidden'] == '0') {
				// not hidden for this customer, can be added to the object shoppingCart
	$this->contents[$products[$i]['products_id']] = array('qty' => $products[$i]['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[$i]['products_id']) . "'");
					  while ($attributes = tep_db_fetch_array($attributes_query)) {
					  $this->contents[$products[$i]['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
					  }
					} elseif ($subarray['products_id'] == tep_get_prid($products[$i]['products_id']) && $subarray['hidden'] == '1') {
// product is hidden for the customer, don't add to object shoppingCart, delete from db next
							 $products_to_delete_from_cb[] = $products[$i]['products_id'];
					} // end if/elseif
				}// end foreach ($hide_status_products as $key => $subarray)
  } // end for ($i=0; $i < $no_of_products_in_basket; $i++)

 // delete from the database those products that are hidden from this customer
  if (tep_not_null($products_to_delete_from_cb)) {
	  $no_of_iterations = count($products_to_delete_from_cb);
// since the products_id in the table customer_basket and customer_basket_attributes can contain
// attributes like 1{4}2{3}6 we need to delete them one by one for the two tables
	  for ($y = 0; $y < $no_of_iterations; $y++) {
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and (products_id = '" . (int)$products_to_delete_from_cb[$y] . "' or products_id REGEXP '^" .  (int)$products_to_delete_from_cb[$y] . "{');");
		tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and (products_id = '" . (int)$products_to_delete_from_cb[$y] . "' or products_id REGEXP '^" .  (int)$products_to_delete_from_cb[$y] . "{');");
	  } // end for ($y = 0; $y < $no_of_iterations; $y++)
  } // end if (tep_not_null($products_to_delete_from_cb))
} // end if ($no_of_products_in_basket > 0)
// EOF SPPC hide products and categories from groups

  $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 (is_numeric($products_id) && is_numeric($qty)) {
	$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' => $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 (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity)) {
	$this->contents[$products_id_string] = array('qty' => $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() {
  $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'];
// BOF Separate Pricing Per Customer
// global variable (session) $sppc_customer_group_id -> class variable cg_id
 global $sppc_customer_group_id;

 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $this->cg_id = '0';
 } else {
  $this->cg_id = $sppc_customer_group_id;
 }
// EOF Separate Pricing Per Customer

// 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)) {
	  $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'];

// BOF Separate Pricing Per Customer
/*		  $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'];
	  } */
  $specials_price = tep_get_products_special_price((int)$prid);
  if (tep_not_null($specials_price)) {
 $products_price = $specials_price;
  } elseif ($this->cg_id != 0){
	$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$prid . "' and customers_group_id =  '" . $this->cg_id . "'");
	if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
	$products_price = $customer_group_price['customers_group_price'];
	}
  }
// EOF Separate Pricing Per Customer

	  $this->total += tep_add_tax($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 += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		} else {
		  $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
		}
	  }
	}
  }
}

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;
// BOF Separate Pricing Per Customer
// global variable (session) $sppc_customer_group_id -> class variable cg_id
 global $sppc_customer_group_id;

 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $this->cg_id = '0';
 } else {
  $this->cg_id = $sppc_customer_group_id;
 }
// EOF Separate Pricing Per Customer


  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'];

// BOF Separate Pricing Per Customer
/*		  $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'];
	  } */
  $specials_price = tep_get_products_special_price($prid);
 if (tep_not_null($specials_price)) {
 $products_price = $specials_price;
  } elseif ($this->cg_id != 0){
	$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$prid . "' and customers_group_id =  '" . $this->cg_id . "'");
	if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
	$products_price = $customer_group_price['customers_group_price'];
	}
 }
// EOF Separate Pricing Per Customer

	  $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;
}

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;
			}
		  }
		}
	  } 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'];
  }
}

 }
?>

 

Does anyone here see what is causing this problem?

~Tracy
 

Link to comment
Share on other sites

I still have this problem with my shopping cart and I have no idea what is causing the problem. I am not finding anything in the code that stands out as something that would cause only Retail Customers to be able to checkout - but not allow Wholesale Customers to checkout. Nothing in my cart is hidden from wholesale customers - yet when I click on Checkout I just get the shopping cart page reloaded
The shopping_cart.php file you posted seems identical to the SPPC Hide products from customers one (using a file comparison program). Actually, I think sending you back to the shopping cart page is caused by checkout_shipping.php (starts around line 22):

// 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));
 }

It might appear to the code that the cart is empty... (you could add printing out the $cart object if it is determined that the cart is empty...)

Link to comment
Share on other sites

The shopping_cart.php file you posted seems identical to the SPPC Hide products from customers one (using a file comparison program). Actually, I think sending you back to the shopping cart page is caused by checkout_shipping.php (starts around line 22):

// 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));
 }

It might appear to the code that the cart is empty... (you could add printing out the $cart object if it is determined that the cart is empty...)

 

Thank you JanZ - but I'm not sure what to do here. I've added this bit of code

<?php
echo '<!--DEBUG';
echo '<pre>Cart Contents: ';
print_r($cart);
echo '</pre>';
echo'-->';
?>

 

to the checkout_shipping.php file - but that did me no good since clicking checkout doesn't take me anywhere - so I then added it to the bottom of the shopping_cart.php file and I get this in my source code if I'm logged in as a Retailer (which is allowed to checkout):

<!--DEBUG<pre>Cart Contents: </pre>-->

 

When I tried to log in as a Wholesaler I got this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/.lew/mmherbs/mountainmeadowherbs.com/includes/classes/shopping_cart.php:479) in /home/.lew/mmherbs/mountainmeadowherbs.com/includes/functions/general.php on line 38

 

Well - line 479 is

<?php

the first line of the above print_r code :blink:

 

I found I can't login at all with the print_r bit of code in the shopping_cart.php file, and I just don't understand why :(

 

Any thoughts?

~Tracy
 

Link to comment
Share on other sites

to the checkout_shipping.php file - but that did me no good since clicking checkout doesn't take me anywhere - so I then added it to the bottom of the shopping_cart.php file and I get this in my source code if I'm logged in as a Retailer (which is allowed to checkout):

<!--DEBUG<pre>Cart Contents: </pre>-->

 

When I tried to log in as a Wholesaler I got this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/.lew/mmherbs/mountainmeadowherbs.com/includes/classes/shopping_cart.php:479) in /home/.lew/mmherbs/mountainmeadowherbs.com/includes/functions/general.php on line 38

 

Well - line 479 is

<?php

the first line of the above print_r code :blink:

 

I found I can't login at all with the print_r bit of code in the shopping_cart.php file, and I just don't understand why :(

 

Any thoughts?

You shouldn't add it to the class shopping_cart since that is loaded before the page starts being outputted and therefore you get the "headers already sent" error.

 

It doesn't work when you change your checkout_shipping.php? :

// if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
echo '<!--DEBUG';
echo '<pre>Cart Contents: ';
print_r($cart);
echo '</pre>';
echo'-->';
exit;
//	tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }

Link to comment
Share on other sites

After installing this contib I am getteing the following error on my product page:

 

1146 - Table 'everythingjewish_net_-_a-one.specials_retail_prices' doesn't exist

 

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials_retail_prices s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '5'

 

[TEP STOP]

 

please help me

Thank you

Yehuda

 

 

Like it says: One who is embarrassed will never learn!

Link to comment
Share on other sites

This is another error I am getting

 

1054 - Unknown column 'attributes_hide_from_groups' in 'where clause'

 

select count(*) as total from products_options popt, products_attributes patrib where patrib.products_id='33' and patrib.options_id = popt.products_options_id and popt.language_id = '1' and find_in_set('1', attributes_hide_from_groups) = 0

 

[TEP STOP]

 

Thank you for your help

Yehuda

 

 

Like it says: One who is embarrassed will never learn!

Link to comment
Share on other sites

This is another error I am getting

 

1054 - Unknown column 'attributes_hide_from_groups' in 'where clause'

Are you just installing the add-ons for the attributes (last two packages added) or have you installed 4.1.5 of July 9. It looks like the former. Then again there was an sql command or file to add that column 'attributes_hide_from_groups' so you skipped that for sure. Doesn't work skipping things.
Link to comment
Share on other sites

Is there a possibility to notify automatically the customer upon assigning it to a certain customer group in the admin section ?
That has been discussed in this thread before (I think around August 2005...). Basically, you needed to add a hidden field that saved the customer group as it came from the database (old_customer_group_id) and then in the code that evaluates the post variables you have to compare the old_customer_group_id with the customer_group_id that is in the post variables now. If it goes from 0 to another value you trigger an automatic email for which you have to write the text and add it to the language file for that page. Can't find those posts anymore though. :(
Link to comment
Share on other sites

Are you just installing the add-ons for the attributes (last two packages added) or have you installed 4.1.5 of July 9. It looks like the former. Then again there was an sql command or file to add that column 'attributes_hide_from_groups' so you skipped that for sure. Doesn't work skipping things.

 

 

I have added the entire sql file and I am still getting the message; 1054 - Unknown column 'attributes_hide_from_groups' in 'where clause'

 

the file I added was appc_v41_install.sql

 

Please let me know if this is the right one.

 

Thank you JanZ

Edited by yehudas

Yehuda

 

 

Like it says: One who is embarrassed will never learn!

Link to comment
Share on other sites

I need help.. I think? - I installed te Seperate Priceing per Customer v4.15 as a new install, the installation was on a new install osc. everything seems fine but I dont see where I can define a price per group, The groups are there but nothing on the Products Page or the Products Group page to define a price.???

 

I am new to OSC and love it. I know this is something stupid..

 

Thanks in Advance.

Link to comment
Share on other sites

I need help.. I think? - I installed te Seperate Priceing per Customer v4.15 as a new install, the installation was on a new install osc. everything seems fine but I dont see where I can define a price per group, The groups are there but nothing on the Products Page or the Products Group page to define a price.???

 

I am new to OSC and love it. I know this is something stupid..

 

Thanks in Advance.

 

From your admin, go to your catalog, choose a product and edit it - or choose to add a new product. The resulting page should show you a new box that wasn't there before that allows you to set the price for your new price group ;)

~Tracy
 

Link to comment
Share on other sites

Thank you JanZ - but I'm not sure what to do here. I've added this bit of code

<?php
echo '<!--DEBUG';
echo '<pre>Cart Contents: ';
print_r($cart);
echo '</pre>';
echo'-->';
?>

 

to the checkout_shipping.php file - but that did me no good since clicking checkout doesn't take me anywhere - so I then added it to the bottom of the shopping_cart.php file and I get this in my source code if I'm logged in as a Retailer (which is allowed to checkout):

<!--DEBUG<pre>Cart Contents: </pre>-->

 

When I tried to log in as a Wholesaler I got this error:

Warning: Cannot modify header information - headers already sent by (output started at /home/.lew/mmherbs/mountainmeadowherbs.com/includes/classes/shopping_cart.php:479) in /home/.lew/mmherbs/mountainmeadowherbs.com/includes/functions/general.php on line 38

 

Well - line 479 is

<?php

the first line of the above print_r code :blink:

 

I found I can't login at all with the print_r bit of code in the shopping_cart.php file, and I just don't understand why :(

 

Any thoughts?

 

Still trying to figure this one out. I have also been searching for the "Cannot modify header information" error to see if anything out there fits my situation. I have learned that, if I am already logged in (wholesale or retail, doesn't matter) I can then upload the shopping_cart.php file with the debug printout and at least view the shopping cart contents. But the debug code always prints the same thing in the source code:

<!--DEBUG<pre>Cart Contents: </pre>-->

whether I'm logged in as a retail or wholesale customer. So I'm not sure if it is not seeing the cart contents or if I'm using the wrong variable (I think that's the word for $cart).

 

Now- if I leave the modified shopping_cart.php file up there (with the debug code on it) and try to login, whether I'm trying to login as retail or wholesale, I get the Cannot modify header information error. So I have to remove that bit of code in order to log in and try to test.

 

I am totally baffled at this one :blink:

 

Anyone here have any thoughts?

~Tracy
 

Link to comment
Share on other sites

You shouldn't add it to the class shopping_cart since that is loaded before the page starts being outputted and therefore you get the "headers already sent" error.

 

It doesn't work when you change your checkout_shipping.php? :

// if there is nothing in the customers cart, redirect them to the shopping cart page
 if ($cart->count_contents() < 1) {
echo '<!--DEBUG';
echo '<pre>Cart Contents: ';
print_r($cart);
echo '</pre>';
echo'-->';
exit;
//	tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
 }

 

Well - at least now I know why I got the header error - LOL

 

I edited my checkout_shipping.php file exactly as you have above - and I get no debug information :( Just to make sure there aren't two files with the same name and I'm using the wrong one - the checkout_shipping.php file that I am editing is in my root (or what would normally be called the catalog folder). That's the same one you're talking about too, right? I signed in as a wholesale customer, went to my cart contents, and then clicked on checkout from my shopping cart page. I wasn't allowed to leave the shopping cart page, it just reloaded it, but it did not put any hint of the above code whatsoever into the source of the newly reloaded shopping cart page :huh:

 

It can sure get interesting combining multiple contrib's into one store :blush:

~Tracy
 

Link to comment
Share on other sites

It can sure get interesting combining multiple contrib's into one store :blush:

 

Just a quick PS to let you know I've also posted on the STS and MasterProducts boards to make sure that there aren't any other files from those two contrib's that I need to edit and haven't - just in case something that simple is causing my problem :blush:

 

I'm also reviewing the install instructions (again - LOL) to make sure the files I have modified appear to be modified correctly - including in the sections that are modified for Master Products especially as those mod's tend to include their own queries as well ;)

 

But if you can think of anything else - or what pages specifically are involved in the problem I'm having with wholesale group not being able to checkout - that would be greatly appreciated :)

~Tracy
 

Link to comment
Share on other sites

I'm also reviewing the install instructions (again - LOL) to make sure the files I have modified appear to be modified correctly - including in the sections that are modified for Master Products especially as those mod's tend to include their own queries as well ;)

 

While reviewing I've found a bit of Master Product code in my catalog/shopping_cart.php file that I'm wondering if it might be causing the problem. Here is the code:

// Master Products	 
$master_prod = tep_db_query("select products_master, products_master_status from " . TABLE_PRODUCTS . " where products_id = '" . $products[$i]['id'] . "'");
$master_prod_values = tep_db_fetch_array($master_prod);

if (($master_prod_values['products_master_status'] == 0) && ($master_prod_values['products_master'] != 0)) {
  $prod_link_id = $master_prod_values['products_master'];
} else { $prod_link_id = $products[$i]['id']; }
 $products_name = '<table border="0" cellspacing="2" cellpadding="2">' .
				  '  <tr>' .
				  '	<td class="productListing-data" align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $prod_link_id) . '">' . tep_image(DIR_WS_IMAGES . $products[$i]['image'], $products[$i]['name'], SMALL_IMAGE_WIDTH,SMALL_IMAGE_HEIGHT) . '</a></td>' .
				  '	<td class="productListing-data" valign="top"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '"><b>' . $products[$i]['name'] . '</b></a>';
//Master Products EOF

I think this bit of code determines where the product link in the shopping cart goes to so I don't know if it would cause the problem I'm having or not - but figured it best to check :blush:

 

I do have the check for the customer group ID at the very top of the file:

 require("includes/application_top.php");

 // BOF Separate Price per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
} else {
$customer_group_id = $sppc_customer_group_id;
}
// EOF Separate Price per Customer

~Tracy
 

Link to comment
Share on other sites

While reviewing I've found a bit of Master Product code in my catalog/includes/application_top.php file that I'm wondering if it might be causing the problem.

 

Here is what we have - in between the // customer adds a product from the products page section of code and the // performed by the 'buy now' button in product listings and review page section there is:

//Master Products
 // customer adds multiple products from the master_listing page
  case 'add_slave' :
						  reset($HTTP_POST_VARS);
						  while ( list( $key, $val ) = each( $HTTP_POST_VARS ) ) {
							if (substr($key,0,11) == "Qty_ProdId_") {
							  $prodId = substr($key,11);
							  $qty = $val;
							  if(isset($HTTP_POST_VARS["id_$prodId"]) && is_array($HTTP_POST_VARS["id_$prodId"])) {
								// We have attributes
								$cart->add_cart($prodId, $cart->get_quantity(tep_get_uprid($prodId,$HTTP_POST_VARS["id_$prodId"]))+$qty, $HTTP_POST_VARS["id_$prodId"]);
							  } else {
								// No attributes
								$cart->add_cart($prodId, $cart->get_quantity($prodId)+$qty);
							  }
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
 //Master Products EOF

 

I don't think this would affect the ability to checkout - but just in case :blush:

~Tracy
 

Link to comment
Share on other sites

While reviewing I've found a bit of Master Product code in my catalog/shopping_cart.php file that I'm wondering if it might be causing the problem.
Doesn't look like something like that would cause those problems. I wonder if the free-amount module for shipping has any relevance to it. Perhaps you could try with that switched off?
Link to comment
Share on other sites

Doesn't look like something like that would cause those problems. I wonder if the free-amount module for shipping has any relevance to it. Perhaps you could try with that switched off?

 

Well - the module only affects Retail (which can checkout) - the Table Rate is just set to 0 for orders over a certain amount for Wholesale. I did turn off the free shipping contrib though to test - and it did not make a difference :(

 

So I've been continuing my journey through file comparison - LOL Here's the latest I've found:

 

in the includes/column_right.php file there is a bit of code from Master Products that isn't in the updated version for Hide Products for SPPC

 

  if ( $cart->count_contents() > 0 ) {
include(DIR_WS_BOXES . 'suggested_accessories.php');
 }

 

What would be the proper way to adjust that bit of code for Hide Products?

 

 

In includes/functions/general.php

 

The // Redirect to another page or site section, just under the function there is a bit of code that doesn't show me who modified it. It only exists in the file for Hide Products and Categories

if ( (strstr($url, "\n") != false) || (strstr($url, "\r") != false) ) {
   tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));
}

 

Between //Return a products name and //Return products special price - Master Products adds this bit of code - does it need any tweaking?:

//// 
//Master Products
// Return a product's description 
// TABLES: products_description 
 function tep_get_products_description($product_id, $language = '') {
global $languages_id; 

if (!tep_not_null($language)) $language = $languages_id;

$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$product_id . "' and language_id = '" . (int)$language . "'"); 
$product_description = tep_db_fetch_array($product_query); 

	return $product_description['products_description'];
}
//Master Products EOF

 

At the end of the original file, Master Products adds this:

//
//Master Products
// grabs a length from a string, but goes back to the last space if it cut into
// the middle of a string.  If the string is longer than that, cut, then add '...'
// to the end of the string, if the $more == 1
function osc_trunc_string($str="",$len=150,$more=1)
{
	if ($str=="") return $str;
	if (is_array($str)) return $str;
	$str = trim($str);
	// if it's less than the size given, then return it
	if (strlen($str) <= $len) return $str;
	// else get that size of text
	$str = substr($str,0,$len);
	// backtrack to the end of a word
	if ($str != "") {
		// check to see if there are any spaces left
		if (!substr_count($str," ")) {
			if ($more) $str .= "...";
			return $str;
		}
		// backtrack
		while(strlen($str) && ($str[strlen($str)-1] != " ")) {
			$str = substr($str,0,-1);
		}
		$str = substr($str,0,-1);
		if ($more) $str .= "...";
	}
	return $str;
}  
//Master Products EOF

 

The only other difference that I'm not sure where the difference came from is in the Return a product ID with attributes section. The code for that from Hide Products is definitely much longer than from Master Products. I don't think this would cause the problem though.

 

 

In catalog/product_info.php there is a query by Master Products just after the // EOF Separate Pricing Per Customer (under $product_check = tep_db_fetch_array)

 

//added by admin  showing the master for slave products
 $master_query1 = tep_db_query("select products_id,products_master from " . TABLE_PRODUCTS . " where products_id =  '" . (int)$HTTP_GET_VARS['products_id'] . " '");
$results1 = tep_db_fetch_array($master_query1);
if (($results1['products_master'] != null) &&($results1['products_master'] != 0) ) {
		$HTTP_GET_VARS['products_id']=(int)$results1['products_master'];
}
//end of code added by admin  showing the master for slave products

 

After product options and before product reviews info there is this bit of code from master Products

//Master Products	
if (tep_not_null($product_info['products_url'])) {
?>
  <tr>
	<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}	
?>
  </tr>
   <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>	 
<?php
if ($product_info['products_price']>0) {

$qty_array = array();

for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {

$qty_array[] = array('id' => $i, 'text' => $i); 
}
?>
  <tr>
	<td align="right" class="main"><?php if ($product_info['products_quantity'] > 0) {
  echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array); 
  } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) {
	  $qty_array = array();
		for ($i=0; $ns = 20, $i <= $ns; $i++) {
		$qty_array[] = array('id' => $i, 'text' => $i); 
	}	 
  echo TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
  } else {
  echo TEXT_STOCK;
}
echo tep_draw_separator('pixel_trans.gif', '30', '10');
?>
	</td>
  </tr>
<?php
}
?>  
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td>
  </tr>

 

And then after the separator for Date Added or Date Available area there is another query:

<?php

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
$results = tep_db_fetch_array($master_query);
if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) { ?>

  <tr>
<td align="left" class="main"> <?php echo TEXT_SLAVE_PRODUCTS; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr> 
  <tr>
<td><?php  include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS); ?></td>
  </tr>

<?php	
 } 
}
?>

 

Anything there look to you like it could cause a problem?

~Tracy
 

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...