Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

RE: Upgrade V4.0 to V4.11

In instructions

admin/customers.php

 

Line 318

**AFTER**

$cInfo = new objectInfo($customers);

 

**ADD**

// BOF Separate Pricing Per Customer

// $shipment_allowed = explode (";",$cInfo->customers_shipment_allowed);

// EOF Separate Pricing Per Customer

 

Why would I add a line that was commented out?

Under what circumstances would I uncomment it?

Edited by netstep

Sam M. - Seattle

Link to comment
Share on other sites

Why would I add a line that was commented out?

Under what circumstances would I uncomment it?

It is a remnant of a piece of code that I put closer to the code where it is actually used, after establishing that it worked, I never took it out.

 

So there is indeed no need to put it in.

Link to comment
Share on other sites

My problem is that for my wholesale customer group (I'm only using two groups at the moment - wholesale and retail), they can't progress in the checkout past the first page - "Delivery Information".  when the "continue" button is pressed, the page simply refreshes itself.  for the customer group "retail" there is no such problem and they progress to the next page in the checkout process.

 

sounds like I am missing some lines of code but I'm not sure where to look.

 

Hi, it's not the code, it's your shipping option in the admin setting for this group, check that, enable a shipping option and it's gonna be ok.

 

Jeep

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

check that, enable a shipping option and it's gonna be ok.
If that helps, it would be a bug actually. It was not meant to be like that: if there are no settings for a customer group, the default should kick in.

 

I assume you would see that problem right away actually, because there wouldn't be any shipping options to choose from...

Link to comment
Share on other sites

If that helps, it would be a bug actually. It was not meant to be like that: if there are no settings for a customer group, the default should kick in.

 

No it's not a bug, I'm sure he remove a shipping option and that's it. I do this thing before like two month ago and have this problem and find what cause it.

 

By the way, JanZ, very good job :thumbsup: about the update of this contribution. You complete the contribution like a pro.

 

Jeep

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Yiannis,

I assume you meant that you also want to show the special price is there is one for the retail customers. That takes a lot more code.

 

Dear JanZ, I am in the process of upgrading my computer. After I finish and I have installed all the software I use for testing OSCommerce, I will imlpement the modifications and let you know the results.

 

Again a big thanks for your effort and help. :thumbsup:

 

Cheers

Yiannis

Link to comment
Share on other sites

Hello,

 

first of all, thank you for this great contribution.

 

I?ve installed SPPC 4.11 and everything seems to except one problem in the checkout.

 

I?m using the Shoppe Enhanchement Controller (SEC) by Linda McGrath.

 

checkout_confirmation.gif

 

As you can see in the image above, it will be shown the right seperate price for the product (13.25), but by the sub-total the normal price will displayed (19.60)

 

table_orders.gif

 

In the second image you see the product from an order in the table orders_products. For this product in products_price will be insert the seperate price (13.25) and in final_price the normal price will be insert (19.60).

 

I?ve tried many things in the classes/order.php, but nothing solved the problem.

 

 

May be can an expert take a look over my order.php.

 

<?php
/*
?$Id: order.php,v 1.33 2003/06/09 22:25:35 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

?Shoppe Enhancement Controller - Copyright ? 2003 WebMakers.com
?Linda McGrath - [email protected]
*/

?class order {
// BOF: WebMakers.com Added: Shoppe Enhancement Controller
? ?var $info, $totals, $products, $customer, $delivery, $content_type, $extra_onetime_charges;
// EOF: WebMakers.com Added: Shoppe Enhancement Controller

? ?function order($order_id = '') {
? ? ?$this->info = array();
? ? ?$this->totals = array();
? ? ?$this->products = array();
? ? ?$this->customer = array();
? ? ?$this->delivery = array();

? ? ?if (tep_not_null($order_id)) {
? ? ? ?$this->query($order_id);
? ? ?} else {
? ? ? ?$this->cart();
? ? ?}
? ?}

? ?function query($order_id) {
? ? ?global $languages_id;

? ? ?$order_id = tep_db_prepare_input($order_id);

? ? ?$order_query = tep_db_query("select customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_tva_intracom, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified from " . TABLE_ORDERS . " where orders_id = '" . (int)$order_id . "'");
? ? ?$order = tep_db_fetch_array($order_query);

? ? ?$totals_query = tep_db_query("select title, text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' order by sort_order");
? ? ?while ($totals = tep_db_fetch_array($totals_query)) {
? ? ? ?$this->totals[] = array('title' => $totals['title'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'text' => $totals['text']);
? ? ?}

? ? ?$order_total_query = tep_db_query("select text from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_total'");
? ? ?$order_total = tep_db_fetch_array($order_total_query);

? ? ?$shipping_method_query = tep_db_query("select title from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "' and class = 'ot_shipping'");
? ? ?$shipping_method = tep_db_fetch_array($shipping_method_query);

? ? ?$order_status_query = tep_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . $order['orders_status'] . "' and language_id = '" . (int)$languages_id . "'");
? ? ?$order_status = tep_db_fetch_array($order_status_query);

? ? ?$this->info = array('currency' => $order['currency'],
? ? ? ? ? ? ? ? ? ? ? ? ?'currency_value' => $order['currency_value'],
? ? ? ? ? ? ? ? ? ? ? ? ?'payment_method' => $order['payment_method'],
? ? ? ? ? ? ? ? ? ? ? ? ?'cc_type' => $order['cc_type'],
? ? ? ? ? ? ? ? ? ? ? ? ?'cc_owner' => $order['cc_owner'],
? ? ? ? ? ? ? ? ? ? ? ? ?'cc_number' => $order['cc_number'],
? ? ? ? ? ? ? ? ? ? ? ? ?'cc_expires' => $order['cc_expires'],
? ? ? ? ? ? ? ? ? ? ? ? ?'date_purchased' => $order['date_purchased'],
? ? ? ? ? ? ? ? ? ? ? ? ?'orders_status' => $order_status['orders_status_name'],
? ? ? ? ? ? ? ? ? ? ? ? ?'last_modified' => $order['last_modified'],
? ? ? ? ? ? ? ? ? ? ? ? ?'total' => strip_tags($order_total['text']),
? ? ? ? ? ? ? ? ? ? ? ? ?'shipping_method' => ((substr($shipping_method['title'], -1) == ':') ? substr(strip_tags($shipping_method['title']), 0, -1) : strip_tags($shipping_method['title'])));

? ? ?$this->customer = array('id' => $order['customers_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $order['customers_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'company' => $order['customers_company'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'street_address' => $order['customers_street_address'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'suburb' => $order['customers_suburb'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'city' => $order['customers_city'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'postcode' => $order['customers_postcode'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'state' => $order['customers_state'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'country' => $order['customers_country'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'format_id' => $order['customers_address_format_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'telephone' => $order['customers_telephone'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'email_address' => $order['customers_email_address']);

? ? ?$this->delivery = array('name' => $order['delivery_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'company' => $order['delivery_company'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'street_address' => $order['delivery_street_address'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'suburb' => $order['delivery_suburb'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'city' => $order['delivery_city'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'postcode' => $order['delivery_postcode'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'state' => $order['delivery_state'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'country' => $order['delivery_country'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'format_id' => $order['delivery_address_format_id']);

? ? ?if (empty($this->delivery['name']) && empty($this->delivery['street_address'])) {
? ? ? ?$this->delivery = false;
? ? ?}

? ? ?$this->billing = array('name' => $order['billing_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'company' => $order['billing_company'],
? ? ? ?'tva_intracom' => $order['billing_tva_intracom'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'street_address' => $order['billing_street_address'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'suburb' => $order['billing_suburb'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'city' => $order['billing_city'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'postcode' => $order['billing_postcode'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'state' => $order['billing_state'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'country' => $order['billing_country'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'format_id' => $order['billing_address_format_id']);

// BOF: WebMakers.com Added: Shoppe Enhancement Controller
? ? ?$index = 0;
? ? ?$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price, product_is_free, products_price_excluded from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . tep_db_input($order_id) . "'");
// MS2 ? ? ?$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
? ? ?while ($orders_products = tep_db_fetch_array($orders_products_query)) {
? ? ? ?$this->products[$index] = array('qty' => $orders_products['products_quantity'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'id' => $orders_products['products_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $orders_products['products_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'model' => $orders_products['products_model'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax' => $orders_products['products_tax'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'price' => $orders_products['products_price'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'final_price' => $orders_products['final_price'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'product_is_free' => $orders_products['product_is_free'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_price_excluded' => $orders_products['products_price_excluded']
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?);
// BOF Separate Pricing Per Customer
?if(!tep_session_is_registered('sppc_customer_group_id')) { 
?$customer_group_id = '0';
?} else {
? $customer_group_id = $sppc_customer_group_id;
?}

? if ($customer_group_id != '0'){	
? $orders_customers_price = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '". $customer_group_id . "' and products_id = '" . $products[$i]['id'] . "'"); ? ? ?	
? if ($orders_customers = tep_db_fetch_array($orders_customers_price)){	
? ? ?$this->products[$index] = array('price' => $orders_customers['customers_group_price'], 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'final_price' => $orders_customers['customers_group_price']);
?} ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
}
// EOF Separate Pricing Per Customer

? ? ? ?$subindex = 0;
? ? ? ?$new_fields=', attributes_price_onetime, attributes_price_onetime_ext, product_attribute_is_free, products_attributes_weight, products_attributes_weight_prefix, attributes_price_onetime_ext, attributes_qty_prices_onetime, attributes_qty_prices_onetime_ext, attributes_discounted, attributes_price_factor, attributes_price_factor_offset';
? ? ? ?$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix" . $new_fields . " from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . tep_db_input($order_id) . "' and orders_products_id = '" . $orders_products['orders_products_id'] . "'");
// MS2 ? ? ? ?$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "' and orders_products_id = '" . (int)$orders_products['orders_products_id'] . "'");
? ? ? ?if (tep_db_num_rows($attributes_query)) {
? ? ? ? ?while ($attributes = tep_db_fetch_array($attributes_query)) {
? ? ? ? ? ?$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'value' => $attributes['products_options_values'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'prefix' => $attributes['price_prefix'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'price' => $attributes['options_values_price'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'product_attribute_is_free' => $attributes['product_attribute_is_free'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'products_attributes_weight_prefix' => $attributes['products_attributes_weight_prefix'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'products_attributes_weight' => $attributes['products_attributes_weight'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_onetime' => $attributes['attributes_price_onetime'],
// fix here - IS THIS NEEDED?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_onetime_ext' => $attributes['attributes_price_onetime_ext'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_qty_prices_onetime' => $attributes['attributes_qty_prices_onetime'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_qty_prices_onetime_ext' => $attributes['attributes_qty_prices_onetime_ext'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_discounted' => $attributes['attributes_discounted'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_factor' => $attributes['attributes_price_factor'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_factor_offset' => $attributes['attributes_price_factor_offset'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_factor_ext' => $attributes['attributes_price_factor_ext']
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? );
? ? ? ? ? ?$subindex++;
? ? ? ? ?}
? ? ? ?}
// EOF: WebMakers.com Added: Shoppe Enhancement Controller

? ? ? ?$this->info['tax_groups']["{$this->products[$index]['tax']}"] = '1';

? ? ? ?$index++;
? ? ?}
? ?}

? ?function cart() {
? ? ?global $customer_id, $sendto, $billto, $cart, $languages_id, $currency, $currencies, $shipping, $payment;

? ? ?$this->content_type = $cart->get_content_type();

? ? ?$customer_address_query = tep_db_query("select c.customers_firstname, c.customers_lastname, c.customers_telephone, c.customers_email_address, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, co.countries_id, co.countries_name, co.countries_iso_code_2, co.countries_iso_code_3, co.address_format_id, ab.entry_state from " . TABLE_CUSTOMERS . " c, " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " co on (ab.entry_country_id = co.countries_id) where c.customers_id = '" . (int)$customer_id . "' and ab.customers_id = '" . (int)$customer_id . "' and c.customers_default_address_id = ab.address_book_id");
? ? ?$customer_address = tep_db_fetch_array($customer_address_query);

? ? ?$shipping_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$sendto . "'");
? ? ?$shipping_address = tep_db_fetch_array($shipping_address_query);

? ? ?$billing_address_query = tep_db_query("select ab.entry_firstname, ab.entry_lastname, ab.entry_company, ab.entry_tva_intracom, ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_zone_id, z.zone_name, ab.entry_country_id, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id, ab.entry_state from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) left join " . TABLE_COUNTRIES . " c on (ab.entry_country_id = c.countries_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)$billto . "'");
? ? ?$billing_address = tep_db_fetch_array($billing_address_query);

? ? ?$tax_address_query = tep_db_query("select ab.entry_country_id, ab.entry_zone_id from " . TABLE_ADDRESS_BOOK . " ab left join " . TABLE_ZONES . " z on (ab.entry_zone_id = z.zone_id) where ab.customers_id = '" . (int)$customer_id . "' and ab.address_book_id = '" . (int)($this->content_type == 'virtual' ? $billto : $sendto) . "'");
? ? ?$tax_address = tep_db_fetch_array($tax_address_query);

? ? ?$this->info = array('order_status' => DEFAULT_ORDERS_STATUS_ID,
? ? ? ? ? ? ? ? ? ? ? ? ?'currency' => $currency,
? ? ? ? ? ? ? ? ? ? ? ? ?'currency_value' => $currencies->currencies[$currency]['value'],
? ? ? ? ? ? ? ? ? ? ? ? ?'payment_method' => $payment,
? ? ? ? ? ? ? ? ? ? ? ? ?'cc_type' => (isset($GLOBALS['cc_type']) ? $GLOBALS['cc_type'] : ''),
? ? ? ? ? ? ? ? ? ? ? ? ?'cc_owner' => (isset($GLOBALS['cc_owner']) ? $GLOBALS['cc_owner'] : ''),
? ? ? ? ? ? ? ? ? ? ? ? ?'cc_number' => (isset($GLOBALS['cc_number']) ? $GLOBALS['cc_number'] : ''),
? ? ? ? ? ? ? ? ? ? ? ? ?'cc_expires' => (isset($GLOBALS['cc_expires']) ? $GLOBALS['cc_expires'] : ''),
? ? ? ? ? ? ? ? ? ? ? ? ?'shipping_method' => $shipping['title'],
? ? ? ? ? ? ? ? ? ? ? ? ?'shipping_cost' => $shipping['cost'],
? ? ? ? ? ? ? ? ? ? ? ? ?'subtotal' => 0,
? ? ? ? ? ? ? ? ? ? ? ? ?'dsd_gebuehr' => 0,
? ? ? ? ? ? ? ? ? ? ? ? ?'sperr' => 0,
? ? ? ? ? ? ? ? ? ? ? ? ?'tax' => 0,
? ? ? ? ? ? ? ? ? ? ? ? ?'tax_groups' => array(),
? ? ? ? ? ? ? ? ? ? ? ? ?'comments' => (isset($GLOBALS['comments']) ? $GLOBALS['comments'] : ''));

? ? ?if (isset($GLOBALS[$payment]) && is_object($GLOBALS[$payment])) {
? ? ? ?$this->info['payment_method'] = $GLOBALS[$payment]->title;

? ? ? ?if ( isset($GLOBALS[$payment]->order_status) && is_numeric($GLOBALS[$payment]->order_status) && ($GLOBALS[$payment]->order_status > 0) ) {
? ? ? ? ?$this->info['order_status'] = $GLOBALS[$payment]->order_status;
? ? ? ?}
? ? ?}

? ? ?$this->customer = array('firstname' => $customer_address['customers_firstname'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'lastname' => $customer_address['customers_lastname'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'company' => $customer_address['entry_company'],
? ? ? ? 'tva_intracom' => $customer_address['entry_tva_intracom'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'street_address' => $customer_address['entry_street_address'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'suburb' => $customer_address['entry_suburb'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'city' => $customer_address['entry_city'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'postcode' => $customer_address['entry_postcode'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'state' => ((tep_not_null($customer_address['entry_state'])) ? $customer_address['entry_state'] : $customer_address['zone_name']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'zone_id' => $customer_address['entry_zone_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'country' => array('id' => $customer_address['countries_id'], 'title' => $customer_address['countries_name'], 'iso_code_2' => $customer_address['countries_iso_code_2'], 'iso_code_3' => $customer_address['countries_iso_code_3']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'format_id' => $customer_address['address_format_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'telephone' => $customer_address['customers_telephone'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'email_address' => $customer_address['customers_email_address']);

? ? ?$this->delivery = array('firstname' => $shipping_address['entry_firstname'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'lastname' => $shipping_address['entry_lastname'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'company' => $shipping_address['entry_company'],
? ? ? ? 'tva_intracom' => $shipping_address['entry_tva_intracom'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'street_address' => $shipping_address['entry_street_address'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'suburb' => $shipping_address['entry_suburb'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'city' => $shipping_address['entry_city'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'postcode' => $shipping_address['entry_postcode'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'state' => ((tep_not_null($shipping_address['entry_state'])) ? $shipping_address['entry_state'] : $shipping_address['zone_name']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'zone_id' => $shipping_address['entry_zone_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'country' => array('id' => $shipping_address['countries_id'], 'title' => $shipping_address['countries_name'], 'iso_code_2' => $shipping_address['countries_iso_code_2'], 'iso_code_3' => $shipping_address['countries_iso_code_3']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'country_id' => $shipping_address['entry_country_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'format_id' => $shipping_address['address_format_id']);

? ? ?$this->billing = array('firstname' => $billing_address['entry_firstname'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'lastname' => $billing_address['entry_lastname'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'company' => $billing_address['entry_company'],
? ? ? ?'tva_intracom' => $billing_address['entry_tva_intracom'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'street_address' => $billing_address['entry_street_address'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'suburb' => $billing_address['entry_suburb'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'city' => $billing_address['entry_city'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'postcode' => $billing_address['entry_postcode'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'state' => ((tep_not_null($billing_address['entry_state'])) ? $billing_address['entry_state'] : $billing_address['zone_name']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'zone_id' => $billing_address['entry_zone_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'country' => array('id' => $billing_address['countries_id'], 'title' => $billing_address['countries_name'], 'iso_code_2' => $billing_address['countries_iso_code_2'], 'iso_code_3' => $billing_address['countries_iso_code_3']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'country_id' => $billing_address['entry_country_id'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? 'format_id' => $billing_address['address_format_id']);

// BOF: WebMakers.com Added: Shoppe Enhancement Controller
? ? ?$index = 0;
? ? ?$products = $cart->get_products();
? ? ?for ($i=0, $n=sizeof($products); $i<$n; $i++) {
// WebMakers.com Added: exclude products price
? ? ? ? ? ?if ($products[$i]['products_price_excluded']=='1') {
? ? ? ? ? ? ?$products_price_final = 0;
? ? ? ? ? ?} else {
? ? ? ? ? ? ?if ($products[$i]['products_price_excluded']=='1') {
? ? ? ? ? ? ? ?$products_price_final = 0;
? ? ? ? ? ? ?} else {
? ? ? ? ? ? ? ?$products_price_final = tep_get_products_price_quantity_discount_price($products[$i]['id'], $cart->in_cart_mixed($products[$i]['id']));
? ? ? ? ? ? ?}
? ? ? ? ? ?}

? ? ? ?if ($products[$i]['model'] == 'BONUS') {
? ? ?$bonus_preis = $products[$i]['price'];
?} else {
? ? ?$bonus_preis = (tep_get_products_price_is_free($products[$i]['id']) ? 0 : $products_price_final ) + $cart->attributes_price($products[$i]['id'],1);
?}

? ? ? ?$this->products[$index] = array('qty' => $products[$i]['quantity'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $products[$i]['name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'model' => $products[$i]['model'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'price' => $products[$i]['price'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_dsd_gebuehr' => $products[$i]['products_dsd_gebuehr'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_sperr' => $products[$i]['products_sperr'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_extra1' => $products[$i]['products_extra1'],

// Is products price excluded in final calc.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_price_excluded' => tep_get_products_price_excluded($products[$i]['id']),

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'product_is_free' => tep_get_products_price_is_free($products[$i]['id']),
// Apply Discounts and Check for Free
? ? ? ? ?'final_price' => $bonus_preis,
// One time charge to add in to final price
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'attributes_price_onetime_ext' => $cart->attributes_price($products[$i]['id'],0),
// Attributes QTY:prices onetime charge
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'attributes_qty_prices_onetime_ext' => $cart->attributes_price($products[$i]['id'],2),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'weight' => $products[$i]['weight'] + $cart->attributes_weight($products[$i]['id']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'id' => $products[$i]['id']
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?);

// BOF Separate Pricing Per Customer
?if(!tep_session_is_registered('sppc_customer_group_id')) { 
?$customer_group_id = '0';
?} else {
? $customer_group_id = $sppc_customer_group_id;
?}
?if ($customer_group_id != '0'){
?$orders_customers_price = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '". $customer_group_id . "' and products_id = '" . $products[$i]['id'] . "'");
?$orders_customers = tep_db_fetch_array($orders_customers_price);
? ?if ($orders_customers = tep_db_fetch_array($orders_customers_price)) {	
? ?$this->products[$index] = array('price' => $orders_customers['customers_group_price'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'final_price' => $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id']));
? ?}
?}
// EOF Separate Pricing Per Customer

? ? ? ?$this->info['dsd_gebuehr'] += $products[$i]['products_dsd_gebuehr'] * $products[$i]['quantity'];
? ? ? ?$this->info['sperr'] += $products[$i]['products_sperr'];
? ? ? ?if ($products[$i]['attributes']) {
? ? ? ? ?$subindex = 0;
? ? ? ? ?reset($products[$i]['attributes']);
? ? ? ? ?while (list($option, $value) = each($products[$i]['attributes'])) {
// WebMakers.com Added: Attributes Sorter and Copier and Quantity Controller
? ? ? ? ? ?$new_fields=', attributes_price_onetime, product_attribute_is_free, products_attributes_weight, products_attributes_weight_prefix, attributes_qty_prices_onetime, attributes_discounted, attributes_price_factor, attributes_price_factor_offset';

? ? ? ? ? ?$attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix" . $new_fields . " from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $products[$i]['id'] . "' and pa.options_id = '" . $option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $languages_id . "' and poval.language_id = '" . $languages_id . "'");
// MS2 ? ? ? ? ? ?$attributes_query = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . (int)$products[$i]['id'] . "' and pa.options_id = '" . (int)$option . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . (int)$value . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . (int)$languages_id . "' and poval.language_id = '" . (int)$languages_id . "'");
? ? ? ? ? ?$attributes = tep_db_fetch_array($attributes_query);

// BOF: WebMakers.com Added: Attributes Option Type with Text
// dogu 2003-02-28 BEGIN determine if attribute is a text attribute and change products array appropriate
? ? ? ? ? ?if ($value == PRODUCTS_OPTIONS_VALUE_TEXT_ID){
? ? ? ? ? ? ?$attr_value = $products[$i]['attributes_values'][$option];
? ? ? ? ? ?} else {
? ? ? ? ? ? ?$attr_value = $attributes['products_options_values_name'];
? ? ? ? ? ?}
? ? ? ? ? ?$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options_name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'value' => $attr_value,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'option_id' => $option,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'value_id' => $value,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'prefix' => $attributes['price_prefix'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'price' => $attributes['options_values_price'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_onetime' => $attributes['attributes_price_onetime'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'product_attribute_is_free' => $attributes['product_attribute_is_free'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'products_attributes_weight_prefix' => $attributes['products_attributes_weight_prefix'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'products_attributes_weight' => $attributes['products_attributes_weight'],
// fix here - is this needed?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_onetime_ext' => $attributes['attributes_price_onetime_ext'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_qty_prices_onetime' => $attributes['attributes_qty_prices_onetime'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_qty_prices_onetime_ext' => $attributes['attributes_qty_prices_onetime_ext'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_discounted' => $attributes['attributes_discounted'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_factor' => $attributes['attributes_price_factor'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_factor_offset' => $attributes['attributes_price_factor_offset'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'attributes_price_factor_ext' => $attributes['attributes_price_factor_ext'],

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? );
// dogu 2003-02-28 END determine if attribute is a text attribute and change products array appropriate
// EOF: WebMakers.com Added: Attributes Option Type with Text
? ? ? ? ? ?$subindex++;
? ? ? ? ?}
? ? ? ?}
// EOF: WebMakers.com Added: Shoppe Enhancement Controller

// BOF: WebMakers.com Added: Shoppe Enhancement Controller
// Attributes one time fees
// Attributes QTY:prices onetime charge

? ? ? ?$extra_onetime_charges= tep_add_tax($customer_id, $this->products[$index]['attributes_price_onetime_ext'],$this->products[$index]['tax'],1)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?+ tep_add_tax($customer_id, $this->products[$index]['attributes_qty_prices_onetime_ext'],$this->products[$index]['tax'],1)
? ? ? ? ? ? ? ? ? ? ? ? ? ?;
? ? ? ?
?$shown_price = (tep_add_tax($customer_id, $this->products[$index]['final_price'], $this->products[$index]['tax']) * $this->products[$index]['qty']) + $extra_onetime_charges;
? ? ? ?$this->info['subtotal'] += $shown_price;
? ? ? ?
// EOF: WebMakers.com Added: Shoppe Enhancement Controller

? ? ? ?$products_tax = $this->products[$index]['tax'];
? ? ? ?$products_tax_description = $this->products[$index]['tax_description'];
? ? ? ?if (DISPLAY_PRICE_WITH_TAX == 'true') {
? ? ? ? ?$this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
? ? ? ? ?if (isset($this->info['tax_groups']["$products_tax_description"])) {
? ? ? ? ? ?$this->info['tax_groups']["$products_tax_description"] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
? ? ? ? ?} else {
? ? ? ? ? ?$this->info['tax_groups']["$products_tax_description"] = $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));
? ? ? ? ?}
? ? ? ?} else {
? ? ? ? ?$this->info['tax'] += ($products_tax / 100) * $shown_price;
? ? ? ? ?if (isset($this->info['tax_groups']["$products_tax_description"])) {
? ? ? ? ? ?$this->info['tax_groups']["$products_tax_description"] += ($products_tax / 100) * $shown_price;
? ? ? ? ?} else {
? ? ? ? ? ?$this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price;
? ? ? ? ?}
? ? ? ?}

? ? ? ?$index++;
? ? ?}

? ? ?if (DISPLAY_PRICE_WITH_TAX == 'true') {
? ? ? ?$this->info['total'] = $this->info['subtotal'] + $this->info['shipping_cost'];
? ? ?} else {
? ? ? ?$this->info['total'] = $this->info['subtotal'] + $this->info['tax'] + $this->info['shipping_cost'];
? ? ?}
? ?}
?}
?>

 

Thank you very much!

 

Regards

 

Daniel

Edited by dabri
Link to comment
Share on other sites

Yiannis,

 

You left in part of the old code, with an extra brace so the one on line 413 was seen as 'extra' whereas it is the "genuine" one.

 

See part of the code below for what you need to cut out:

} // end else , $customer_group_id !='0'  
// EOF Separate Pricing Per Customer, specials code 
// <-- START DELETING FROM HERE around line 131 -->
// BOF Separate Price per Customer
       $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
       if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
       $product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
// EOF Separate Price per Customer
   $products_price = '';
if ($customer_group_id != '0') {
$products_price = '<span class="smallText">List Price: ';   
$products_price .= $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
$products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices 
}   
  $products_price .= $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }
// <-- TILL HERE: END OF DELETING CODE -->
   if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';

Link to comment
Share on other sites

This message is for Marvin the great :-"

 

Congratulation for the documentation, you do a good job. But just one thing, in the 4.1.1 upgrade, you miss something if I don't mislead. You speak about the change from the 4.1 to the 4.1.1 in the txt file, it's the categorie.php in the admin section. The change is correct in the new installation folder but the change is not make in the folder upgrade_from_40_to_version_41 , so I just want to specify that to you, it can be induce people in error.

 

 

Continue your good work. :thumbsup:

 

Jeep

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

This message is for Marvin the great  :-"

 

Congratulation for the documentation, you do a good job. But just one thing, in the 4.1.1 upgrade, you miss something if I don't mislead.

 

Hi Jeep;

 

I didn't write the docs for the 4.1.1 upgrade B) I did the docs for 4.0 & 4.1 but not 4.1.1

 

But I do thank you for the kind comments! :thumbsup:

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

Hi Jeep;

 

I didn't write the docs for the 4.1.1 upgrade  B)  I did the docs for 4.0 & 4.1 but not 4.1.1

 

Hi Marvin,

 

Oups, Sorry about that. Who did it ? We have to tell him :D .

 

Jeep

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

He already knows :D

 

It's a large contrib and documenting it is not as easy as it sounds because it has grown so much over time. Also, taking into account update paths makes it a little more complex so things can happen but I have to say that the contrib is the most well written one I've ever seen and speaking for myself, I think the docs are really, really good.

 

I've worked with a bunch of contribs and found some serious bugs and documentation errors that make them largely unusable. I know that Jan spent an enormous amount of time and effort in re-making this contrib as well as troubleshooting it and revisting it as required. This level of commitment really shows :thumbsup: The 3.x series of Separate Price were completely unusable (I tired them extensively) and the new 4.x series are so much better and troublefree it's amazing!

 

I suspect that the issue will be dealt with just as all the others have been over the last while. Even though I didn't code SPP (JanZ did) I am sure am proud of what he and I were able to accomplish with it. It's cool and powerful! :thumbsup:

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

I have to say that the contrib is the most well written one I've ever seen and speaking for myself, I think the docs are really, really good.

 

You're right about this.

 

I've worked with a bunch of contribs and found some serious bugs and documentation errors that make them largely unusable.

 

Me too.

 

The 3.x series of Separate Price were completely unusable (I tired them extensively) and the new 4.x series are so much better and troublefree it's amazing!

 

Really amazing comparing of 3.5, it's a miracle someone (JanZ) can finish the job, thank's god. I thinked it was never to happen. One time again, good job JanZ. :thumbsup:

 

Jeep

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Daniel,

I?ve installed SPPC 4.11 and everything seems to except one problem in the checkout.

 

As you can see in the image above, it will be shown the right seperate price for the product (13.25), but by the sub-total the normal price will displayed (19.60)

 

In trying to figure out why this was happening I stumbled across some interesting observations.

 

I never tried to understand the code in the class order.php but it turns out all the SPPC code is doing totally nothing.

 

A. If the $sppc_customer_group_id isn't called global (global $sppc_customerg_group_id;) the $customer_group_id is not set.

B. That is a wonderful thing since if it would work it would completely wipe out almost the entire product array.

C. Actually it can't even work since the product_id in the sql is empty: it shouldn't be $products[$i]['id'] but $this->$products[$index]['id'].

D. If that would be corrected the whole product array would be reset to only contain price and total price, all the other things like name, id, model, quantity etcetera would be gone.

 

The correct way for replacing prices in the array would have been to use:

      $this->products[$index]['price'] = $orders_customers['customers_group_price'];
     $this->products[$index]['final_price'] = $orders_customers['customers_group_price'];

instead of what you see below:

// BOF Separate Pricing Per Customer
?if(!tep_session_is_registered('sppc_customer_group_id')) { 
?$customer_group_id = '0';
?} else {
? $customer_group_id = $sppc_customer_group_id;
?}
?if ($customer_group_id != '0'){
?$orders_customers_price = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '". $customer_group_id . "' and products_id = '" . $products[$i]['id'] . "'");
?$orders_customers = tep_db_fetch_array($orders_customers_price);
? ?if ($orders_customers = tep_db_fetch_array($orders_customers_price)) {	
? ?$this->products[$index] = array('price' => $orders_customers['customers_group_price'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'final_price' => $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id']));
? ?}
?}
// EOF Separate Pricing Per Customer

I can only assume that (I guess the shopping cart class) other code is putting in the correct price in orders_products and that the code is actually not needed.

 

Now in your case the other contribution probably puts the wrong price in orders_products first and obviously that is not corrected (I think with a specials price the wrong price would be used anyway).

 

In your code I saw a few places where final price is worked on:

$products_price_final = tep_get_products_price_quantity_discount_price($products[$i]['id'], $cart->in_cart_mixed($products[$i]['id']));


$bonus_preis = (tep_get_products_price_is_free($products[$i]['id']) ? 0 : $products_price_final ) + $cart->attributes_price($products[$i]['id'],1);


// Apply Discounts and Check for Free
? ? ? ? ?'final_price' => $bonus_preis,

So here the other contribution has free range to do what it likes. SPPC is not getting in the way ;)

 

Might be difficult to get these two working alongside without getting in each other way...

Link to comment
Share on other sites

Yiannis,

 

You left in part of the old code, with an extra brace so the one on line 413 was seen as 'extra' whereas it is the "genuine" one.

 

 

Dear JanZ,

I deleted the code you suggested.

 

Now when a customer is not logged in or when a customer is logged as 'Retail', when there is a special price for a product, the special price shown with red letters in the product_info.php page is zero. When the 'Retail' customer sees a product which does not have a special price he also sees the 'List Price' reference written in small letters , above the retail price.

 

When the customer is logged as 'Wholesale' and there is a special price for a product for the 'Wholesale' group the customer sees what he/she should see e.g the 'Wholesale' price dashed out and the special 'Wholesale' price in red letters. Unfortunately the 'List Price' reference is gone. The 'List Price' reference is also gone

from all the products when logged as 'Wholesale' customer.

 

This is how my product_info.php page looks now

 

<?php
/*
 $Id: product_info.php,v 1.98 2003/09/02 18:52:33 project3000 Exp $
 adapted for Separate Pricing Per Customer v4.0 2005/01/26
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
 $product_check = tep_db_fetch_array($product_check_query);
// 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
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<?php include ('includes/ssl_protected.js.php'); ?> 
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<?php
 if ($product_check['total'] < 1) {
?>
     <tr>
       <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
<?php
 } else {
// BOF MaxiDVD: Modified For Ultimate Images Pack!
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_med, p.products_image_lrg, p.products_image_sm_1, p.products_image_xl_1, p.products_image_sm_2, p.products_image_xl_2, p.products_image_sm_3, p.products_image_xl_3, p.products_image_sm_4, p.products_image_xl_4, p.products_image_sm_5, p.products_image_xl_5, p.products_image_sm_6, p.products_image_xl_6, pd.products_url, p.products_price, p.products_price as list_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_bundle, p.products_availability_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
// EOF MaxiDVD: Modified For Ultimate Images Pack!
   $product_info = tep_db_fetch_array($product_info_query);

   tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

 // replace the next query for the specials price for a customer group for one that collects all of them
// for this product_id
//    if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

  $all_special_prices = tep_get_p_specials_prices($product_info['products_id']);

 for ($x = 0; $x < count($all_special_prices); $x++) {
  if ($all_special_prices[$x]['customers_group_id'] == $customer_group_id ) {
   $cg_specials_price = $all_special_prices[$x]['specials_new_products_price'];
  }
  if ($all_special_prices[$x]['customers_group_id'] == '0' ) {
   $specials_retail_price = $all_special_prices[$x]['specials_new_products_price'];
  }
 } // end for ($x = 0; $x < count($all_special_prices); $x++;)
     // BOF Separate Price per Customer

       $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id =  '" . $customer_group_id . "'");
       if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
       $product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
// EOF Separate Price per Customer

$products_price = '';
if ($customer_group_id != '0') {
      if (tep_not_null($cg_specials_price)) {
$products_price .= '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($cg_specials_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
      } else {
$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
      }
 } else { // end if ($customer_group_id == '0')
$products_price = '<span class="smallText">List Price: ';
    if (tep_not_null($specials_retail_price)) {
     $products_price .= '<s>' . $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($specials_retail_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span></span><br />';
    } else {
$products_price .= $currencies->display_price($product_info['list_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
$products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices 
}   
if (tep_not_null($cg_specials_price)) {
  $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
$products_price .= $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
  }
} // end else , $customer_group_id !='0'  
// EOF Separate Pricing Per Customer, specials code 
   if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }
   $products_availability = $product_info['products_availability_id'];

   $products_availability_info_query = tep_db_query("select e.products_availability_name from " . TABLE_PRODUCTS_AVAILABILITY . " e where e.products_availability_id = '" . (int)$products_availability . "' and e.language_id = '" . (int)$languages_id . "'");

   $products_availability_info = tep_db_fetch_array($products_availability_info_query);
   $products_availability_name = $products_availability_info['products_availability_name'];
?>
     <tr>
       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
         <tr>
           <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
           <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
         </tr>
<?php
  if (tep_not_null($products_availability_info['products_availability_name'])) {
?>
         <tr>
           <td class="main" align="right" valign="top"></td>
           <td class="main" align="right" valign="top"><b><?php echo TEXT_AVAILABILITY; ?></b>: <?php echo $products_availability_name; ?></td>
         </tr>
<?php
  }
?>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td class="main">


<?php
   if (tep_not_null($product_info['products_image'])) {
?>
         <table border="0" cellspacing="0" cellpadding="2" align="right">
           <tr>
             <td align="center" class="smallText">

<!-- // BOF MaxiDVD: Modified For Ultimate Images Pack! //-->
<?php
if ($product_info['products_image_med']!='') {
         $new_image = $product_info['products_image_med'];
         $image_width = MEDIUM_IMAGE_WIDTH;
         $image_height = MEDIUM_IMAGE_HEIGHT;
        } else {
         $new_image = $product_info['products_image'];
         $image_width = SMALL_IMAGE_WIDTH;
         $image_height = SMALL_IMAGE_HEIGHT;}?>
<script language="javascript"><!--
     document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'] . 'ℑ=0') . '\\\')">' . tep_image(DIR_WS_IMAGES . $new_image, addslashes($product_info['products_name']), $image_width, $image_height, 'hspace="5" vspace="5"') . '<br>' . tep_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'; ?>');
//--></script>
<noscript>
     <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image_med']) . '">' . tep_image(DIR_WS_IMAGES . $new_image . 'ℑ=0', addslashes($product_info['products_name']), $image_width, $image_height, 'hspace="5" vspace="5"') . '<br>' . tep_image_button('image_enlarge.gif', TEXT_CLICK_TO_ENLARGE) . '</a>'; ?>
</noscript>
<!-- // EOF MaxiDVD: Modified For Ultimate Images Pack! //-->

             </td>
           </tr>
         </table>
<?php
   }
?>


         <p><?php echo stripslashes($product_info['products_description']); ?></p>
<!-- start bundle -->
   <?php     
   if ($product_info['products_bundle'] == "yes") {
  	 $products_bundle = $product_info['products_bundle'];
  	 echo TEXT_BUNDLE_CONTENTS . "<br><table>";
	 $bundle_query = tep_db_query("	SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price
        	 FROM products p 
        	 INNER JOIN products_description pd
            ON p.products_id=pd.products_id
        	 INNER JOIN products_bundles pb
            ON pb.subproduct_id=pd.products_id 
        	 WHERE pb.bundle_id = " . tep_get_prid($products_id) . " and language_id = '" . (int)$languages_id . "'");
	 while ($bundle_data = tep_db_fetch_array($bundle_query)) {
   if ($bundle_data['products_bundle'] == "yes") {
  	 // uncomment the following line to display subproduct qty 
                             //echo "<br>» <b>" . $bundle_data['subproduct_qty'] . " x " . $bundle_data['products_name'] . "</b>";
  	 //echo "<br>» <b> " . $bundle_data['products_name'] . "</b>";
           echo '<tr><td valign="top" class="main">» <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data['products_id']) . '"><b><u>' . $bundle_data['products_name'] . '</u></b></a></td></tr>';


  	 $bundle_query_nested = tep_db_query("	SELECT pd.products_name, pb.*, p.products_bundle, p.products_id, p.products_price
        	 FROM products p 
        	 INNER JOIN products_description pd
            ON p.products_id=pd.products_id
        	 INNER JOIN products_bundles pb
            ON pb.subproduct_id=pd.products_id 
        	 WHERE pb.bundle_id = " . $bundle_data['products_id'] . " and language_id = '" . (int)$languages_id . "'");
  	 while ($bundle_data_nested = tep_db_fetch_array($bundle_query_nested)) {
        	 // uncomment the following line to display subproduct qty 
                                   //echo "<br><i>     " . $bundle_data_nested['subproduct_qty'] . " x " . $bundle_data_nested['products_name'] . "</i>";
     //echo "<br><i>     " . $bundle_data_nested['products_name'] . "</i>";
echo '<tr><td valign="top" class="main">     <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data_nested['products_id']) . '"><i><u>' . $bundle_data_nested['products_name'] . '</u></i></a></td></tr>';

     // CB use special price if available
                                   if ($new_price = tep_get_products_special_price($bundle_data_nested['products_id'])) {
         $bundle_sum += $new_price*$bundle_data_nested['subproduct_qty'];
                                   } else { 
         $bundle_sum += $bundle_data_nested['products_price']*$bundle_data_nested['subproduct_qty'];
                                   }
                                   // endof CB mod

  	 }
   } else {
  	 // uncomment the following line to display subproduct qty 
                             // echo "<br>» <b>" . $bundle_data['subproduct_qty'] . " x " . $bundle_data['products_name'] . "</b>";
  	 //echo "<br>» <b> " . $bundle_data['products_name'] . "</b>";
echo '<tr><td valign="top" class="main">» <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $bundle_data['products_id']) . '"><b><u>' . $bundle_data['products_name'] . '</u></b></a></td></tr>';


  	 // CB use special price if available
                             if ($new_price = tep_get_products_special_price($bundle_data_nested['products_id'])) {
               $bundle_sum += $new_price*$bundle_data['subproduct_qty'];
                             } else { 
                   $bundle_sum += $bundle_data['products_price']*$bundle_data['subproduct_qty'];
                             }
                             // endof CB mod

   }
	 }
	 // CB use special bundle price if available
                 if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
         $bundle_saving = $bundle_sum - $new_price;
                 } else { 
   $bundle_saving = $bundle_sum - $product_info['products_price'];
                 }
                 // endof CB mod

	 $bundle_sum = $currencies->display_price($bundle_sum, tep_get_tax_rate($product_info['products_tax_class_id']));
	 $bundle_saving =  $currencies->display_price($bundle_saving, tep_get_tax_rate($product_info['products_tax_class_id']));
                 // comment out the following line to hide the "saving" text
	 echo '</table><p><table><tr><td class="main" align="right">' . TEXT_BUNDLE_SUM . '</td><td  class="main"><span class="productPrice">' . $bundle_sum . '</span></td></tr><tr><td class="main" align="right">' . TEXT_BUNDLE_SAVINGS . '</td><td  class="main"><span class="productSpecialPrice">' . $bundle_saving . '</span></td></tr></table>';

   } 
   ?>
<!-- end bundle -->

<?php
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
         <table border="0" cellspacing="0" cellpadding="2">
           <tr>
             <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
           </tr>
<?php
     $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
     while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
       $products_options_array = array();
       $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
       while ($products_options = tep_db_fetch_array($products_options_query)) {
         $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
         if ($products_options['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }
       }

       if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
         $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
       } else {
         $selected_attribute = false;
       }
?>
           <tr>
             <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
             <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
           </tr>
<?php
     }
?>
         </table>
<?php
   }
?>
       </td>
     </tr>

<?php
// BOF MaxiDVD: Modified For Ultimate Images Pack!
if (ULTIMATE_ADDITIONAL_IMAGES == 'Enable') { include(DIR_WS_MODULES . 'additional_images.php'); }
// BOF MaxiDVD: Modified For Ultimate Images Pack!
; ?>

     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   $reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "'");
   $reviews = tep_db_fetch_array($reviews_query);
   if ($reviews['count'] > 0) {
?>
     <tr>
       <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
<?php
   }

   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
   }

   if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
     <tr>
       <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
     </tr>
<?php
   } else {
?>
     <tr>
       <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
     </tr>
<?php
   }
?>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
         <tr class="infoBoxContents">
           <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
             <tr>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
               <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
               <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>
               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
             </tr>
           </table></td>
         </tr>
       </table></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>
<?php
//added for cross -sell
  if ( (USE_CACHE == 'true') && !SID) { 
   echo tep_cache_also_purchased(3600); 
    include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); 
  } else { 
    include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); 
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
  }
?>
       </td>
     </tr>
   </table></form></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); 
function tep_get_p_specials_prices($product_id) {
// For Separate Pricing Per Customer, to acquire all special prices

  $product_query = tep_db_query("select specials_new_products_price, customers_group_id from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status ='1'");
  while ($_product = tep_db_fetch_array($product_query)) {
  $product[] = $_product;
  }
  return $product;
}
?>

 

Any ideas ??? :(

 

I believe that the possibility of showing both retail and wholesale (or any other group price) together in the product_info.php page when logged in as any other group than

'Retail' is really very interesting for all b2b+b2c oscommerce sites. I think that it would be a great idea to integrade it to SPPC 4.2 .

 

It would also be nice for the wholwsale customer to be able to distinguish when there is a special price for the retail and/or wholesale group.

 

Cheers

Yiannis

Link to comment
Share on other sites

It looks like you made a small but crucial typo/change to the code. Where it says:

// EOF Separate Price per Customer

$products_price = '';
if ($customer_group_id != '0') {
? ? ? if (tep_not_null($cg_specials_price)) {
$products_price .= '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($cg_specials_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
? ? ? } else {

it shouldn't be $customer_group_id != '0' but it should be $customer_group_id == '0'

Link to comment
Share on other sites

Hi Jan,

 

thanks for your quick reply.

 

A. If the $sppc_customer_group_id isn't called global (global $sppc_customerg_group_id;) the $customer_group_id is not set.

 

This was a important hint for me, I?ve placed the globals in the wrong functions.

 

Your post also directed me to the right spot in the code.

 

The main changes are in the following part:

 

// BOF Separate Pricing Per Customer
?if(!tep_session_is_registered('sppc_customer_group_id')) { 
? $customer_group_id = '0';
?} else {
? $customer_group_id = $sppc_customer_group_id;
?}
?$orders_customers_price = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '". $customer_group_id . "' and products_id = '" . $products[$i]['id'] . "'");
?$orders_customers = tep_db_fetch_array($orders_customers_price);
// EOF Separate Pricing Per Customer

? ? ? ?if ($products[$i]['model'] == 'BONUS') {
? ? ?$bonus_preis = $products[$i]['price'];
?} else if ($orders_customers['customers_group_price'] > '0'){

? ? ?$bonus_preis = $orders_customers['customers_group_price'];

?} else {
? ? ?$bonus_preis = (tep_get_products_price_is_free($products[$i]['id']) ? 0 : $products_price_final ) + $cart->attributes_price($products[$i]['id'],1);
?}

? ? ? ?$this->products[$index] = array('qty' => $products[$i]['quantity'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $products[$i]['name'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'model' => $products[$i]['model'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'price' => $products[$i]['price'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_dsd_gebuehr' => $products[$i]['products_dsd_gebuehr'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_sperr' => $products[$i]['products_sperr'],
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_extra1' => $products[$i]['products_extra1'],

// Is products price excluded in final calc.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'products_price_excluded' => tep_get_products_price_excluded($products[$i]['id']),

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'product_is_free' => tep_get_products_price_is_free($products[$i]['id']),
// Apply Discounts and Check for Free
? ? ? ? ?'final_price' => $bonus_preis,

 

I think this is really dirty code, but it work for me after the first few tests.

I hope I won?t find any mistakes :rolleyes:

 

So now I have to optimize a last few things.

 

Thank you very much!!

 

Regards

 

Daniel

 

PS: I?ve you have any improvements for the code above, let me know..... B)

Edited by dabri
Link to comment
Share on other sites

It looks like you made a small but crucial typo/change to the code. Where it says:

// EOF Separate Price per Customer

$products_price = '';
if ($customer_group_id != '0') {
     if (tep_not_null($cg_specials_price)) {
$products_price .= '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($cg_specials_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
     } else {

it shouldn't be $customer_group_id != '0' but it should be $customer_group_id == '0'

 

You are right. I actually made that mistake. After correcting it thought, the situation is almost the same. The only difference is that the 'List Price' reference is gone again but this time from all the product_info pages whether you are logged as retail or wholesale. :blush:

 

Yiannis

Link to comment
Share on other sites

Yiannis,

 

Small things like a dot can make a really big difference in code. You have in your code:

$products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices 
} ? 
if (tep_not_null($cg_specials_price)) {
? $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

whereas it should be:

      $products_price .= '</span><br>'; // customer group prices on the next line end of small text for retail prices
     }
     if (tep_not_null($cg_specials_price)) {
$products_price .= '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($cg_specials_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

It is $products_price .= and not $products_price =

 

In the first case it means that the rest is concenated to what $products_price already is (including List price), in the second case $products_price is redefined.

 

Second problem is that you have display_price($new_price, in your code where it should be display_price($cg_specials_price, .

 

These "details" really matter in programming.

Link to comment
Share on other sites

I need help in modifying a particular file.....

 

Here is the code that I already have uploaded through another contribution....

 

// start random new products
   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);
 } else {
   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);
// end random new products    
 }
// start random new products
 // To configure:
 //
 // Under Admin - Configuration - Maximum Values
 // Set the following:
 //  'Selection of Random New Products' 
 //   (MAX_RANDOM_SELECT_NEW) - Sets how many of the most recent new product entries are queried
 //  'New Products Module'
 //   (MAX_DISPLAY_NEW_PRODUCTS) - Sets how many random new products are displayed on screen
 //
 $row = 0;
 $col = 0;
 $pCount = 0;
 $info_box_contents = array();
 $found_products = array();
 $num_rows = tep_db_num_rows($new_products_query);
 if (MAX_DISPLAY_NEW_PRODUCTS > MAX_RANDOM_SELECT_NEW) {
   // don't allow more new products than will be queried
   $max_new_products = MAX_RANDOM_SELECT_NEW;
 } else {
   $max_new_products = MAX_DISPLAY_NEW_PRODUCTS;
 }
 if ($num_rows > 0) {        
   while ($pCount < $max_new_products) {    
     // choose a random row 
     $random_product = '';
     $random_row = tep_rand(0, ($num_rows - 1));
     tep_db_data_seek($new_products_query, $random_row);
     $random_product = tep_db_fetch_array($new_products_query);
     // see if found already, if not use else skip
     $found = 0;
     for ($ii=0; $ii < $pCount; $ii++) {
       if ($found_products[$ii] == $random_product['products_id']) {
         $found = 1;
         break;
       }
     }
     if ($found == 0) {
       // keep track of found id's
       $found_products[$pCount] += $random_product['products_id'];
       $pCount ++; 
       // add to display array
       $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
       $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])));
       $col ++;
       if ($col > 2) {
         $col = 0;
         $row ++;
       }
     } // found
   } // while pCount
 } // num_rows  
// end random new products

 new contentBox($info_box_contents);

Now the above code is from the new_products.php file.

 

I have no idea how to incorporate the appropriate code for this page!

 

Anyone got an idea?

Link to comment
Share on other sites

Yiannis,

 

Small things like a dot can make a really big difference in code.

 

Dear JanZ,

 

you are right that small things make the big difference. There was also one other dot I misplaced but I managed to find it out myself. I have to admit that your remarks made me rush out and buy my first php/mysql book. Althought I am not a programmer ( I am an electronics engineer actually ) I always wanted to learn a little bit more about programming. So it is never too late. Thank you very much for your kind help. Sorry if I

frustated you at any point with my questions.

 

The modification now works like a charm showing both retail and wholesale group prices ( even special ones ) at wholesale customers.

 

Kind regards

Yiannis

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