Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contrib] Make An Offer


Recommended Posts

Hello,

please have some done install this contrib with SPPC and price break installed? I try it, take care off all codes but is still dont work, when I log in like customer who have eg 30% sale and when he put it in shopping cart, the cost is like for retail and is need also put offer cost without TAX. And also we I false direct accept offers from admin panel I and click at "make an offer" at product info It show cost in email is about 226 times increas like is retail.

Please can you some one help? I think all problems is in my shopping_cart.php and product_info.php

 

Here is my modified shopping_cart.php

 

<?php
/*
 $Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2008/03/07, Hide products and categories from groups 2008/08/03, QPBPP for SPPC v2.0 2008/11/08

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class shoppingCart {
   var $contents, $total, $weight, $cartID, $content_type;

   function shoppingCart() {
     $this->reset();
   }

   function restore_contents() {
           global $customer_id, $languages_id; // languages_id needed for PriceFormatter - QPBPP

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

// insert current cart contents in database
     if (is_array($this->contents)) {
       reset($this->contents);
       // BOF SPPC attribute hide/invalid check: loop through the shopping cart and check the attributes if they
// are hidden for the now logged-in customer
     $this->cg_id = $this->get_customer_group_id();
       while (list($products_id, ) = each($this->contents)) {
				// only check attributes if they are set for the product in the cart
			   if (isset($this->contents[$products_id]['attributes'])) {
			$check_attributes_query = tep_db_query("select options_id, options_values_id, IF(find_in_set('" . $this->cg_id . "', attributes_hide_from_groups) = 0, '0', '1') as hide_attr_status from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . tep_get_prid($products_id) . "'");
			while ($_check_attributes = tep_db_fetch_array($check_attributes_query)) {
				$check_attributes[] = $_check_attributes;
			} // end while ($_check_attributes = tep_db_fetch_array($check_attributes_query))
			$no_of_check_attributes = count($check_attributes);
			$change_products_id = '0';

			foreach($this->contents[$products_id]['attributes'] as $attr_option => $attr_option_value) {
				$valid_option = '0';
				for ($x = 0; $x < $no_of_check_attributes ; $x++) {
					if ($attr_option == $check_attributes[$x]['options_id'] && $attr_option_value == $check_attributes[$x]['options_values_id']) {
						$valid_option = '1';
						if ($check_attributes[$x]['hide_attr_status'] == '1') {
						// delete hidden attributes from array attributes, change products_id accordingly later
						$change_products_id = '1';
						unset($this->contents[$products_id]['attributes'][$attr_option]);
						}
					} // end if ($attr_option == $check_attributes[$x]['options_id']....
				} // end for ($x = 0; $x < $no_of_check_attributes ; $x++)
				if ($valid_option == '0') {
					// after having gone through the options for this product and not having found a matching one
					// we can conclude that apparently this is not a valid option for this product so remove it
					unset($this->contents[$products_id]['attributes'][$attr_option]);
					// change products_id accordingly later
					$change_products_id = '1';
				}
			} // end foreach($this->contents[$products_id]['attributes'] as $attr_option => $attr_option_value)

         if ($change_products_id == '1') {
           $original_products_id = $products_id;
           $products_id = tep_get_prid($original_products_id);
           $products_id = tep_get_uprid($products_id, $this->contents[$original_products_id]['attributes']);
					 // add the product without the hidden attributes to the cart
           $this->contents[$products_id] = $this->contents[$original_products_id];
			     // delete the originally added product with the hidden attributes
           unset($this->contents[$original_products_id]);
           }
			  } // end if (isset($this->contents[$products_id]['attributes']))
			} // end while (list($products_id, ) = each($this->contents))
      reset($this->contents); // reset the array otherwise the cart will be emptied
// EOF SPPC attribute hide/invalid check

       while (list($products_id, ) = each($this->contents)) {
         $qty = $this->contents[$products_id]['qty'];
         // BOF QPBPP for SPPC adjust quantity blocks and min_order_qty for this customer group
// warnings about this are raised in PriceFormatter
     $pf = new PriceFormatter;
     $pf->loadProduct(tep_get_prid($products_id), $languages_id);
     $qty = $pf->adjustQty($qty);
// EOF QPBPP for SPPC

         $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) . "', '" . tep_db_input($qty) . "', '" . date('Ymd') . "')");
           if (isset($this->contents[$products_id]['attributes'])) {
             reset($this->contents[$products_id]['attributes']);
             while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
               tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
             }
           }
         } else {
           tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . tep_db_input($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);
// BOF QPBPP for SPPC




       $products_query = tep_db_query("select cb.products_id, ptdc.discount_categories_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " cb left join (select products_id, discount_categories_id from " . TABLE_PRODUCTS_TO_DISCOUNT_CATEGORIES . " where customers_group_id = '" . $this->cg_id . "') as ptdc on cb.products_id = ptdc.products_id where customers_id = '" . (int)$customer_id . "'");
     // BOF SPPC Hide products and categories from groups
         $no_of_products_in_basket = 0;
//ak by neslo vymenit      while ($products = tep_db_fetch_array($products_query)) {
     while ($_products = tep_db_fetch_array($products_query)) {
       $temp_post_get_array[] = $_products['products_id'];
           $products[] = $_products;
           $no_of_products_in_basket += 1;
      }
 if ($no_of_products_in_basket > 0) {
           $hide_status_products = array();
           $hide_status_products = tep_get_hide_status($hide_status_products, $this->cg_id, $temp_post_get_array);
           for ($i=0 ; $i < $no_of_products_in_basket; $i++) {
             foreach($hide_status_products as $key => $subarray) {
               if ($subarray['products_id'] == tep_get_prid($products[$i]['products_id']) && $subarray['hidden'] == '0') {
// not hidden for this customer, can be added to the object shoppingCart
       $this->contents[$products[$i]['products_id']] = array('qty' => $products['customers_basket_quantity'], 'discount_categories_id' => $products['discount_categories_id']);
//ak by neslo odkomentovat a vymenit - original hiden for SPPC        $this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity'], 'discount_categories_id' => $products['discount_categories_id']);

// EOF QPBPP for SPPC

// attributes
                  $attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products[$i]['products_id']) . "'");
                  while ($attributes = tep_db_fetch_array($attributes_query)) {  $this->contents[$products[$i]['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
                  }
               } elseif ($subarray['products_id'] == tep_get_prid($products[$i]['products_id']) && $subarray['hidden'] == '1') {
// product is hidden for the customer, don't add to object shoppingCart, delete from db next
               $products_to_delete_from_cb[] = $products[$i]['products_id'];
               } // end if/elseif
             }// end foreach ($hide_status_products as $key => $subarray)
           } // end for ($i=0 ; $i < $no_of_products_in_basket; $i++)

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


     $this->cleanup();
   }

   function reset($reset_database = false) {
     global $customer_id;

     $this->contents = array();
     $this->total = 0;
     $this->weight = 0;
     $this->content_type = false;

     if (tep_session_is_registered('customer_id') && ($reset_database == true)) {
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "'");
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "'");

// BOF MAO addition: remove the complete session for accepted offers
if (MAO_ACCEPT_OFFER_DIRECTLY == 'true') {
          if (tep_session_is_registered('mao_accepted_offer')) {
             tep_session_unregister('mao_accepted_offer');
          }
}
// EOF MAO addition: remove the complete session for accepted offers
     }

     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;
     // BOF Separate Pricing Per Customer 
     $this->cg_id = $this->get_customer_group_id();
     // EOF Separate Pricing Per Customer

     $products_id_string = tep_get_uprid($products_id, $attributes);
     $products_id = tep_get_prid($products_id_string);

     if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$qty > MAX_QTY_IN_CART)) {
       $qty = MAX_QTY_IN_CART;
     }
// BOF QPBPP for SPPC
     $pf = new PriceFormatter;
     $pf->loadProduct($products_id);
     $qty = $pf->adjustQty($qty);
     $discount_category = $pf->get_discount_category();
// EOF QPBPP for SPPC

     $attributes_pass_check = true;

     if (is_array($attributes)) {
       reset($attributes);
       while (list($option, $value) = each($attributes)) {
         if (!is_numeric($option) || !is_numeric($value)) {
           $attributes_pass_check = false;
           break;
         }
       }
     }

     if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) {
       // BOF SPPC attribute hide check, original query expanded to include attributes
			$check_product_query = tep_db_query("select p.products_status, options_id, options_values_id, IF(find_in_set('" . $this->cg_id . "', attributes_hide_from_groups) = 0, '0', '1') as hide_attr_status, p.products_lead_time from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where p.products_id = '" . (int)$products_id . "'");
			while ($_check_product = tep_db_fetch_array($check_product_query)) {
				$check_product[] = $_check_product;
			} // end while ($_check_product = tep_db_fetch_array($check_product_query))
			$no_of_check_product = count($check_product);

 if (is_array($attributes)) {
			foreach($attributes as $attr_option => $attr_option_value) {
				$valid_option = '0';
				for ($x = 0; $x < $no_of_check_product ; $x++) {
					if ($attr_option == $check_product[$x]['options_id'] && $attr_option_value == $check_product[$x]['options_values_id']) {
						$valid_option = '1';
						if ($check_product[$x]['hide_attr_status'] == '1') {
						// delete hidden attributes from array attributes
						unset($attributes[$attr_option]);
						}
					} // end if ($attr_option == $check_product[$x]['options_id']....
				} // end for ($x = 0; $x < $no_of_check_product ; $x++)
				if ($valid_option == '0') {
					// after having gone through the options for this product and not having found a matching one
					// we can conclude that apparently this is not a valid option for this product so remove it
					unset($attributes[$attr_option]);
				}
			} // end foreach($attributes as $attr_option => $attr_option_value)
} // end if (is_array($attributes))
// now attributes have been checked and hidden and invalid ones deleted make the $products_id_string again
			$products_id_string = tep_get_uprid($products_id, $attributes);

       if ((isset($check_product) && tep_not_null($check_product)) && ($check_product[0]['products_status'] == '1')) {
// EOF SPPC attribute hide check
         if ($notify == true) {
           $new_products_id_in_cart = $products_id;
           tep_session_register('new_products_id_in_cart');
         }

// BOF QPBPP for SPPC
         if ($this->in_cart($products_id_string)) {
           $this->update_quantity($products_id_string, $qty, $attributes, $discount_category);
         } else {
           $this->contents[$products_id_string] = array('qty' => (int)$qty, 'discount_categories_id' => $discount_category);
// EOF QPBPP for SPPC
// insert into database
           if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$qty . "', '" . date('Ymd') . "')");

           if (is_array($attributes)) {
             reset($attributes);
             while (list($option, $value) = each($attributes)) {
               $this->contents[$products_id_string]['attributes'][$option] = $value;
// insert into database
               if (tep_session_is_registered('customer_id')) tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id_string) . "', '" . (int)$option . "', '" . (int)$value . "')");
             }
           }
         }

         $this->cleanup();

// assign a temporary unique ID to the order contents to prevent hack attempts during the checkout procedure
         $this->cartID = $this->generate_cart_id();
       }
     }
   }

// BOF QPBPP for SPPC
   function update_quantity($products_id, $quantity = '', $attributes = '', $discount_categories_id = NULL) {
// EOF QPBPP for SPPC

     global $customer_id;

     $products_id_string = tep_get_uprid($products_id, $attributes);
     $products_id = tep_get_prid($products_id_string);

     if (defined('MAX_QTY_IN_CART') && (MAX_QTY_IN_CART > 0) && ((int)$quantity > MAX_QTY_IN_CART)) {
       $quantity = MAX_QTY_IN_CART;
     }

     $attributes_pass_check = true;

     if (is_array($attributes)) {
       reset($attributes);
       while (list($option, $value) = each($attributes)) {
         if (!is_numeric($option) || !is_numeric($value)) {
           $attributes_pass_check = false;
           break;
         }
       }
     }

     if (is_numeric($products_id) && isset($this->contents[$products_id_string]) && is_numeric($quantity) && ($attributes_pass_check == true)) {
// BOF QPBPP for SPPC
       $this->contents[$products_id_string] = array('qty' => (int)$quantity, 'discount_categories_id' => $discount_categories_id);
// EOF QPBPP for SPPC

// update database
       if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . (int)$quantity . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "'");

       if (is_array($attributes)) {
         reset($attributes);
         while (list($option, $value) = each($attributes)) {
           $this->contents[$products_id_string]['attributes'][$option] = $value;
// update database
           if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " set products_options_value_id = '" . (int)$value . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id_string) . "' and products_options_id = '" . (int)$option . "'");
         }
       }
     }
   }

   function cleanup() {
     global $customer_id;

     reset($this->contents);
     while (list($key,) = each($this->contents)) {
       if ($this->contents[$key]['qty'] < 1) {
         unset($this->contents[$key]);
// remove from database
         if (tep_session_is_registered('customer_id')) {
           tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
           tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($key) . "'");
         }
       }
     }
   }

   function count_contents() {  // get total number of items in cart 
     $total_items = 0;
     if (is_array($this->contents)) {
       reset($this->contents);
       while (list($products_id, ) = each($this->contents)) {
         $total_items += $this->get_quantity($products_id);
       }
     }

     return $total_items;
   }

   function get_quantity($products_id) {
     if (isset($this->contents[$products_id])) {
       return $this->contents[$products_id]['qty'];
     } else {
       return 0;
     }
   }

   function in_cart($products_id) {
     if (isset($this->contents[$products_id])) {
       return true;
     } else {
       return false;
     }
   }

   function remove($products_id) {
     global $customer_id;

// BOF MAO addition: remove the selected product only from the mao session
  if (MAO_ACCEPT_OFFER_DIRECTLY == 'true') {
     if (tep_session_is_registered('mao_accepted_offer')) {
        $mao_temp_accepted = array();
        for ($k=0, $l=sizeof($_SESSION['mao_accepted_offer']); $k<$l; $k++) {
           $pos = strpos($products_id,"{");
           if ($pos === false) {
              if ($_SESSION['mao_accepted_offer'][$k]['productid'] == $products_id) {
                 // do nothing, skip the product which should be deleted
              } else {
                 // add again to the array the product(s) which stay in the shopping cart
                 $mao_accepted = array('productid' => $_SESSION['mao_accepted_offer'][$k]['productid'],'newprice' => $_SESSION['mao_accepted_offer'][$k]['newprice'],'initialvaluta' => $_SESSION['mao_accepted_offer'][$k]['initialvaluta']);
                 array_push($mao_temp_accepted, $mao_accepted);
              }
           } else {
              if ($_SESSION['mao_accepted_offer'][$k]['productid'] == substr($products_id,0,$pos)) {
                 // do nothing, skip the product which should be deleted
              } else {
                 // add again to the array the product(s) which stay in the shopping cart
                 $mao_accepted = array('productid' => $_SESSION['mao_accepted_offer'][$k]['productid'],'newprice' => $_SESSION['mao_accepted_offer'][$k]['newprice'],'initialvaluta' => $_SESSION['mao_accepted_offer'][$k]['initialvaluta']);
                 array_push($mao_temp_accepted, $mao_accepted);
              }
           }
        }
        // Update the MAO session with the remaining shopping cart products
        $_SESSION['mao_accepted_offer'] = $mao_temp_accepted;
     }
  }
// EOF Make an offer
     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();
// BOF Make an offer      
     // MAO addition: remove the complete session for accepted offers
     if (MAO_ACCEPT_OFFER_DIRECTLY == 'true') {
        if (tep_session_is_registered('mao_accepted_offer')) {
           tep_session_unregister('mao_accepted_offer');
        }
     }
// EOF Make an offer      
   }

   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() {
     global $currencies, $languages_id, $pfs, $currency; // for QPBPP added: $languages_id, $pfs


     $this->total = 0;
     $this->weight = 0;
     if (!is_array($this->contents)) return 0;
     // BOF Separate Pricing Per Customer
// global variable (session) $sppc_customer_group_id -> class variable cg_id
     $this->cg_id = $this->get_customer_group_id();
// EOF Separate Pricing Per Customer

// BOF QPBPP for SPPC
       $discount_category_quantity = array(); // calculates no of items per discount category in shopping basket
     foreach ($this->contents as $products_id => $contents_array) {
         if(tep_not_null($contents_array['discount_categories_id'])) {
           if (!isset($discount_category_quantity[$contents_array['discount_categories_id']])) {
               $discount_category_quantity[$contents_array['discount_categories_id']] = $contents_array['qty'];
           } else {
               $discount_category_quantity[$contents_array['discount_categories_id']] += $contents_array['qty'];
           }
         }
     } // end foreach

  $pf = new PriceFormatter;
// EOF QPBPP for SPPC

     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
       $qty = $this->contents[$products_id]['qty'];
// BOF QPBPP for SPPC       
     if (tep_not_null($this->contents[$products_id]['discount_categories_id'])) {
       $nof_items_in_cart_same_cat = $discount_category_quantity[$this->contents[$products_id]['discount_categories_id']];
       $nof_other_items_in_cart_same_cat = $nof_items_in_cart_same_cat - $qty;
     } else {
         $nof_other_items_in_cart_same_cat = 0;
     }
// EOF QPBPP for SPPC

// products price
       // BOF QPBPP for SPPC
      $pf->loadProduct($products_id, $languages_id);
       if ($product = $pfs->getPriceFormatterData($products_id)) {
         $prid = $product['products_id'];
         $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
         $products_price = $pf->computePrice($qty, $nof_other_items_in_cart_same_cat);
// EOF QPBPP for SPPC

         $products_weight = $product['products_weight'];

         // BOF Separate Pricing Per Customer
/*   $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

// BOF Addition for Make An Offer
  if (MAO_ACCEPT_OFFER_DIRECTLY == 'true') {
     if (tep_session_is_registered('mao_accepted_offer')) {
        for ($k=0, $l=sizeof($_SESSION['mao_accepted_offer']); $k<$l; $k++) {
           $pos = strpos($prid,"{");
           if ($pos === false) {
              if ($prid == $_SESSION['mao_accepted_offer'][$k]['productid']) {
                 // Check for valuta change after an offer already has been made
                 if (strcasecmp($_SESSION['mao_accepted_offer'][$k]['initialvaluta'],$currency) == 0) {
                    // Valuta is the original valuta for the offer
                    // We have to calculate back first as the currency class will
                    // alwasy do a rate multiply. This is neccessary in case an offer
                    // has been made in a non-default currency
                    $rate = $currencies->currencies[$currency]['value'];
                    $products_price = mao_priceoffer($_SESSION['mao_accepted_offer'][$k]['newprice'])/$rate;
                 } else {
                    // Neccessary to keep the correct amount if a customer
                    // switches between different valuta
                    $products_price = mao_priceoffer($_SESSION['mao_accepted_offer'][$k]['newprice'])*(1/$currencies->currencies[$_SESSION['mao_accepted_offer'][$k]['initialvaluta']]['value']);
                 }
                 break;
              }
           } else {
              if (substr($prid,0,$pos) == $_SESSION['mao_accepted_offer'][$k]['productid']) {
                 // Check for valuta change after an offer already has been made
                 if (strcasecmp($_SESSION['mao_accepted_offer'][$k]['initialvaluta'],$currency) == 0) {
                    // Valuta is the original valuta for the offer
                    // We have to calculate back first as the currency class will
                    // alwasy do a rate multiply. This is neccessary in case an offer
                    // has been made in a non-default currency
                    $rate = $currencies->currencies[$currency]['value'];
                    $products_price = mao_priceoffer($_SESSION['mao_accepted_offer'][$k]['newprice'])/$rate + $cart->attributes_price($prid);
                 } else {
                    // Neccessary to keep the correct amount if a customer
                    // switches between different valuta
                    $products_price = mao_priceoffer($_SESSION['mao_accepted_offer'][$k]['newprice'])*(1/$currencies->currencies[$_SESSION['mao_accepted_offer'][$k]['initialvaluta']]['value']) + $cart->attributes_price($prid);
                 }
                 break;
              }
           }
        }
     }
  }
// EOF Make an offer   

         $this->total += $currencies->calculate_price($products_price, $products_tax, $qty);
         $this->weight += ($qty * $products_weight);
       }

// attributes price
// BOF SPPC attributes mod
       if (isset($this->contents[$products_id]['attributes'])) {
         reset($this->contents[$products_id]['attributes']);
      $where = " AND ((";
       while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
        $where .= "options_id = '" . (int)$option . "' AND options_values_id = '" . (int)$value . "') OR (";
      }
      $where=substr($where, 0, -5) . ')';

      $attribute_price_query = tep_db_query("SELECT products_attributes_id, options_values_price, price_prefix FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . (int)$products_id . "'" . $where ."");

      if (tep_db_num_rows($attribute_price_query)) { 
       $list_of_prdcts_attributes_id = '';
			 // empty array $attribute_price
			 $attribute_price = array();
       while ($attributes_price_array = tep_db_fetch_array($attribute_price_query)) { 
	   $attribute_price[] =  $attributes_price_array;
	   $list_of_prdcts_attributes_id .= $attributes_price_array['products_attributes_id'].",";
           }
       if (tep_not_null($list_of_prdcts_attributes_id) && $this->cg_id != '0') { 
        $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $this->cg_id . "'");
 while ($pag_array = tep_db_fetch_array($pag_query)) {
	 $cg_attr_prices[] = $pag_array;
 }

 // substitute options_values_price and prefix for those for the customer group (if available)
 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($n = 0 ; $n < count($attribute_price); $n++) {
	 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		 if ($cg_attr_prices[$i]['products_attributes_id'] == $attribute_price[$n]['products_attributes_id']) {
			$attribute_price[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			$attribute_price[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
		 }
	 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
         }
       } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
     } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')
// now loop through array $attribute_price to add up/substract attribute prices

  for ($n = 0 ; $n < count($attribute_price); $n++) {
           if ($attribute_price[$n]['price_prefix'] == '+') {
             $this->total += $currencies->calculate_price($attribute_price[$n]['options_values_price'], $products_tax, $qty);
           } else {
             $this->total -= $currencies->calculate_price($attribute_price[$n]['options_values_price'], $products_tax, $qty);
       }
  } // end for ($n = 0 ; $n < count($attribute_price); $n++)
         } // end if (tep_db_num_rows($attribute_price_query))
       } // end if (isset($this->contents[$products_id]['attributes'])) 
     }
   }
// EOF SPPC attributes mod



// function attributes_price changed partially according to FalseDawn's post
// http://www.oscommerce.com/forums/index.php?showtopic=139587
// changed completely for Separate Pricing Per Customer, attributes mod
   function attributes_price($products_id) {
// global variable (session) $sppc_customer_group_id -> class variable cg_id
   $this->cg_id = $this->get_customer_group_id();

     if (isset($this->contents[$products_id]['attributes'])) {
       reset($this->contents[$products_id]['attributes']);
      $where = " AND ((";
       while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
        $where .= "options_id = '" . (int)$option . "' AND options_values_id = '" . (int)$value . "') OR (";
      }
      $where=substr($where, 0, -5) . ')';

      $attribute_price_query = tep_db_query("SELECT products_attributes_id, options_values_price, price_prefix FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . (int)$products_id . "'" . $where ."");

     if (tep_db_num_rows($attribute_price_query)) {
       $list_of_prdcts_attributes_id = '';
       while ($attributes_price_array = tep_db_fetch_array($attribute_price_query)) { 
	   $attribute_price[] =  $attributes_price_array;
	   $list_of_prdcts_attributes_id .= $attributes_price_array['products_attributes_id'].",";
         }

       if (tep_not_null($list_of_prdcts_attributes_id) && $this->cg_id != '0') { 
        $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $this->cg_id . "'");
 while ($pag_array = tep_db_fetch_array($pag_query)) {
	 $cg_attr_prices[] = $pag_array;
 }

 // substitute options_values_price and prefix for those for the customer group (if available)
 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($n = 0 ; $n < count($attribute_price); $n++) {
	 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		 if ($cg_attr_prices[$i]['products_attributes_id'] == $attribute_price[$n]['products_attributes_id']) {
			$attribute_price[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			$attribute_price[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
       }
	 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
     }
       } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
     } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')
// now loop through array $attribute_price to add up/substract attribute prices

  for ($n = 0 ; $n < count($attribute_price); $n++) {
           if ($attribute_price[$n]['price_prefix'] == '+') {
             $attributes_price += $attribute_price[$n]['options_values_price'];
           } else {
             $attributes_price -= $attribute_price[$n]['options_values_price'];
           }
  } // end for ($n = 0 ; $n < count($attribute_price); $n++)
     return $attributes_price;
      } else { // end if (tep_db_num_rows($attribute_price_query))
        return 0;
      } 
    }  else { // end if (isset($this->contents[$products_id]['attributes']))
      return 0;
   }
  } // end of function attributes_price, modified for SPPC with attributes


   function get_products() {
     global $languages_id, $pfs, $currency, $currencies; // PriceFormatterStore added and Make an offer added $currency, $currencies

// BOF Separate Pricing Per Customer
 $this->cg_id = $this->get_customer_group_id();
// EOF Separate Pricing Per Customer


     if (!is_array($this->contents)) return false;
     // BOF QPBPP for SPPC
     $discount_category_quantity = array();
     foreach ($this->contents as $products_id => $contents_array) {
         if(tep_not_null($contents_array['discount_categories_id'])) {
           if (!isset($discount_category_quantity[$contents_array['discount_categories_id']])) {
               $discount_category_quantity[$contents_array['discount_categories_id']] = $contents_array['qty'];
           } else {
               $discount_category_quantity[$contents_array['discount_categories_id']] += $contents_array['qty'];
           }
         }
     } // end foreach

     $pf = new PriceFormatter;
// EOF QPBPP for SPPC


     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
// BOF QPBPP for SPPC
     $pf->loadProduct($products_id, $languages_id); // does query if necessary and adds to 
     // PriceFormatterStore or gets info from it next
     if ($products = $pfs->getPriceFormatterData($products_id)) {
      if (tep_not_null($this->contents[$products_id]['discount_categories_id'])) {
         $nof_items_in_cart_same_cat =  $discount_category_quantity[$this->contents[$products_id]['discount_categories_id']];
         $nof_other_items_in_cart_same_cat = $nof_items_in_cart_same_cat - $this->contents[$products_id]['qty'];
       } else {
         $nof_other_items_in_cart_same_cat = 0;
       }
         $products_price = $pf->computePrice($this->contents[$products_id]['qty'], $nof_other_items_in_cart_same_cat);
// EOF QPBPP for SPPC

// BOF Addition for Make An Offer
  if (MAO_ACCEPT_OFFER_DIRECTLY == 'true') {
     if (tep_session_is_registered('mao_accepted_offer')) {
        for ($k=0, $l=sizeof($_SESSION['mao_accepted_offer']); $k<$l; $k++) {
           $pos = strpos($prid,"{");
           if ($pos === false) {
              if ($prid == $_SESSION['mao_accepted_offer'][$k]['productid']) {
                 // Check for valuta change after an offer already has been made
                 if (strcasecmp($_SESSION['mao_accepted_offer'][$k]['initialvaluta'],$currency) == 0) {
                    // Valuta is the original valuta for the offer
                    // We have to calculate back first as the currency class will
                    // alwasy do a rate multiply. This is neccessary in case an offer
                    // has been made in a non-default currency
                    $rate = $currencies->currencies[$currency]['value'];
                    $products_price = mao_priceoffer($_SESSION['mao_accepted_offer'][$k]['newprice'])/$rate;
                 } else {
                    // Neccessary to keep the correct amount if a customer
                    // switches between different valuta
                    $products_price = mao_priceoffer($_SESSION['mao_accepted_offer'][$k]['newprice'])*(1/$currencies->currencies[$_SESSION['mao_accepted_offer'][$k]['initialvaluta']]['value']);
                 }
                 break;
              }
           } else {
              if (substr($prid,0,$pos) == $_SESSION['mao_accepted_offer'][$k]['productid']) {
                 // Check for valuta change after an offer already has been made
                 if (strcasecmp($_SESSION['mao_accepted_offer'][$k]['initialvaluta'],$currency) == 0) {
                    // Valuta is the original valuta for the offer
                    // We have to calculate back first as the currency class will
                    // alwasy do a rate multiply. This is neccessary in case an offer
                    // has been made in a non-default currency
                    $rate = $currencies->currencies[$currency]['value'];
                    $products_price = mao_priceoffer($_SESSION['mao_accepted_offer'][$k]['newprice'])/$rate + $cart->attributes_price($prid);
                 } else {
                    // Neccessary to keep the correct amount if a customer
                    // switches between different valuta
                    $products_price = mao_priceoffer($_SESSION['mao_accepted_offer'][$k]['newprice'])*(1/$currencies->currencies[$_SESSION['mao_accepted_offer'][$k]['initialvaluta']]['value']) + $cart->attributes_price($prid);
                 }
                 break;
              }
           }
        }
     }
  }
// EOF make an offer   

         $products_array[] = array('id' => $products_id,
                                   'name' => $products['products_name'],
                                   'model' => $products['products_model'],
                                   'image' => $products['products_image'],
// BOF QPBPP for SPPC
                                   'discount_categories_id' => $this->contents[$products_id]['discount_categories_id'],
// EOF QPBPP for SPPC

                                   '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'] : ''),
                                   'lead_time' => $products['products_lead_time']);
       }
     }

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

// added for Separate Pricing Per Customer, returns customer_group_id
   function get_customer_group_id() {
     if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
       $_cg_id = $_SESSION['sppc_customer_group_id'];
     } else {
        $_cg_id = 0;
     }
     return $_cg_id;
   }

 }
?>

 

and here is my moddified product_info.php

 

<?php
/*
 $Id: product_info.php 1739 2007-12-20 00:52:16Z hpdl $
 adapted for Separate Pricing Per Customer v4.2 2007/06/23, Hide products and categories from groups 2008/08/05, adapted for QPBPP for SPPC v2.0 2008/11/0

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

// BOF Added for Make An Offer
  require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_MAKE_AN_OFFER);
// EOF Added for Make An Offer

 // BOF Separate Pricing Per Customer, Hide products and categories from groups
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
   $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
   $customer_group_id = '0';
 }

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) 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 . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0");
 $product_check = tep_db_fetch_array($product_check_query);
// EOF Separate Pricing Per Customer, Hide products and categories from groups

?>
<!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">
<link rel="stylesheet" href="lightbox/prettyPhoto.css" type="text/css" title="prettyPhoto main stylesheet" charset="utf-8" />
<script src="lightbox/jquery-1.2.3.pack.js" type="text/javascript" charset="utf-8"></script>
<script src="lightbox/prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
<?php
  if (!isset($lng) || (isset($lng) && !is_object($lng))) {
    include_once(DIR_WS_CLASSES . 'language.php');
    $lng = new language;
  }

  reset($lng->catalog_languages);
  while (list($key, $value) = each($lng->catalog_languages)) {
?>
        <link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo FILENAME_RSS, '?language=' . $key.((isset($_GET['cPath']))?'&cPath='.$_GET['cPath']:'').((isset($_GET['manufacturers_id']))?'&manufacturers_id='.$_GET['manufacturers_id']:''); ?>">
         <?php
         }
         ?>

<!-- BOF SUHY  - multiple image -->
<script>

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.

// SETUPS:
// ===============================

// Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)

defaultWidth  = 750;
defaultHeight = 750;

// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows

var AutoClose = true;

// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
writeln('width=300-(document.body.clientWidth-document.images[0].width);');
writeln('height=300-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="George" src='+imageURL+' style="display:block"></body></html>');
close();		
}}

</script>


<link rel="stylesheet" href="thumbnailviewer2.css" type="text/css">

<!-- EOF SUHY  - multiple image -->
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<div id="wrapper">
<!-- 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) {
 // BOF Separate Pricing Per Customer, Hide products and categories from groups
     $hide_product = true; // needed for column_right
// EOF Separate Pricing Per Customer, Hide products and categories from groups
?>
     <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 {
 // suhy - multiple image addedp.product_image_2, p.product_image_3, p.product_image_4, p.product_image_5, p.product_image_6,
   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_make_an_offer, p.products_quantity, p.products_image, p.product_image_2, p.product_image_3, p.product_image_4, p.product_image_5, p.product_image_6, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_lead_time 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_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 . "'");

// BOF QPBPP for SPPC
   $pf->loadProduct((int)$_GET['products_id'], (int)$languages_id);
   $products_price = $pf->getPriceString();
// EOF QPBPP for SPPC


   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'];
   }
   // BOF QPBPP for SPPC
 $min_order_qty = $pf->getMinOrderQty();
   if ($min_order_qty > 1) {
     $products_name .= '<br><span class="smallText">' . MINIMUM_ORDER_TEXT . $min_order_qty . '</span>';
   }
// EOF QPBPP for SPPC

?>
     <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>
       </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 SUHY  - multiple image -->

<?php



  $PicCount = 0;
        echo '<td>';
        echo '<div style="text-align:center;">';
        echo '<a class="thumbnail1" href=" '. tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) .' ">'.'<span><img src="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" /><br>' . TEXT_IMAGE_MOUSOVER .'</span>' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>';
        echo '<br>';
?>
        <a href="javascript:popImage('<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) ;?>','<?php echo TEXT_IMAGE_POPUP ?>')"><?php echo TEXT_CLICK_TO_ENLARGE ?></a>

<?php

        echo '</div></td>';
        $PicCount = $PicCount + 1;


     if ($product_info['product_image_2'] != "") {
        echo '<td>';
        echo '<div style="text-align:center;">';
        echo '<a class="thumbnail2" href=" '. tep_href_link(DIR_WS_IMAGES . $product_info['product_image_2']) .' ">'.'<span><img src="' . tep_href_link(DIR_WS_IMAGES . $product_info['product_image_2']) . '" /><br>' . TEXT_IMAGE_MOUSOVER .'</span>' . tep_image(DIR_WS_IMAGES . $product_info['product_image_2'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>';
        echo '<br>';
?>
        <a href="javascript:popImage('<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['product_image_2']) ;?>','<?php echo TEXT_IMAGE_POPUP ?>')"><?php echo TEXT_CLICK_TO_ENLARGE ?></a>
<?php
        echo '</div><td>';
        $PicCount = $PicCount + 1;
     }


     if ($product_info['product_image_3'] != "") {
        echo '<td>';
        echo '<div style="text-align:center;">';
        echo '<a class="thumbnail3" href=" '. tep_href_link(DIR_WS_IMAGES . $product_info['product_image_3']) .' ">'.'<span><img src="' . tep_href_link(DIR_WS_IMAGES . $product_info['product_image_3']) . '" /><br>' . TEXT_IMAGE_MOUSOVER .'</span>' . tep_image(DIR_WS_IMAGES . $product_info['product_image_3'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>';
        echo '<br>';
?>
        <a href="javascript:popImage('<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['product_image_3']) ;?>','<?php echo TEXT_IMAGE_POPUP ?>')"><?php echo TEXT_CLICK_TO_ENLARGE ?></a>

<?php

        echo "</div></td>";
        $PicCount = $PicCount + 1;
     }


     if ($product_info['product_image_4'] != "") {
        echo '<td>';
        echo '<div style="text-align:center;">';
        echo '<a class="thumbnail4" href=" '. tep_href_link(DIR_WS_IMAGES . $product_info['product_image_4']) .' ">'.'<span><img src="' . tep_href_link(DIR_WS_IMAGES . $product_info['product_image_4']) . '" /><br>' . TEXT_IMAGE_MOUSOVER .'</span>' . tep_image(DIR_WS_IMAGES . $product_info['product_image_4'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '</a>';
        echo '<br>';
?>
        <a href="javascript:popImage('<?php echo tep_href_link(DIR_WS_IMAGES . $product_info['product_image_4']) ;?>','<?php echo TEXT_IMAGE_POPUP ?>')"><?php echo TEXT_CLICK_TO_ENLARGE ?></a>

<?php

        echo "</div></td>";
        $PicCount = $PicCount + 1;
     }


  ?>


<!-- EOF SUHY  - multiple image -->
<!-- 

this is a support for showing 4 images in a row as I needed for my page. If you need more images just continue the code or make your own table
and use the appropriate links in table cells .. Just replace product_image_4 to 5 and 6 accordingly in all instances

-->

             </td>
           </tr>
         </table>
<?php
   }
?>
         <p><?php echo stripslashes($product_info['products_description']); ?></p>
<!-- BOF Make an offer -->          
         <div ALIGN="center"><table border="0" width="75%" cellspacing="0" cellpadding="2">
  <?php if ((MAO_ACCEPT_OFFER_DIRECTLY == 'true') && ($product_info['products_make_an_offer'] == true)) { ?>
     <tr><td align="center" class="maooffer"><?php echo ENTRY_NEW_PRICE; ?><br>
     <input name='newpriceoffer' type='text' value='<?php echo tep_round($newpriceoffer,$currencies->currencies[$currency]['decimal_places']); ?>' MAXLENGTH='15' SIZE='10'><br><?php echo ' ' . $currency; ?></td></tr>
  <?php
     }
     if (tep_session_is_registered('mao_low_offer')) {
        echo '<tr><td class="maolowoffer">' . ENTRY_LOW_OFFER_CHECK_ERROR . '</td></tr>';
        tep_session_unregister('mao_low_offer');
     }
  ?>
  </table></div><br>
<!-- EOF Make an offer -->

<?php
   // BOF SPPC Hide attributes from customer groups
   $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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");

   $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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 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, pa.products_attributes_id 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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
	$list_of_prdcts_attributes_id = '';
	$products_options = array(); // makes sure this array is empty again
       while ($_products_options = tep_db_fetch_array($products_options_query)) {
	$products_options[] = $_products_options;
	$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
}

     if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') { 
        $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
 while ($pag_array = tep_db_fetch_array($pag_query)) {
	 $cg_attr_prices[] = $pag_array;
 }

 // substitute options_values_price and prefix for those for the customer group (if available)
 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
    for ($n = 0 ; $n < count($products_options); $n++) {
	 for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
		 if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
			$products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			$products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
		 }
	 } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
    }
       } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
     } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

  for ($n = 0 ; $n < count($products_options); $n++) {
         $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
         if ($products_options[$n]['options_values_price'] != '0') {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
         }
       }
// EOF SPPC attributes mod


       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>
     <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 . " where products_id = '" . (int)$HTTP_GET_VARS['products_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
   }
//Products Lead Time Contrib
if ($product_info['products_lead_time']>0) {
?>
 <tr>
   <td align="center" class="myNote">Tento produkt momentálne nie je na sklade alebo je v medzisklade, čas doručenia od objednania je: <?php echo ' ' . $product_info['products_lead_time'] . ' '; ?>pracovných dní</td>
 </tr>
 <?php
  }
//EOF

   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>
<!-- BOF Make an offer -->              
               <?php
  if ($product_info['products_make_an_offer'] == true) {
  ?>
     <td class="main" align="right">
     <?php if (MAO_ACCEPT_OFFER_DIRECTLY == 'false') { ?>
        <?php echo '<a href="' . tep_href_link(FILENAME_MAKE_AN_OFFER, tep_get_all_get_params()) . '">' . tep_image_button('button_make_an_offer.gif', IMAGE_BUTTON_MAKE_AN_OFFER) . '</a>'; ?>
     <?php
     }
     ?>
     </td>
  <?php
  }
  ?>
<!-- EOF Make an offer -->   
               <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>
<?php // BOF QPBPP for SPPC ?>
               <td class="main" align="right">
                 <table border="0" align="right">
                   <tr><td class="main" align="center">
                     <?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>
                   </td></tr>
                   <tr><td align="center">
                     <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
                   </td></tr>
             </table>
               </td>
<?php // EOF QPBPP for SPPC ?>

               <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
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     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>
</div>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

 

PLEASE HELP ME

Link to comment
Share on other sites

  • Replies 209
  • Created
  • Last Reply

Top Posters In This Topic

Hello

Excuse my english

I try to install Make an Offer V3.1 FULL PACKAGE

In catalog/includes/application_top.php

I search for

// customer adds a product from the products page
  case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                             $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                          }
                          tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                          break;

 

So i have qtpro installed and i have

case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
//++++ QT Pro: Begin Changed code
                               $attributes=array();
                               if (isset($HTTP_POST_VARS['attrcomb']) && (preg_match("/^\d{1,10}-\d{1,10}(,\d{1,10}-\d{1,10})*$/",$HTTP_POST_VARS['attrcomb']))) {
                                 $attrlist=explode(',',$HTTP_POST_VARS['attrcomb']);
                                 foreach ($attrlist as $attr) {
                                   list($oid, $oval)=explode('-',$attr);
                                   if (is_numeric($oid) && $oid==(int)$oid && is_numeric($oval) && $oval==(int)$oval)
                                     $attributes[$oid]=$oval;
                                 }
                               }
                               if (isset($HTTP_POST_VARS['id']) && is_array($HTTP_POST_VARS['id'])) {
                                 foreach ($HTTP_POST_VARS['id'] as $key=>$val) {
                                   if (is_numeric($key) && $key==(int)$key && is_numeric($val) && $val==(int)$val)
                                     $attributes=$attributes + $HTTP_POST_VARS['id'];
                                 }
                               }
                               if ($HTTP_POST_VARS['free'][$i] != 1) {
                               $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+ (int)$HTTP_POST_VARS['quantity'], $attributes);
							/*
							$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);

							$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + (int)$HTTP_POST_VARS['quantity'], $HTTP_POST_VARS['id']); 
							*/

