dblake Posted February 25, 2005 Share Posted February 25, 2005 You sure you uploading that file correctly? That looks fine to me. Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) I don't know how to upload incorrectly. Heres my site. Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
dblake Posted February 25, 2005 Share Posted February 25, 2005 paste the whole file. or save it as a text file and put it up on your server Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) Here comes shopping_cart.php: <?php /* ?$Id: shopping_cart.php,v 1.35 2003/06/25 21:14:33 hpdl Exp $ ?osCommerce, Open Source E-Commerce Solutions ?[url=http://www.oscommerce.com]http://www.oscommerce.com[/url] ?Copyright ? 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() { ? ? ?global $customer_id; ? ? ?if (!tep_session_is_registered('customer_id')) return false; // insert current cart contents in database ? ? ?if (is_array($this->contents)) { ? ? ? ?reset($this->contents); ? ? ? ?while (list($products_id, ) = each($this->contents)) { ? ? ? ? ?$qty = $this->contents[$products_id]['qty']; ? ?// 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 ? ? ? ? ?$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'])) { ? ? ? ? ? ? ? ?//clr 031714 udate query to include attribute value. This is needed for text attributes. ? ? ? ? ? ? ? ?$attr_value = $this->contents[$products_id]['attributes_values'][$option]; ? ? ? ? ? ? ? ?tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id, products_options_value_text) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "', '" . tep_db_input($attr_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 . "'"); ? ? ?while ($products = tep_db_fetch_array($products_query)) { ? ? ? ?$this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']); // attributes ? ? ? ?//CLR 020606 update query to pull attribute value_text. This is needed for text attributes. ? ? ? ?$attributes_query = tep_db_query("select products_options_id, products_options_value_id, products_options_value_text from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'"); ? ? ? ?while ($attributes = tep_db_fetch_array($attributes_query)) { ? ? ? ? ?$this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id']; ? ? ? ? ?//CLR 020606 if text attribute, then set additional information ? ? ? ? ?if ($attributes['products_options_value_id'] == PRODUCTS_OPTIONS_VALUE_TEXT_ID) { ? ? ? ? ? ?$this->contents[$products['products_id']]['attributes_values'][$attributes['products_options_id']] = $attributes['products_options_value_text']; ? ? ? ? ?} ? ? ? ?} ? ? ?} ? ? ?$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 = tep_get_uprid($products_id, $attributes); ? ? ?if ($notify == true) { ? ? ? ?$new_products_id_in_cart = $products_id; ? ? ? ?tep_session_register('new_products_id_in_cart'); ? ? ?} ? ? ?if ($this->in_cart($products_id)) { ? ? ? ?$this->update_quantity($products_id, $qty, $attributes); ? ? ?} else { ? ? ? ?$this->contents[] = array($products_id); ? ? ? ?$this->contents[$products_id] = 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) . "', '" . $qty . "', '" . date('Ymd') . "')"); ? ? ? ?if (is_array($attributes)) { ? ? ? ? ?reset($attributes); ? ? ? ? ?while (list($option, $value) = each($attributes)) { ? ? ? ? ? ?//CLR 020606 check if input was from text box. ?If so, store additional attribute information ? ? ? ? ? ?//CLR 020708 check if text input is blank, if so do not add to attribute lists ? ? ? ? ? ?//CLR 030228 add htmlspecialchars processing. ?This handles quotes and other special chars in the user input. ? ? ? ? ? ?$attr_value = NULL; ? ? ? ? ? ?$blank_value = FALSE; ? ? ? ? ? ?if (strstr($option, TEXT_PREFIX)) { ? ? ? ? ? ? ?if (trim($value) == NULL) ? ? ? ? ? ? ?{ ? ? ? ? ? ? ? ?$blank_value = TRUE; ? ? ? ? ? ? ?} else { ? ? ? ? ? ? ? ?$option = substr($option, strlen(TEXT_PREFIX)); ? ? ? ? ? ? ? ?$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); ? ? ? ? ? ? ? ?$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID; ? ? ? ? ? ? ? ?$this->contents[$products_id]['attributes_values'][$option] = $attr_value; ? ? ? ? ? ? ?} ? ? ? ? ? ?} ? ? ? ? ? ?if (!$blank_value) ? ? ? ? ? ?{ ? ? ? ? ? ? ?$this->contents[$products_id]['attributes'][$option] = $value; // insert into database ? ? ? ? ? ?//CLR 020606 update db insert to include attribute value_text. This is needed for text attributes. ? ? ? ? ? ?//CLR 030228 add tep_db_input() processing ? ? ? ? ? ? ?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, products_options_value_text) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "', '" . tep_db_input($attr_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; ? ? ?if (empty($quantity)) return true; // nothing needs to be updated if theres no quantity, so we return true.. ? ? ?$this->contents[$products_id] = array('qty' => $quantity); // update database ? ? ?if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'"); ? ? ?if (is_array($attributes)) { ? ? ? ?reset($attributes); ? ? ? ?while (list($option, $value) = each($attributes)) { ? ? ? ? ?//CLR 020606 check if input was from text box. ?If so, store additional attribute information ? ? ? ? ?//CLR 030108 check if text input is blank, if so do not update attribute lists ? ? ? ? ?//CLR 030228 add htmlspecialchars processing. ?This handles quotes and other special chars in the user input. ? ? ? ? ?$attr_value = NULL; ? ? ? ? ?$blank_value = FALSE; ? ? ? ? ?if (strstr($option, TEXT_PREFIX)) { ? ? ? ? ? ?if (trim($value) == NULL) ? ? ? ? ? ?{ ? ? ? ? ? ? ?$blank_value = TRUE; ? ? ? ? ? ?} else { ? ? ? ? ? ? ?$option = substr($option, strlen(TEXT_PREFIX)); ? ? ? ? ? ? ?$attr_value = htmlspecialchars(stripslashes($value), ENT_QUOTES); ? ? ? ? ? ? ?$value = PRODUCTS_OPTIONS_VALUE_TEXT_ID; ? ? ? ? ? ? ?$this->contents[$products_id]['attributes_values'][$option] = $attr_value; ? ? ? ? ? ?} ? ? ? ? ?} ? ? ? ? ?if (!$blank_value) ? ? ? ? ?{ ? ? ? ? ? ?$this->contents[$products_id]['attributes'][$option] = $value; // update database ? ? ? ? ? ?//CLR 020606 update db insert to include attribute value_text. This is needed for text attributes. ? ? ? ? ? ?//CLR 030228 add tep_db_input() processing ? ? ? ? ? ?if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "', products_options_value_text = '" . tep_db_input($attr_value) . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "' 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; ? ? ?//CLR 030228 add call tep_get_uprid to correctly format product ids containing quotes ? ? ?$products_id = tep_get_uprid($products_id, $attributes); ? ? ?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']; // 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 ? // ? ? ? ? ?} ? ? ? ? ?//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes. ? ? ? ? ?$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'] : ''), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '')); ? ? ? ?} ? ? ?} ? ? ?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']; ? ? ?} ? ?} ?} ?> Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
dblake Posted February 25, 2005 Share Posted February 25, 2005 Its in your function calculate() Look for this line // EOF Separate Pricing Per Customer } and comment out that } so looks like this // EOF Separate Pricing Per Customer // } -Dennis Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) That got it. Whew. Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
dblake Posted February 25, 2005 Share Posted February 25, 2005 (edited) * edit * ///// Edited February 25, 2005 by dblake Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) This is blowing my mind. If its not one thing, its another. Check this out. ----------------- does that mean I need to run sppc_v40_install.sql again? Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
dblake Posted February 25, 2005 Share Posted February 25, 2005 You didn't run your sql queries to add in the new table, and if you did you forgot to include it in your database names. Slow down and follow all directions ;) Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) QuerieS I ran sppc_v40_install.sql from phpmyadmin. What else do the instructions say to run? does that mean I need to run sppc_v40_install.sql again? Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) I just restored my db and re-ran sppc_v40_install.sql from phpmyadmin, and still get the same problem. I don't see any other queries mentioned in the instructions. I gotsta be missing something. Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) and if you did you forgot to include it in your database names I'm not sure how to include something in the database names. This is all I did during installation: *Installation* ? This contribution has been written for osCommerce Milestone 2.2 It is unlikely that it will work with other versions of osCommerce. If you have a new installation of Milestone 2.2 then the easiest way to install this contribution is to upload the included files and run the spcc_v40_install.sql file on your MySql machine - that's all there is to it. ......so now I understand that that was not all there was to it. What is left to be done? -- naming databases somehow? Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
dblake Posted February 25, 2005 Share Posted February 25, 2005 you overwrote all the files? Quote Link to comment Share on other sites More sharing options...
dblake Posted February 25, 2005 Share Posted February 25, 2005 I guess you got it sorted ;) Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 Whew, yea, it works now. Thanks for your help, and though I think JanZ is gone, thank you too! Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 dblake -- p.m. me your paypal email addy and I'll send you a few bucks for your trouble. YOU TOO JANZ! Quote Link to comment Share on other sites More sharing options...
leebadham Posted February 25, 2005 Share Posted February 25, 2005 Does this work with Register Globals turned off? Thanks Lee Badham Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 25, 2005 Share Posted February 25, 2005 Does this work with Register Globals turned off? Not really, but osCommerce doesn't either so the point is moot. I think it would be easy to do, because the code uses three session variables. Instead of referring to them as global variables (like $sppc_customers_group_id) you could use $_SESSION['sppc_customers_group_id'] and you should be fine. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2005 Share Posted February 25, 2005 OK, I did a manual install of this contribution a few days ago. Haven't had time to start looking into this issue until now. I created a Wholesale customer. I then created a product and gave it both a Retail and a Wholesale price. (Retail = $44.00 Wholesale = $22.00) Then, I created a Special for RETAIL customers only ($39.60). Now, when I log in as a Wholesale customer and I click on that product category... I go to index.php... which pulls in data from /includes/modules/product_listing.php in order to build the small table of products in this category. However, for the price data next to this item, I see... The Wholesale price with a line through it, as if it is being discounted! And the new price, in red ink, is $39.60! I'm attempting to debug it now. But I thought I'd ask somebody else to try to replicate it... since nobody may have tried creating a special for Retail and not Wholesale yet, what with this new release being only a few days old and all. Thanks! -= Dave =- Quote Link to comment Share on other sites More sharing options...
Marvin Miller Posted February 25, 2005 Share Posted February 25, 2005 (edited) Hi David; I just tried replicating your issue on my production site and the beta site and I could not get an incorrect price display. On the Beta site it's an upload of all the pre-made SPP40 files (the easy install) and the production site was a manual install. Both are displaying the proper price. I'm not saying bugs are impossible but we tested this thing pretty thoroughly. Is it possible you missed something? Keep in mind - you have to log out and log back in before you will see proper changes reflected in the storefront - I know this has been an issue with some reported problems. Edited February 25, 2005 by Marvin Miller Quote Best & Thanks;Marvin----------------------osCommerce 2.3.3.4 Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2005 Share Posted February 25, 2005 Hi David; I just tried replicating your issue on my production site and the beta site and I could not get an incorrect price display. On the Beta site it's an upload of all the pre-made SPP40 files (the easy install) and the production site was a manual install. Both are displaying the proper price. I'm not saying bugs are impossible but we tested this thing pretty thoroughly. Is it possible you missed something? Keep in mind - you have to log out and log back in before you will see proper changes reflected in the storefront - I know this has been an issue with some problems. <{POST_SNAPBACK}> Well, I don't know whether the problem's a typo somewhere or what.... but here's what I've managed to learn in-between doing things here at my day job. The product_listing.php page receives this as its "listing_sql": listing_sql = select p.products_image, pd.products_name, p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials_retail_prices s on p.products_id = s.products_id 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 = '2' order by pd.products_name I confirmed that it sees me as being a part of customer_group = 1. I uncommented some debug lines you already had in that file that produce an array based on what that SQL pulls in: Array ( [0] => Array ( [products_image] => [products_name] => HP Laser Toner [products_id] => 28 [manufacturers_id] => 0 [products_price] => 44.0000 [products_tax_class_id] => 0 [specials_new_products_price] => 39.6000 [final_price] => 39.6000 ) ) So, here it is "seeing" a Special from that specials_new_products_price table. Yes, that special is there. The customer_group id associated with that special, however, is 0. So, I would expect at some point, later in the code, it would check to see if that special is actually for this customer_group. I do see a query for the specials... and here's what it's doing: select products_id, specials_new_products_price from specials where (products_id = '28' ) and status = '1' and customers_group_id = '1' Of course, there is no such special. So, you'd think that at this point, we'd revise that [specials_new_product_price] to make it null. But that doesn't happen and what gets printed out for $listing[$x]['specials_new_products_price'] is basically what it gets from that above array. I'll go do a line-by-line comparison with your "fresh install" version and see if I spot any unusual differences. Thanks! -= Dave =- Quote Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2005 Share Posted February 25, 2005 Well, my /includes/modules/product_listing.php is identical to your fresh-install version. Hmmm... so maybe that listing_sql isn't the right select? I doubt it, because that specials_new_product_price table in there indicates its a select that's coming from this contribution. But I guess I'll backtrack and check out the index.php file next. -= Dave =- Quote Link to comment Share on other sites More sharing options...
dblake Posted February 25, 2005 Share Posted February 25, 2005 check your general functions file Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 25, 2005 Share Posted February 25, 2005 Dave, So, I would expect at some point, later in the code, it would check to see if that special is actually for this customer_group.And that is exactly what it does in these lines (after retail prices have been replaced by the customer group price with very similar code: // an extra query is needed for all the specials $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "'"); while ($specials_array = tep_db_fetch_array($specials_query)) { $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']); } // add the correct specials_new_products_price and replace final_price for ($x = 0; $x < $no_of_listings; $x++) { if(!empty($new_s_prices)) { for ($i = 0; $i < count($new_s_prices); $i++) { if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) { $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price']; $listing[$x]['final_price'] = $new_s_prices[$i]['final_price']; } } } // end if(!empty($new_s_prices) } // end for ($x = 0; $x < $no_of_listings; $x++) I don't know what goes wrong, but I can't replicate the problem either. Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) Has anyone had a problem with a customer in a certain group being shown retail prices, as opposed to that group's prices? Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.