Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted (edited)

Hello,

 

After a lot of problems and trying to install again and again for at least 10 times, i cleared almost all they issues, there's only one left...

 

In my categorie overview my dealerprices are shown without bying logged in as retailer or dealer!

 

After login as a dealer, for example:

Akku bag: 8.19 (correct dealer price without taxes), but when i go to my shoppingcart it shows up as:

Akku bag: 12.61 (customer price without taxes).

 

After login as a retailer, for example:

Akku bag: 15.00 (correct retail price with taxes), and when i go to my shoppingcart it shows up correctly:

Akku bag: 15.00 (customer price with taxes).

 

And when i log out as a retailer and go back to the categorie overview, i see Akku bag 15.00 as it should.

 

Can someone help my fix this? Cause i get sick and bored with this contri ;-).

 

Thanks a lot!

Edited by wendyv
Posted (edited)

Hello,

 

After a lot of problems and trying to install again and again for at least 10 times, i cleared almost all they issues, there's only one left...

 

In my categorie overview my dealerprices are shown without bying logged in as retailer or dealer!

 

After login as a dealer, for example:

Akku bag: 8.19 (correct dealer price without taxes), but when i go to my shoppingcart it shows up as:

Akku bag: 12.61 (customer price without taxes).

 

After login as a retailer, for example:

Akku bag: 15.00 (correct retail price with taxes), and when i go to my shoppingcart it shows up correctly:

Akku bag: 15.00 (customer price with taxes).

 

And when i log out as a retailer and go back to the categorie overview, i see Akku bag 15.00 as it should.

 

Can someone help my fix this? Cause i get sick and bored with this contri ;-).

 

Thanks a lot!

 

I've got the issues solved, exept for one small detail within classes/shopping_cart.

The manual says that i need to replace the following code:

Lines 276-290 [364-378 in edited file]
**REPLACE**
// attributes price
       if (isset($this->contents[$products_id]['attributes'])) {
         reset($this->contents[$products_id]['attributes']);
         while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
           $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$prid . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'");
           $attribute_price = tep_db_fetch_array($attribute_price_query);
           if ($attribute_price['price_prefix'] == '+') {
             $this->total += $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
           } else {
             $this->total -= $currencies->calculate_price($attribute_price['options_values_price'], $products_tax, $qty);
           }
         }
       }
     }
   }

 

With:

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

 

But my code is a bit different, what causes that the attribute + price is not right.

My code is:

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

 

The piece that is different are the two rows which start with:

$this->total += $qty

Can someone help my to fix my file correctly?

 

Thanks a lot!!!!!!

Edited by wendyv

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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