Jump to content

jbnova

Members
  • Content count

    22
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    Justin Beckman
  1. The problem is with products.
  2. I've installed the contribution, and everything "looks" as it should, however the admin isn't saving my sort settings. I can go into the admin, click on "sort order" and enter numbers/values for the order I want, but when I click "save sort" it just returns to the previous page with blank text fields. I'm assuming that the sort order I entered should be saved and appear in the text boxes? As a result, there's also no change to the sort order of the products on the front-end of the site. Any suggestions on which files I should trouble shoot? I'm not getting any errors, and I've made the following entry into my SQL. ALTER TABLE products ADD products_sort_order INT( 4 ) DEFAULT '0' NOT NULL; INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('', 'PRODUCT_LIST_SORT_ORDER', '6', '', '0', '', now()); Thanks!!
  3. I'm trying to use the "Add Weight To Product Attributes v0.1" and "Actual Attribute Price V1.0" contributions together. Has anyone else tried this? They both edit the same lines of code on shopping_cart.php and I'm having trouble mixing the two together. Here's what I'm trying to achieve: I have products that come in different sizes, with a different weight and price for each size. For example, the site sells dog food that comes 5lb, 10lb, and 15lb bags. I want the weights to be set up as attributes, so I don't have to list each size as a separate item with the catalog. When the optional size is selected, the additional weight needs to be calculated in the shipping. "Add Weight To Product Attributes v0.1" works perfect for this, however, I also want the "actual" price to appear in the dropdown menu, not + or -. "Add Weight To Product Attributes v0.1" requires this edit to shopping_cart.php around line 230: // attributes price // kumar@farmdev.com // add-weight-to-product-attributes mod: // added weight to db query 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, options_values_weight 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); } if(!empty($attribute_price['options_values_weight'])) { // kumar@farmdev.com // add-weight-to-product-attributes mod: $this->weight += ($qty * $attribute_price['options_values_weight']); } // END if(!empty($attribute_price['options_values_weight'])) { } } } } And "Actual Attribute Price V1.0" requires this edit around line 230: ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // BOF - AAP V1.2.1 - updated to account for no price prefix to equal actual price // attributes price if (!isset($this->contents[$products_id]['attributes'])) { $this->total += tep_add_tax($products_price, $products_tax) * $qty; } $this->weight += ($qty * $products_weight); } 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); $price_prefix = $attribute_price['price_prefix']; $option_price = $attribute_price['options_values_price']; $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); $products_price = $products_stuff['products_price']; if ($price_prefix == '+') { $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } if ($price_prefix == '-') { $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } if ($price_prefix == '') { if ($attribute_price['options_values_price'] == '0') $this->total += tep_add_tax($products_price, $products_tax) * $qty; } if ($attribute_price['options_values_price'] > '0') { if ($price_prefix == '') { if (ceil($option_price) != ceil($products_price)) { $this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax) * $qty; } else { $this->total += tep_add_tax($products_price, $products_tax) * $qty; $this->total += tep_add_tax(tep_adjust_price($option_price, $products_price), $product_tax) * $qty; } } } } } } } // subtotal function for attributes price function attributes_price($products_id) { $attributes_price = 0; 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)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); $price_prefix = $attribute_price['price_prefix']; $option_price = $attribute_price['options_values_price']; $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); $products_price = $products_stuff['products_price']; //Check for special price $products_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); if($products_stuff['specials_new_products_price'] != ''){ $products_price = $products_stuff['specials_new_products_price']; } if ($price_prefix == '+') { $attributes_price += $option_price; } if ($price_prefix == '-') { $attributes_price -= $option_price; } if (($price_prefix == '') and ($option_price > 0)) $attributes_price += tep_adjust_price($option_price,$products_price); else $attributes_price+= $option_price; } } return $attributes_price; } // EOF - AAP V1.2.1 ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// Here's my failed attempt to combine the two (you'll notice the code for the "add weight" contribution added in the middle): ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// // BOF - AAP V1.2.1 - updated to account for no price prefix to equal actual price // attributes price if (!isset($this->contents[$products_id]['attributes'])) { $this->total += tep_add_tax($products_price, $products_tax) * $qty; } $this->weight += ($qty * $products_weight); } 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, options_values_weight 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); $price_prefix = $attribute_price['price_prefix']; $option_price = $attribute_price['options_values_price']; $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); $products_price = $products_stuff['products_price']; if ($price_prefix == '+') { $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } if ($price_prefix == '-') { $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } if ($price_prefix == '') { if ($attribute_price['options_values_price'] == '0') $this->total += tep_add_tax($products_price, $products_tax) * $qty; } if ($attribute_price['options_values_price'] > '0') { if ($price_prefix == '') { if (ceil($option_price) != ceil($products_price)) { $this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax) * $qty; } else { $this->total += tep_add_tax($products_price, $products_tax) * $qty; $this->total += tep_add_tax(tep_adjust_price($option_price, $products_price), $product_tax) * $qty; } if(!empty($attribute_price['options_values_weight'])) { // kumar@farmdev.com // add-weight-to-product-attributes mod: $this->weight += ($qty * $attribute_price['options_values_weight']); } // END if(!empty($attribute_price['options_values_weight'])) { } } } } } } // subtotal function for attributes price function attributes_price($products_id) { $attributes_price = 0; 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)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); $price_prefix = $attribute_price['price_prefix']; $option_price = $attribute_price['options_values_price']; $products_query = tep_db_query("select products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); $products_price = $products_stuff['products_price']; //Check for special price $products_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$products_id . "'"); $products_stuff = tep_db_fetch_array($products_query); if($products_stuff['specials_new_products_price'] != ''){ $products_price = $products_stuff['specials_new_products_price']; } if ($price_prefix == '+') { $attributes_price += $option_price; } if ($price_prefix == '-') { $attributes_price -= $option_price; } if (($price_prefix == '') and ($option_price > 0)) $attributes_price += tep_adjust_price($option_price,$products_price); else $attributes_price+= $option_price; } } return $attributes_price; } // EOF - AAP V1.2.1 ///////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////// Any suggestions? Thanks!
×