Jump to content

osik

Members
  • Content count

    19
  • Joined

  • Last visited

1 Follower

Profile Information

  • Real Name
    os
  1. To MikeMike: I 've changed in awb_pb.php those lines: if (tep_not_null($product_info['specials_new_products_price'])) { return $product_info['specials_new_products_price']; } for: if (tep_not_null($product_info['specials_new_products_price'])) { $price = $product_info['specials_new_products_price']; }else{ $price = $product_info['products_price']; // DEFAULT PRICE } and in classes/shopping_cart.php i've deactivated this section of code: $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']; } after this everything working fine...
  2. after changing the query section of last version awb_pb.php for: $product_info_query = tep_db_query("SELECT p.products_qty_blocks,p.products_price," . "p.products_price1,p.products_price2,p.products_price3,p.products_price4," . "p.products_price1_qty_from,p.products_price2_qty_from,p.products_price3_qty_from ,p.products_price4_qty_from," . "p.products_price1_qty_to,p.products_price2_qty_to,p.products_price3_qty_to,p.pro ducts_price4_qty_to," . "IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price " . "FROM ". TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id WHERE " . "p.products_status = '1' AND p.products_id = '" . (int)$product_id. "'"); everything working fine ! )... ? to be continue...
  3. ((( the last update of this contrib - new version of awb_pb.php does not working ... am i only one unlucky... i hope that author are testing this update before publishing, but i see only "0" in the list in shopping cart and in line "total" only price of product with special price without adding price of product with regular price, when presents in shopping cart too.
  4. Thanks for responce Andrew: i've spent time in nervous waiting, like variant i've found simple solution at this manner - i repeat special price from specials section in admin to "Price break level 1:" field in products info section the same in admin. After this shopping cart shows prices correct. But one disadvantage, if for example: price q-ty1 q-ty2 Price break level 1: 20.50 1 0 Price break level 2: 19.00 2 5 in shop customer will see: 1+ 20.50 2-5 19.00 Hope, together we will win )))
  5. yes, absolutely the same. i've wrote to author of this contrib, but have no answer(((
  6. Maybe somebody found this before me and know the answer... I am using AWB Quantity Price Breaks Per Product. The question is - if products has specials price, in shopping cart this price shows only in line total. I think that suspected failure located in awb_pb.php. I've try to correct it, but without positive result (. Hope for assistance.
  7. I did it! Awb + Discount groups = working! Uffff...) Thanks again LazyCat for this !working contrib. Forzza!
  8. i've found were my problem is... i've instaled ABW Price Breaks Per Quantity contribution - without this mod lines in some files your contribution is lookinf like fool working. is it possible to combine your mod with ABW mod...
  9. little addon wrom me - boxes/whats_new.php */ if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) { ?> <!-- whats_new //--> <tr> <td> <?php $random_product['products_name'] = tep_get_products_name($random_product['products_id']); $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']); $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW); new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW)); $category = tep_get_best_category_discount($random_product["products_id"]); $price = $random_product['products_price']; if ($category >= 0 ) { $discount = tep_get_discount($category); if ($discount > 0) $price = $price - ($price/100)*$discount; } if (tep_not_null($random_product['specials_new_products_price'])) { $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>'; $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($price, tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>'; } else { $whats_new_price = $currencies->display_price($price, tep_get_tax_rate($random_product['products_tax_class_id'])); } $info_box_contents = array(); $info_box_contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=' . $category . 'products_id=' . $random_product['products_id'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id'], 'NONSSL') . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price); new infoBox($info_box_contents); ?> </td> </tr> <!-- whats_new_eof //--> <?php } ?> when special price presents - shown like for default group without discount i'll try to change new_products.php too !!! help pls with shopping cart above mentioned problem my shopping_card.php, pls look at this: <?php /* $Id: shopping_cart.php,v 1.32 2003/02/11 00:04:53 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 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; if (!tep_session_is_registered('customer_id')) return false; // insert current cart contents in database if (is_array($this->contents)) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; $cat = $this->contents[$products_id]['cat']; $product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "' and products_id = '" . $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, category_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $qty . "', '" . date('Ymd'). "','" . $cat . "')"); if (isset($this->contents[$products_id]['attributes'])) { for ($cont = 0; $cont < sizeof($this->contents[$products_id]['attributes']) ; $cont++) { reset($this->contents[$products_id]['attributes'][$cont]); while (list($option, $value) = each($this->contents[$products_id]['attributes'][$cont])) { tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $option . "', '" . $value . "')"); } } } } else { tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set category_id = '". $cat ."', customers_basket_quantity = '" . $qty . "' where customers_id = '" . $customer_id . "' and products_id = '" . $products_id . "'"); } } } // reset per-session cart contents, but not the database contents $this->reset(false); $products_query = tep_db_query("select products_id, customers_basket_quantity from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . $customer_id . "'"); while ($products = tep_db_fetch_array($products_query)) { $this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']); // attributes $attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "' and products_id = '" . $products['products_id'] . "'"); $contatore = 0; while ($attributes = tep_db_fetch_array($attributes_query)) { $this->contents[$products['products_id']]['attributes'][$contatore++][$attributes['products_options_id']] = $attributes['products_options_value_id']; } } $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 = '" . $customer_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "'"); } unset($this->cartID); if (tep_session_is_registered('cartID')) tep_session_unregister('cartID'); } function add_cart($products_id, $qty = '1', $attributes = '', $category_id, $notify = true) { global $new_products_id_in_cart, $customer_id; $products_id = tep_get_uprid($products_id, $attributes); if ($notify == true) { $new_products_id_in_cart = $products_id; tep_session_register('new_products_id_in_cart'); } if ($this->in_cart($products_id)) { $this->update_quantity($products_id, $qty, $attributes); } else { $this->contents[] = array($products_id); $this->contents[$products_id] = array('qty' => $qty, 'cat' => $category_id); // 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, category_id) values ('" . $customer_id . "', '" . $products_id . "', '" . $qty . "', '" . date('Ymd') . "','" . $category_id . "')"); if (is_array($attributes)) { reset($attributes); $contatore = 0; while (list( , $option_value) = each($attributes)) { $option_value2 = split('[{}]',$option_value); for ($i = 1; $i < sizeof($option_value2) ; $i+=2) { $option = $option_value2[$i]; $value = $option_value2[$i+1]; $attribute_price_query = tep_db_query("select options_values_qty, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if (strchr($attribute_price['price_prefix'],'m')) { if ($this->contents[$products_id]['qty'] < $attribute_price['options_values_qty']) $this->contents[$products_id]['qty'] = $attribute_price['options_values_qty']; } if (strchr($attribute_price['price_prefix'],'M')) { if ($this->contents[$products_id]['qty'] > $attribute_price['options_values_qty']) $this->contents[$products_id]['qty'] = $attribute_price['options_values_qty']; } $this->contents[$products_id]['attributes'][$contatore++][$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 ('" . $customer_id . "', '" . $products_id . "', '" . $option . "', '" . $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(); } function update_quantity($products_id, $quantity = '', $attributes = '') { global $customer_id; if (empty($quantity)) return true; // nothing needs to be updated if theres no quantity, so we return true.. $this->contents[$products_id] = array('qty' => $quantity); // update database if (tep_session_is_registered('customer_id')) tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set category_id = '". $cat ."', customers_basket_quantity = '" . $quantity . "' where customers_id = '" . $customer_id . "' and products_id = '" . $products_id . "'"); if (is_array($attributes)) { reset($attributes); $contatore = 0; while (list( , $option_value) = each($attributes)) { $option_value2 = split('[{}]',$option_value); for ($i = 1; $i < sizeof($option_value2) ; $i+=2) { $option = $option_value2[$i]; $value = $option_value2[$i+1]; $attribute_price_query = tep_db_query("select options_values_qty, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if (strchr($attribute_price['price_prefix'],'m')) { if ($this->contents[$products_id]['qty'] < $attribute_price['options_values_qty']) $this->contents[$products_id]['qty'] = $attribute_price['options_values_qty']; } if (strchr($attribute_price['price_prefix'],'M')) { if ($this->contents[$products_id]['qty'] > $attribute_price['options_values_qty']) $this->contents[$products_id]['qty'] = $attribute_price['options_values_qty']; } $this->contents[$products_id]['attributes'][$contatore++][$option] = $value; } } } } 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 = '" . $customer_id . "' and products_id = '" . $key . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "' and products_id = '" . $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; 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 = '" . $customer_id . "' and products_id = '" . $products_id . "'"); tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . $customer_id . "' and products_id = '" . $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(); } 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() { $this->total = 0; $this->weight = 0; if (!is_array($this->contents)) return 0; reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; $cat = $this->contents[$products_id]['cat']; // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id='" . tep_get_prid($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']); // AWB+ PRICE-BREAK $products_price = awb_pb_get_price(tep_get_prid($products_id), $qty); // AWB- PRICE-BREAK $products_weight = $product['products_weight']; $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']; } global $customer_id; $and = ""; if ($customer_id != null) { $and = " and customers_id=" . $customer_id; } $products_discount_query = tep_db_query("select category_id from " . TABLE_CUSTOMERS_BASKET . " where products_id=" . $prid . $and); $category_id = tep_db_fetch_array($products_discount_query); $discount = tep_get_discount($category_id['category_id']); $products_price = $products_price - ($products_price/100)*$discount; $this->total += tep_add_tax($products_price, $products_tax) * $qty; $this->weight += ($qty * $products_weight); } // attributes price if (isset($this->contents[$products_id]['attributes'])) { for ($cont = 0; $cont < sizeof($this->contents[$products_id]['attributes']) ; $cont++) { reset($this->contents[$products_id]['attributes'][$cont]); while (list($option, $value) = each($this->contents[$products_id]['attributes'][$cont])) { $attribute_price_query = tep_db_query("select options_values_qty, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $prid . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if (strchr($attribute_price['price_prefix'],'+')) { $this->total += $qty * tep_add_tax(tep_prefix_options($attribute_price['price_prefix'],$attribute_price['options_values_price'],$attribute_price['options_values_qty'],$qty), $products_tax); } else if (strchr($attribute_price['price_prefix'],'-')) { $this->total -= $qty * tep_add_tax(tep_prefix_options($attribute_price['price_prefix'],$attribute_price['options_values_price'],$attribute_price['options_values_qty'],$qty), $products_tax); } } } } } } function attributes_price($products_id) { if (isset($this->contents[$products_id]['attributes'])) { for ($cont = 0; $cont < sizeof($this->contents[$products_id]['attributes']) ; $cont++) { reset($this->contents[$products_id]['attributes'][$cont]); while (list($option, $value) = each($this->contents[$products_id]['attributes'][$cont])) { $attribute_price_query = tep_db_query("select options_values_qty, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $products_id . "' and options_id = '" . $option . "' and options_values_id = '" . $value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if (strchr($attribute_price['price_prefix'],'+')) { $attributes_price += tep_prefix_options($attribute_price['price_prefix'],$attribute_price['options_values_price'],$attribute_price['options_values_qty'],$this->contents[$products_id]['qty']); } else if (strchr($attribute_price['price_prefix'],'-')) { $attributes_price -= tep_prefix_options($attribute_price['price_prefix'],$attribute_price['options_values_price'],$attribute_price['options_values_qty'],$this->contents[$products_id]['qty']); } } } } return $attributes_price; } 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']; } global $customer_id; $and = ""; if ($customer_id != null) { $and = " and customers_id=" . $customer_id; } $products_discount_query = tep_db_query("select category_id from " . TABLE_CUSTOMERS_BASKET . " where products_id=" . $prid. $and); $category_id = tep_db_fetch_array($products_discount_query); $discount = tep_get_discount($category_id['category_id']); $products_price = $products_price - ($products_price/100)*$discount; $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; } 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 = '" . $products_id . "' and pa.options_values_id = '" . $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']; } } } ?>
  10. ))) and dont forget about new_products.php
  11. the same question about price in new/last added products box... and ((( products in shoping cart showing with prices without discount, only in line total - price with discount
  12. ok, i'll try it tell pls about price in last added product section - are there prices must be shown with group dicsount or not, because now are shown without discount?
  13. !!! when changed $product_info_values in this block of code $price = $product_info_values['products_price']; if ($discount > 0) $price = $price - ($price/100)*$discount; $products_price = $currencies->display_price($price, tep_get_tax_rate($product_info_values['products_tax_class_id'])); for $product_info - price is showing all above conserning price in product_info.php hope that same solution in general.php
  14. Thank you for contribution. Pls help with zero price in default.php when showing list of category products & the same - zero price, in product_info.php...
×