//++++ QT Pro: End Changed Code
                             // denuz text attr
                               tep_db_query("delete from customers_basket_text_attributes where products_id = " . $HTTP_POST_VARS['products_id'] . " and session_id = '" . $osCsid . "'");
                               $attr_query = tep_db_query("select * from products_text_attributes_enabled where products_id = " . $HTTP_POST_VARS['products_id']);
                               while ($attr = tep_db_fetch_array($attr_query)) {
                                 tep_db_query("insert into customers_basket_text_attributes values ('$osCsid', " . $HTTP_POST_VARS['products_id'] . ", " . $attr['products_text_attributes_id'] . ", '" . addslashes($HTTP_POST_VARS['products_text_attributes_' . $attr['products_text_attributes_id']]) . "');");
                               }
// eof denuz text attr
                             }
                             }

                            tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;

 

Have you an idea for put the code of make offer in my code?

code of make offer

// customer adds a product from the products page
  case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

                             // No offer is made or direct offers are disabled
                             // so the default price is accepted
                             $offeracceptable = true;
                             // Addition for Make An Offer
                             if (MAO_ACCEPT_OFFER_DIRECTLY == 'true') {
				if (!$HTTP_POST_VARS['newpriceoffer'] == '') {
					$offeracceptable = mao_check_offer($HTTP_POST_VARS['newpriceoffer'], $HTTP_POST_VARS['products_id']);
					if ($offeracceptable == true) {
						if (!tep_session_is_registered('mao_accepted_offer')) {
							$mao_accepted_offer = array();
							$mao_accepted = array('productid' => $HTTP_POST_VARS['products_id'],'newprice' => $HTTP_POST_VARS['newpriceoffer'],'initialvaluta' => $currency);
							array_push($mao_accepted_offer, $mao_accepted);
							tep_session_register('mao_accepted_offer');
						} else {
							$mao_accepted = array('productid' => $HTTP_POST_VARS['products_id'],'newprice' => $HTTP_POST_VARS['newpriceoffer'],'initialvaluta' => $currency);
							array_push($mao_accepted_offer, $mao_accepted);
						}
					}
				}
			}
			if ($offeracceptable == true) {
				tep_session_unregister('mao_low_offer');
				$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
			} else {
				tep_session_register('mao_low_offer');
			}
                          }
                          tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                          break;

 

