Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Seperate Price Per Customer


Recommended Posts

I had the advanced actual attribute working fine, however after installing the separate price per customer contribution, my attributes are all messed up. Im getting negative prices, and other glitches, does anyone know how to install the seperate price per customer with the actual attributes contribution!?

Link to comment
Share on other sites

Alright - My attributes are working fine now (Deleted product and added it again after installation of of SPC) but when the total is calculated, it adds the price of the attributes to 0, not the price of the product. So if i select a 60 dollar attribute for a $140 product, the total will be 60. If i dont select any attribute, the total will be NEGATIVE $140.

Link to comment
Share on other sites

This is my classes/shopping_cart.php file - I know i got to adjust the attribute pricing to add on to the propper customer group.


// products price
       $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
       if ($product = tep_db_fetch_array($product_query)) {
         $prid = $product['products_id'];
         $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
         $products_price = $product['products_price'];
         $products_weight = $product['products_weight'];

         // BOF Separate Pricing Per Customer
/*         $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");

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

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

// attributes price

// phpmom.com advanced attribute price
if (isset($this->contents[$products_id]['attributes'])) {
while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
$attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
$attribute_price = tep_db_fetch_array($attribute_price_query);
if ($attribute_price['price_prefix'] == '+') {
$this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
} elseif ($attribute_price['price_prefix'] == '-') {
$this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);
elseif ($attribute_price['price_prefix'] == '')
//comment where you see //'0' if want '0' value
// if ($attribute_price['options_values_price'] == '0') { //'0'
// $this->total += 0; //'0'
// } //'0'

// if ($attribute_price['options_values_price'] != '0') { //'0'
$this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax) * $qty - (tep_add_tax($products_price, $products_tax) * $qty);

// }//'0'
}else $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax);


Link to comment
Share on other sites

Are you sure this modification is actually working correctly? I just checked the website mentioned in a post of the Actual Attribute Price V1.0 forum and saw that if I added two attributes of $50.00 each on product 88 (base price $ 305) it would show a total of $ 505 and a sub-total of $ 405 on the shopping_cart.php page and also $ 405 in the shopping cart box. I'm not impressed :(

Link to comment
Share on other sites

It used to work when i added a new product, or when I edited it, but since i installed SPPC I can only modify the attributes when I go to product attributes under catalog in the admin. I'm thinking about getting rid of this contrib, hope it doesnt mess anything up :o

Link to comment
Share on other sites

Did you also make the change in includes/classes/order.php?

9b-for customer group pricing only
'final_price' => $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id']));
 'final_price' => $products[$i]['final_price'], //phpmom.com//aap

The code mentioned in the install instructions don't mention which customer group pricing contribution is meant and which file to change, but it matches code in order.php.

Link to comment
Share on other sites

I changed it - but my instructions where different, is there an update? If that is what I have to change for the final price, what should i have for 9.a? THANKS ALOT for your help.


My instructions for customer groups is:


9a- for customer group pricing only
if ($orders_customers = tep_db_fetch_array($orders_customers_price)) {
if (isset($cart->contents[$products[$i]['id']]['attributes'])) {
if ($cart->attributes_prefix($products[$i]['id']) == ''){
$grp_final_price = $cart->attributes_price($products[$i]['id']);
} else
$grp_final_price = ($orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id']));
}else $grp_final_price = ($products[$i]['price']); //eof actual attribute//hadir

9b-for customer group pricing only
'final_price' => $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id']));
'final_price' => $grp_final_price); //PHPMOM.COM AAP

Link to comment
Share on other sites

That part was removed in version 1.41.


o - i had 4.2 and it said to do that..anyways I did what you did - its working - but im still having this problem where when I add an item to the shopping cart when im logged out, and then I log in as a distributor, only the attributes are added and not the price of the product, so if i have a $15 attribute on a $150 product - my shopping cart will have a total of $15?


Can the error be in my shopping_cart class?

Edited by sondun2001
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.

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