Need a class file expert....Quantity calculation problem.

blueline <[email protected]> 13 Sep 2003 22:30:46 -0000
Newsgroups gmane.comp.web.oscommerce.general
Message-ID <159fd484c1f1ed625c3984c04c372927@osCommerce-Forums>
This message was sent from: General Support
http://forums.oscommerce.com/viewtopic.php?p=229100#229100
----------------------------------------------------------------

Hey. I am having a problem with the shopping cart class file. I have included my original code, as well as the modified code. I am getting a null value for the quantity on the modified code. 

Any ideas anyone.....please?

Thanks,
-Chris

[code]    function get_products() {
      global $languages_id;

      if (!is_array($this->contents)) return false;

      $products_array = array();
      reset($this->contents);
      while (list($products_id, ) = each($this->contents)) {
        $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . tep_get_prid($products_id) . "' and pd.products_id = p.products_id and pd.language_id = '" . $languages_id . "'");
        if ($products = tep_db_fetch_array($products_query)) {
          $prid = $products['products_id'];
          $products_price = $products['products_price'];

          $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $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'];
          }

          $products_array[] = array('id' => $products_id,
                                    'name' => $products['products_name'],
                                    'model' => $products['products_model'],
                                    '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' => $this->contents[$products_id]['attributes']);
        }
      }

      return $products_array;
    }[/code]



And this is what I am trying to use:
[code]    function get_profiles() {

      if (!is_array($this->contents)) return false;
	  
      $profiles_array = array();
      reset($this->contents);
      while (list($profiles_id, ) = each($this->contents)) {
        $profiles_query = tep_db_query("select mi.profiles_id, m.members_firstname, m.members_lastname, mi.profiles_tax_class_id from " . TABLE_MEMBERS . " m, " . TABLE_MEMBERS_INTERESTS . " mi where mi.members_id='" . tep_get_prid($profiles_id) . "' and m.members_id = mi.members_id");
        if ($profiles = tep_db_fetch_array($profiles_query)) {
          $prid = $profiles['profiles_id'];
          $profiles_price = PROFILE_PRICE;

          $profiles_array[] = array('id' => $profiles_id,
                                    'name' => $profiles['members_firstname'] . " " . $profiles['members_lastname'],
                                    'price' => $profiles_price,
                                    'quantity' => $this->contents[$profiles_id]['qty'],
                                    'final_price' => ($profiles_price),  
                                    'tax_class_id' => $profiles['profiles_tax_class_id']);
        }
      }
      return $profiles_array;
    }[/code]


Thanks again!!!