Thank's

Francois

Edited by francois21
Link to comment
Share on other sites

  • 2 weeks later...

Hi Folkz! B)

 

I just installed this contrib to a test shop and found out some problems, which you hopefully can help me with:

 

1) i can see the contrib in my shop just for one product, and in the admin area the red signs are all "on" and the green are all "off", even on the one product, where i can make an offer at in my shop.

 

2) the product i can make an offer for has a regular price of 79 EUR incl. tax. but when i want to make an offer, there is shown, that the original price is 191.707,91 EUR :blink:

but this value is not used, the contrib still works with 79 EUR.

 

3) If I make an offer for let's say 69 EUR, the price is taken into the shopping cart, but tax will be added. I would prefer, that the offered price includes tax already.

 

4) if i switch on the automatic acception, the item is put to the shopping card directly. but when i switch this off, i just get an e-mail with the information of the offered price. is it possible, to put the item into the cart from here as well, or does the contrib do not include this option?

 

I thank you all for your help. I really like this contrib, but without eliminating the above mentioned problems, I can not really use it. :'(

 

Best regards and take care,

 

Nicole

 

Hi Nicole,

Sorry I've been away for a while. On your first question about the red and green lights, I will look at the code for what controls that and get back to you shortly.

On your second question about the incorrect price try this (only if you are using the v2.2 rc2 store)

in catalog/make_an_offer.php, look for the code:

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

   $products_price = $currencies->display_price($productid,$new_price, tep_get_tax_rate($product_info['products_tax_class_id']));

// Price without currency symbols
$products_price_clean = tep_round(tep_add_tax($new_price * $rate,tep_get_tax_rate($product_info['products_tax_class_id'])),$currencies->currencies[$currency]['decimal_places']);

 } else {
   $products_price = $currencies->display_price($productid,$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

and change to:

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

     $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

// Price without currency symbols
$products_price_clean = tep_round(tep_add_tax($new_price * $rate,tep_get_tax_rate($product_info['products_tax_class_id'])),$currencies->currencies[$currency]['decimal_places']);

 } else {
   $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

 

On question 3, I'm not sure I understand..the customer is going to decide what they want to offer you. If you would like, there are ways we can put a note to 'alert' the customer that 'tax will be added' (and they can think of this while they decide what to offer you)

 

On question 4, No it's not possible. It would be nice to be able to accept offers directly from the email, but I think that would cause a security issue. One thing I am (slowly) working on in my free time, is the ability to accept offers from your admin panel (which you would have to securely sign into)..where it would put the offer in their shopping cart for when they return. The email can have an option to both 1) reply to the sender telling them you accept/reject their offer, and 2) provide you a link to your admin where you will then sign in first and then apply the new accept options(if you're going to accept). Again, something for the future, when I have a weekend to look at it.

 

Again, sorry for late reply, if you are still having these issues, let me know and I'll do my best to help you.

Link to comment
Share on other sites

Hello,

please have some done install this contrib with SPPC and price break installed? I try it, take care off all codes but is still dont work, when I log in like customer who have eg 30% sale and when he put it in shopping cart, the cost is like for retail and is need also put offer cost without TAX. And also we I false direct accept offers from admin panel I and click at "make an offer" at product info It show cost in email is about 226 times increas like is retail.

Please can you some one help? I think all problems is in my shopping_cart.php and product_info.php

 

Hi Jozinecko, Again, sorry I have been on holiday. I got your IM. If you are still having this problem, let me know and I will look at the code to remove the tax and get back to you. As for the incorrect price, see the code change I put in the message above for Nichole, this may help you too.

Link to comment
Share on other sites

Hello

have you a solution for the offer price is not added with tax in the shopping cart

if the price with tax of an article is 60€, I make an offer of 55€ for exemple and the offer in shopping cart is 65.78

(more than normal price)

it is the only problem with this great contribution

Thank's

Francois

Link to comment
Share on other sites

  • 2 months later...

Hi,

 

I am in the middle of installing this contribution, which was going fine until I got to application_top.php

 

I have Option Types V2 loaded also and have found that merging the two contributions awkward to say the least, in the following section of code where the instructions call for the following to be replaced;

 

The instructions say find;

 

// customer adds a product from the products page
  case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
                             $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
                          }
                          tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                          break; 

 

This code is replaced with;

 

// customer adds a product from the products page
  case 'add_product' :    if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

                             // No offer is made or direct offers are disabled
                             // so the default price is accepted
                             $offeracceptable = true;
                             // Addition for Make An Offer
                             if (MAO_ACCEPT_OFFER_DIRECTLY == 'true') {
				if (!$HTTP_POST_VARS['newpriceoffer'] == '') {
					$offeracceptable = mao_check_offer($HTTP_POST_VARS['newpriceoffer'], $HTTP_POST_VARS['products_id']);
					if ($offeracceptable == true) {
						if (!tep_session_is_registered('mao_accepted_offer')) {
							$mao_accepted_offer = array();
							$mao_accepted = array('productid' => $HTTP_POST_VARS['products_id'],'newprice' => $HTTP_POST_VARS['newpriceoffer'],'initialvaluta' => $currency);
							array_push($mao_accepted_offer, $mao_accepted);
							tep_session_register('mao_accepted_offer');
						} else {
							$mao_accepted = array('productid' => $HTTP_POST_VARS['products_id'],'newprice' => $HTTP_POST_VARS['newpriceoffer'],'initialvaluta' => $currency);
							array_push($mao_accepted_offer, $mao_accepted);
						}
					}
				}
			}
			if ($offeracceptable == true) {
				tep_session_unregister('mao_low_offer');
				$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
			} else {
				tep_session_register('mao_low_offer');
			}
                          }
                          tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                          break;


 

My problem is having Option Types V2 installed, by case=add product looks quite different, as follows;

 

// customer adds a product from the products page
     case 'add_product' :  //BOF - Zappo - Option Types v2 - File uploading: Purge the Temporary Upload Dir
                               $purgeDir = opendir(TMP_DIR) or die ('Could not open '.TMP_DIR);
                               while ($file = readdir($purgeDir)) {
                                 if ($file != ('.htaccess') && $file != ('.') && $file != ('..') && filemtime(TMP_DIR . $file) < strtotime(OPTIONS_TYPE_PURGETIME)) {
                                   unlink(TMP_DIR . $file);  // Delete file from server...
                                   tep_db_query("delete from " . TABLE_FILES_UPLOADED . " where files_uploaded_name = '" . $file . "'"); // Remove File's database entry....
                                 }
                               }
                               closedir($purgeDir);
                               //EOF - Zappo - Option Types v2 - File uploading: Purge the Temporary Upload Dir

                               //BOF - Zappo - Option Types v2 - ONE LINE - Set real_ids for processing
                               $real_ids = $HTTP_POST_VARS['id'];
                               //BOF - Zappo - Option Types v2 - File uploading: save uploaded files with unique file names, in the proper folder
                               if ($HTTP_POST_VARS['number_of_uploads'] > 0) {
                                 require(DIR_WS_CLASSES . 'upload.php');
                                 for ($i = 1; $i <= $HTTP_POST_VARS['number_of_uploads']; $i++) {
                                   $TEMP_FILE = $_FILES['id']['tmp_name'][TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]];
                                   if (tep_not_null($TEMP_FILE) && $TEMP_FILE != 'none') {
                                     $products_options_file = new upload('id');
                                     //BOF - Zappo - Option Types v2 - Set Upload directory (Registered customers in Uploads, other in Temporary folder)
                                     if (tep_session_is_registered('customer_id')) {  // IF the customer is registered, use Upload Dir
                                       $products_options_file->set_destination(UPL_DIR);
                                     } else { // If the customer is not registered, use Temporary Dir
                                       $products_options_file->set_destination(TMP_DIR);
                                     }
                                     //EOF - Zappo - Option Types v2 - Set Upload directory (Registered customers in Uploads, other in Temporary folder)
                                     if ($products_options_file->parse(TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i])) {
                                       if (tep_session_is_registered('customer_id')) {
                                         tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, customers_id, files_uploaded_name, date) values('" . tep_session_id() . "', '" . $customer_id . "', '" . tep_db_input($products_options_file->filename) . "', '" . date("d-m-y") . "')");
                                       } else {
                                         tep_db_query("insert into " . TABLE_FILES_UPLOADED . " (sesskey, files_uploaded_name, date) values('" . tep_session_id() . "', '" . tep_db_input($products_options_file->filename) . "', '" . date("d-m-y") . "')");
                                       }
                                       //BOF - Zappo - Option Types v2 - Set File Prefix
                                       if (OPTIONS_TYPE_FILEPREFIX == 'Database') {  //  Database ID as File prefix
                                         $insert_id = tep_db_insert_id() . '_';
                                       } else {  //  Date, time or both as File prefix (Change date formatting here)
                                         if (OPTIONS_TYPE_FILEPREFIX == 'Date' || OPTIONS_TYPE_FILEPREFIX == 'DateTime') {
                                           $insert_id = 'D'.date("d-m-y_");
                                         }
                                         $insert_id .= (OPTIONS_TYPE_FILEPREFIX == 'DateTime' || OPTIONS_TYPE_FILEPREFIX == 'Time') ? 'T'.date("H-i_") : '';
                                       }
                                       //EOF - Zappo - Option Types v2 - Set File Prefix
                                       // Update filename in Database with correct prefix (For comparing database names with real files)
                                       tep_db_query("update " . TABLE_FILES_UPLOADED . " set files_uploaded_name = '" . tep_db_input($insert_id . $products_options_file->filename) . "' where sesskey = '" . tep_session_id() . "' and files_uploaded_name = '" . tep_db_input($products_options_file->filename) . "' and date = '" . date("d-m-y") . "'");
                                       $real_ids[TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]] = $insert_id . $products_options_file->filename;
                                       $products_options_file->set_filename($insert_id . $products_options_file->filename);
                                       if (!($products_options_file->save())) {
                                         break 2;
                                       }
                                     } else {
                                       break 2;
                                     }
                                   } else { // No file uploaded -- use previously uploaded file (From Dropdown)
                                     $real_ids[TEXT_PREFIX . $HTTP_POST_VARS[uPLOAD_PREFIX . $i]] = $HTTP_POST_VARS[TEXT_PREFIX . UPLOAD_PREFIX . $i];
                                   }
                                 }
                               }
                               //EOF - Zappo - Option Types v2 - File uploading: save uploaded files with unique file names, in the proper folder
                               //BOF - Zappo - Option Types v2 - ONE LINE - Replace the posted array with the processed one.

						    $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $real_ids))+1, $real_ids);



// Peter Milner                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;

 

My question is, can anyone advise me on how best to merge these two contributions?

 

Thanks!

Peter.

Link to comment
Share on other sites

  • 3 months later...

Help needed!

This is really a great contribution but like many one else i have a problem with accept offer directly turned true.

The customer has to make the offer without tax to see the right price in the shopping cart.

Something with the tax calculation is wrong. I have 19% tax and when the customer enters a offer for example: 50.- EUR

The shopping cart shows 59,5.- EUR

Ideas or solutions? Thanks.

getshoes.de your Streetwear Store

Link to comment
Share on other sites

  • 3 months later...

Help needed!

This is really a great contribution but like many one else i have a problem with accept offer directly turned true.

The customer has to make the offer without tax to see the right price in the shopping cart.

Something with the tax calculation is wrong. I have 19% tax and when the customer enters a offer for example: 50.- EUR

The shopping cart shows 59,5.- EUR

Ideas or solutions? Thanks.

 

Hello,

 

Have you find the solution of this problem? Please help me.

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