Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

shaggy2dope2125

Pioneers
  • Posts

    23
  • Joined

  • Last visited

Everything posted by shaggy2dope2125

  1. I know a few people have been asking weather or not this works with 2.3.1. I am currently working on modding the addon to do so. So far i have gotten the system to work on the customer side. I haven't gotten the admin side done yet. Once I am done, ill be sure to update the install instructions to reflect all the changes.
  2. I was up all night recoding my mod and finally got it to work. The problem is that when ever item_model, the mod, is installed im not able to select it as a shipping option, the radio button doesn't get displayed. If i have another mod installed, flat, both of them show up and the radio buttons show up next to both of them also. i can select either one of the mods, but flat will be the one that gets sent to checkout_conformation.php. If Item_model is the only one enabled i can not get past the checkout_shipping page. <?php /* $Id: item_model.php, V 1.0 2005/14.09 05:03:31 hpd1 Exp $ Written by Kevin Myers, [email protected] osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2003 osCommerce Copyright ? 2005 Magickoncepts.com Released under the GNU General Public License */ class item_model { var $code, $title, $description, $icon, $enabled; // class constructor function item_model() { global $order; $this->code = 'item_model'; $this->title = MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE; $this->description = MODULE_SHIPPING_ITEM_MODEL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ITEM_MODEL_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_ITEM_MODEL_STATUS == 'True') ? true : false); $this->num_zones = 5; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_MODEL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("SELECT zone_id FROM " . TABLE_ZONE__TO_GEO_ZONES . " WHERE geo_zone_id = '" . MODULE_SHIPPING_ITEM_MODEL_ZONE . "' and zone_county_id '" . $order->delivery['country']['id'] . "' ORDER BY zode_id"); while ($check = tep_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $total_count, $order_id, $oID, $cartID, $customer_id; $dest_country = $order->delivery['country']['iso_code_2']; $dest_zone = 0; $error1 = false; for ($i=1; $s<=$this->num_zones; $i++) { $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); $country_zones = split("[,]", $countries_table); if(in_Array($dest_country, $country_zones)) { $dest_zone = $i; break; }//ends if statement }//ends for loop if ($dest_zone == 0) { for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); if ($countries_table == '' or $countries_table == '*') { $dest_zone = $i; break; } } } if ($dest_zone == 0) { $error1 = true; } $this->Cart_contents = tep_db_query("SELECT * FROM " . TABLE_CUSTOMERS_BASKET . " WHERE customers_id = '". (int)$customer_id."'"); $this->num_cards = mysql_num_rows($this->Cart_contents); $this->Cart_contents = tep_db_fetch_array($this->Cart_contents); for($x=1;$x<=$this->num_cards;$x++) { $this->productsID[$x] = $this->Cart_contents['products_id']; } $this->num_products = count($this->productsID); for($X=1;$X<=$this->num_products;$X++) { $product_Info = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS . " WHERE products_id = '". $this->productsID[$X]."'"); $this->products = tep_db_fetch_array($product_Info); if($this->products['products_model'] == 'single') { $singles_count++; } elseif($this->products['products_model'] == 'box') { $box_count++; } elseif($this->products['products_model'] == 'set') { $set_count++; } elseif($this->products['products_model'] == 'deck') { $deck_count++; } elseif($this->products['products_model'] == 'lot') { $lot_count++; } } if($singles_count < "30") { $shipping_singles = 1; } else { $shipping_singles = 1 + (($singles_count - "30")* .1); } $shipping_box = $box_count * 2; $shipping_set = $set_count * 2; $shipping_deck = $deck_count * 0.75; $shipping_lot = $lot_count * 2; $shipping_total = $shipping_singles + $shipping_box + $shipping_set + $shipping_deck + $shipping_lot; //this is where i set up the additional charge for each "zone" if($dest_zone == 1) { $shipping_total = $shipping_total; } elseif($dest_zone == 2) { $shipping_total = $shipping_total + ($shipping_total * .02); } elseif($dest_zone == 3) { $shipping_total = $shipping_total + ($shipping_total * .025); } elseif($dest_zone == 4) { $shipping_total = $shipping_total + ($shipping_total * .03); } elseif($dest_zone == 5) { $shipping_total = $shipping_total + ($shipping_total * .045); }//this ends the shipping totals for each zone $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_MODEL_TEXT_WAY, 'cost' => $shipping_total )//closes second array )//closes first aray );//closes the qutes array if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; }//ends the quote functions function check() { if (!isset($this->_check)) { $check_query = tep_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_SHIPPING_ITEM_MODEL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; }//ends check function function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Model Method', 'MODULE_SHIPPING_ITEM_MODEL_STATUS', 'True', 'Do you want to offer Model rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Tax Class', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Order', 'MODULE_SHIPPING_ITEM_MODEL_SORT_ORDER', '0', 'Sort Order of display.', '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { if ($i == 1) { $default_countries = 'US'; } elseif ($i == 2) { $default_countries = 'CA'; } elseif ($i == 3) { $default_countries = 'AT,BE,GB,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR'; } elseif ($i == 4) { $default_countries = 'JP,AU,NZ,SG'; } elseif ($i == 5) { $default_countries = 'TW,CN,HK'; }//ends the if statments for default countires //tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_" . $i ."', '" .$default_countries . "', 'Comma seprtated list of two character ISO country codes that are part of zone " . $i . ".', '6', '0', now())"); }//ends the for loop }//ends the install function function remove() { tep_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key in ('" . implode(" ', '", $this->keys()) . "')"); }//ends the remove function function keys() { $keys = array('MODULE_SHIPPING_ITEM_MODEL_STATUS', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', 'MODULE_SHIPPING_ITEM_MODEL_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_' . $i; }//ends the for loop return $keys; }//ends the keys function }//ends the modlue ?>
  3. ok. i figured that one out. now the problem is that with another shipping mod enabled, i can select mine and the other one will be the one that works. if its just mine installed it will not move to the next page. im lost on this one here.
  4. ok, i lied. heres the problem that i have encountered now. it works but will not display the option to select it as a shipping method. im unsure on how to solve this problem. code: <?php /* $Id: item_model.php, V 1.0 2005/14.09 05:03:31 hpd1 Exp $ Written by Kevin Myers, [email protected] osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2003 osCommerce Copyright ? 2005 Magickoncepts.com Released under the GNU General Public License */ class item_model { var $code, $title, $description, $icon, $enabled; // class constructor function item_model() { global $order; $this->code = 'item_model'; $this->title = MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE; $this->description = MODULE_SHIPPING_ITEM_MODEL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ITEM_MODEL_SORT_ODER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_ITEM_MODEL_STATUS == 'True') ? true : false); $this->num_zones = 5; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_MODEL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("SELECT zone_id FROM " . TABLE_ZONE__TO_GEO_ZONES . " WHERE geo_zone_id = '" . MODULE_SHIPPING_ITEM_MODEL_ZONE . "' and zone_county_id '" . $order->delivery['country']['id'] . "' ORDER BY zode_id"); while ($check = tep_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $total_count, $order_id, $oID, $cartID, $customer_id; $dest_country = $order->delivery['country']['iso_code_2']; $dest_zone = 0; $error1 = false; for ($i=1; $s<=$this->num_zones; $i++) { echo "LOOP 1"; $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); $country_zones = split("[,]", $countries_table); if(in_Array($dest_country, $country_zones)) { $dest_zone = $i; break; }//ends if statement }//ends for loop if ($dest_zone == 0) { for ($i=1; $i<=$this->num_zones; $i++) { ECHO "LOOP 2"; $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); if ($countries_table == '' or $countries_table == '*') { $dest_zone = $i; break; } } } if ($dest_zone == 0) { $error1 = true; } $this->Cart_contents = tep_db_query("SELECT * FROM " . TABLE_CUSTOMERS_BASKET . " WHERE customers_id = '". (int)$customer_id."'"); $this->num_cards = mysql_num_rows($this->Cart_contents); $this->Cart_contents = tep_db_fetch_array($this->Cart_contents); for($x=1;$x<=$this->num_cards;$x++) { $this->productsID[$x] = $this->Cart_contents['products_id']; } $this->num_products = count($this->productsID); for($X=1;$X<=$this->num_products;$X++) { $product_Info = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS . " WHERE products_id = '". $this->productsID[$X]."'"); $this->products = tep_db_fetch_array($product_Info); if($this->products['products_model'] == 'single') { $singles_count++; } elseif($this->products['products_model'] == 'box') { $box_count++; } elseif($this->products['products_model'] == 'set') { $set_count++; } elseif($this->products['products_model'] == 'deck') { $deck_count++; } elseif($this->products['products_model'] == 'lot') { $lot_count++; } } if($singles_count < "30") { $shipping_singles = 1; } else { $shipping_singles = 1 + (($singles_count - "30")* .1); } $shipping_box = $box_count * 2; $shipping_set = $set_count * 2; $shipping_deck = $deck_count * 0.75; $shipping_lot = $lot_count * 2; $shipping_total = $shipping_singles + $shipping_box + $shipping_set + $shipping_deck + $shipping_lot; //this is where i set up the additional charge for each "zone" if($dest_zone == 1) { $shipping_total = $shipping_total; } elseif($dest_zone == 2) { $shipping_total = $shipping_total + ($shipping_total * .02); } elseif($dest_zone == 3) { $shipping_total = $shipping_total + ($shipping_total * .025); } elseif($dest_zone == 4) { $shipping_total = $shipping_total + ($shipping_total * .03); } elseif($dest_zone == 5) { $shipping_total = $shipping_total + ($shipping_total * .045); }//this ends the shipping totals for each zone $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE, 'methodes' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_MODEL_TEXT_WAY, 'cost' => $shipping_total )//closes second array )//closes first aray );//closes the qutes array if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; }//ends the quote functions function check() { if (!isset($this->_check)) { $check_query = tep_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_SHIPPING_ITEM_MODEL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; }//ends check function function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Model shipping', 'MODULE_SHIPPING_ITEM_MODEL_STATUS', 'True', 'Do you want to offer model rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Tax Class', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Order', 'MODULE_SHIPPING_ITEM_MODEL_SORT_ORDER' , '0', 'Sort Order of display.', '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { if ($i == 1) { $default_countries = 'US'; } elseif ($i == 2) { $default_countries = 'CA'; } elseif ($i == 3) { $default_countries = 'AT,BE,GB,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR'; } elseif ($i == 4) { $default_countries = 'JP,AU,NZ,SG'; } elseif ($i == 5) { $default_countries = 'TW,CN,HK'; }//ends the if statments for default countires //tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_" . $i ."', '" .$default_countries . "', 'Comma seprtated list of two character ISO country codes that are part of zone " . $i . ".', '6', '0', now())"); }//ends the for loop }//ends the install function function remove() { tep_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key in ('" . implode(" ', '", $this->keys()) . "')"); }//ends the remove function function keys() { $keys = array('MODULE_SHIPPING_ITEM_MODEL_STATUS', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', 'MODELU_SHIPPING_ITEM_MODEL_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'MODULE_SHIPPING_ITEM_ZONES_COUNTRIES_' . $i; }//ends the for loop return $keys; }//ends the keys function }//ends the modlue ?>
  5. ignore this post. im a moron and didn't realize that i was looking for an order that didn't get placed yet. its all stored in the basket until i complete the order.
  6. ok, i got the addon to work now, but its not running the query for get the order. its telling me that the order id is zero.
  7. heres the code: <?php /* $Id: item_model.php, V 1.0 2005/14.09 05:03:31 hpd1 Exp $ Written by Kevin Myers, [email protected] osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Copyright ? 2005 Magickoncepts.com Released under the GNU General Public License */ class item_model { var $code, $title, $description, $icon, $enabled; // class constructor function item_model() { global $order; $this->code = 'item_model'; $this->title = MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE; $this->description = MODULE_SHIPPING_ITEM_MODEL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ITEM_MODEL_SORT_ODER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_ITEM_MODEL_STATUS == 'True') ? true : false); $this->num_zones = 5; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_MODEL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("SELECT zone_id FROM " . TABLE_ZONE__TO_GEO_ZONES . " WHERE geo_zone_id = '" . MODULE_SHIPPING_ITEM_MODEL_ZONE . "' and zone_county_id '" . $order->delivery['country']['id'] . "' ORDER BY zode_id"); while ($check = tep_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $total_count, $order_id; $dest_country = $order->delivery['country']['iso_code_2']; $dest_zone = 0; $error1 = false; for ($i=1; $s<=$this->num_zones; $i++) { $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); $country_zones = split("[,]", $countries_table); if(in_Array($dest_country, $country_zones)) { $dest_zone = $i; break; }//ends if statement }//ends for loop if ($dest_zone == 0) { for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); if ($countries_table == '' or $countries_table == '*') { $dest_zone = $i; break; } } } if ($dest_zone == 0) { $error1 = true; } $orders_products_query = tep_db_query("SELECT orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price FROM ". TABLE_ORDER_PRODUCTS. "WHERE order_id = '" . (int)$orders_id ."'"); $num_orders = mysql_num_rows($orders_products_query); $x = 0; while($orders_products = tep_db_fetch_array($orders_product_query)) { $this->products[$x] = array( 'qty' => $orders_products['products_quantity'], 'id' => $orders_products['products_id'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['produacts_price'], 'final_price' => $orders_products['final_price']); $x++; } for($X = 0; $X <= $num_orders; $X++) { if($this->products[$X]['model'] == 'single') { $singles_count++; } elseif($this->products[$X]['model'] == 'box') { $box_count++; } elseif($this->products[$X]['model'] == 'set') { $set_count++; } elseif($this->products[$X]['model'] == 'deck') { $deck_count++; } elseif($this->products[$X]['model'] == 'lot') { $lot_count++; } } if($singles_count < "30") { $shipping_singles = 1; } else { $shipping_singles = 1 + ($shipping_count - "30")* ".1"; } $shipping_box = $box_count * 2; $shipping_set = $set_count * 2; $shipping_deck = $deck_count * 0.75; $shipping_lot = $lot_count * 2; $shipping_total = $shipping_singles + $shipping_box + $shipping_set + $shipping_deck + $shipping_lot; //this is where i set up the additional charge for each "zone" if($dest_zone == 1) { $shipping_total = $shipping_total; } elseif($dest_zone == 2) { $shipping_total = $shipping_total + ($shipping_total * .02); } elseif($dest_zone == 3) { $shipping_total = $shipping_total + ($shipping_total * .025); } elseif($dest_zone == 4) { $shipping_total = $shipping_total + ($shipping_total * .03); } elseif($dest_zone == 5) { $shipping_total = $shipping_total + ($shipping_total * .045); }//this ends the shipping totals for each zone define ("MODULE_SHIPPING_ITEM_MODEL_COST", $shipping_total); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE, 'methodes' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_MODEL_TEXT_WAY, 'cost' => MODULE_SHIPPING_ITEM_MODEL_COST )//closes second array )//closes first aray );//closes the qutes array if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; }//ends the quote functions function check() { if (!isset($this->_check)) { $check_query = tep_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_SHIPPING_ITEM_MODEL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; }//ends check function function install() { tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Model Shipping', 'MODULE_SHIPPING_ITEM_MODEL_STATUS', 'True', 'Do you want to offer model shipping rates?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Tax Class', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Order', 'MODULE_SHIPPING_ITEM_MODEL_SORT_ORDER' , '0', 'Sort Order of display.', '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { if ($i == 1) { $default_countries = 'US'; } elseif ($i == 2) { $default_countries = 'CA'; } elseif ($i == 3) { $default_countries = 'AT,BE,GB,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR'; } elseif ($i == 4) { $default_countries = 'JP,AU,NZ,SG'; } elseif ($i == 5) { $default_countries = 'TW,CN,HK'; }//ends the if statments for default countires //tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_" . $i ."', ' .$default_countries . ', 'Comma seprtated list of two character ISO country codes that are part of zone " . $i . ".', '6', '0', now())"); }//ends the for loop }//ends the install function function remove() { tep_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key in ('" . implode(" ', '", $this->keys()) . "')"); }//ends the remove function function keys() { $keys = array('MODULE_SHIPPING_ITEM_MODEL_STATUS', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', 'MODELU_SHIPPING_ITEM_MODEL_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'MODULE_SHIPPING_ITEM_ZONES_COUNTRIES_' . $i; }//ends the for loop return $keys; }//ends the keys function }//ends the modlue ?> it installs, but under the admin section it doesn't display a sort order, so thats messed up also. but when i try to place an order it tell me that MODULE_SHIPPING_ITEM_ZONES_COUNTIRES_ isn't there. heres the error from the page: Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_6 in /home/ravenslo/public_html/catalog/includes/modules/shipping/item_model.php on line 63 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '0'' at line 1 SELECT orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price FROM TABLE_ORDER_PRODUCTSWHERE order_id = '0' [TEP STOP] im lost, been trying to fix it for a few days now. thanks. edit: i fixed the space problem in the SELECT statement, but now it throws itself into a never ending loop of the MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_
  8. nevermind this post. i have figured it out on my own.
  9. im setting up a store that sells magic:the gathering cards. there are alot of cards that are printed in many of the 63 sets of cards that have been released. what i'm needing is a way to add the category name to the invoice and the order page that i view and print off so that i can make sure that my customer gets the right card.
  10. every time i try to install my module, nothing happens, the page refreshes, but nothing is displayed about it being install. here is the code if it helps <?php /* $Id: item_model.php, V 1.0 2005/14.09 05:03:31 hpd1 Exp $ Written by Kevin Myers, [email protected] osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright ? 2003 osCommerce Copyright ? 2005 Magickoncepts.com Released under the GNU General Public Licensee */ class item_model { var $code, $title, $description, $icon, $enabled, $num_zones; // class constructor function item_model() { global $order; $this->code = 'item_model'; $this->title = MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE; $this->description = MODULE_SHIPPING_ITEM_MODEL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ITEM_MODEL_SORT_ODER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_ITEM_MODEL_STATUS == 'True') ? true : false); $this->num_zones = 5; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_MODEL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("SELECT zone_id FROM " . TABLE_ZONE__TO_GEO_ZONES . " WHERE geo_zone_id = '" . MODULE_SHIPPING_ITEM_MODEL_ZONE . "' and zone_county_id '" . $order->delivery['country']['id'] . "' ORDER BY zode_id"); while ($check = tep_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = ''){ global $order, $total_count, $order_id; $dest_country = $oder->delivery['country']['iso_code_2']; $dest_zone = 0; $error1 = false; $error2 = false; for ($i=1; $s<=$this->num_zones; $i++) { $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); $country_zones = split("[,]", $countries_table); if(in_Array($dest_country, $country_zones)) { $dest_zone = $i; break; }//ends if statement }//ends for loop if ($dest_zone == 0) { for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); if ($countries_table == '' or $countries_table == '*') { $dest_zone = $i; break; } } } if ($dest_zone == 0) { $error1 = true; } $orders_products_query = tep_db_query("SELECT orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price FROM ". TABLE_ORDERS_PRODUCTS . " WHERE orders_id = '" . (int)$orders_id ."'"); $num_orders = mysql_num_rows($orders_products_query); $x = 0; while($orders_products = tep_db_fetch_array($orders_product_query)) { $this->products[$x] = array( 'qty' => $orders_products['products_quantity'], 'id' => $orders_products['products_id'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['produacts_price'], 'final_price' => $orders_products['final_price']); $x++; } for($X = 0; $X <= $num_orders; $X++) { if($this->products[$X]['model'] == 'single') { $singles_count++; } elseif($this->products[$X]['model'] == 'box') { $box_count++; } elseif($this->products[$X]['model'] == 'set') { $set_count++; } elseif($this->products[$X]['model'] == 'deck') { $deck_count++; } elseif($this->products[$X]['model'] == 'lot') { $lot_count++; } } if($singles_count < "30") { $shipping_singles = 1; } else { $shipping_singles = 1 + ($shipping_count - "30")* ".1"; } $shipping_box = $box_count * 5; $shipping_set = $set_count * 7.50; $shipping_deck = $deck_count * 2.50; $shipping_lot = $lot_count * 4; $shipping_total = $shipping_singles + $shipping_box + $shipping_set + $shipping_deck + $shipping_lot; //this is where i set up the additional charge for each "zone" if($dest_zone == 1) { $shipping_total = $shipping_total; } elseif($dest_zone == 2) { $shipping_total = $shipping_total + ($shipping_total * .02); } elseif($dest_zone == 3) { $shipping_total = $shipping_total + ($shipping_total * .025); } elseif($dest_zone == 4) { $shipping_total = $shipping_total + ($shipping_total * .03); } elseif($dest_zone == 5) { $shipping_total = $shipping_total + ($shipping_total * .045); }//this ends the shipping totals for each zone define ("MODULE_SHIPPING_ITEM_MODEL_COST", $shipping_total); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE, 'methodes' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_MODEL_TEXT_WAY, //this is the point that i need to figure out if the items are singles or boxes 'cost' => MODULE_SHIPPING_ITEM_MODEL_COST )//closes second array )//closes first aray );//closes the qutes array if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_ir']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; }//ends the quote functions function check() { if (!isset($this->_check)) { $check_query = tep_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_SHIPPING_ITEM_MODEL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; }//ends check function function install() { tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Model Shipping', 'MODULE_SHIPPING_ITEM_MODEL_STATUS', 'True', 'Do you want to offer model shipping rates?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Tax Class', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Order', 'MODULE_SHIPPING_ITEM_MODEL_SORT_ORDER' , '0', 'Sort Order of display.', '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { $default_countries = ''; if ($i == 1) { $default_countries = 'US'; } elseif ($i == 2) { $default_countries = 'CA'; } elseif ($i == 3) { $default_countries = 'AT,BE,GB,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR'; } elseif ($i == 4) { $default_countries = 'JP,AU,NZ,SG'; } elseif ($i == 5) { $default_countries = 'TW,CN,HK'; }//ends the if statments for default countires tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma seprtated list of two character ISO country codes that are part of zone " . $i . ".', '6', '0', now())"); }//ends the for loop }//ends the install function function remove() { tep_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key in ('" . implode(" ', '", $this->keys()) . "')"); }//ends the remove function function keys() { $keys = array('MODULE_SHIPPING_ITEM_MODEL_STATUS', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', 'MODULE_SHIPPING_ITEM_MODEL_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'MODULE_SHIPPING_ITEM_ZONES_COUNTRIES_' . $i; }//ends the for loop return $keys; }//ends the keys function }//ends the modlue ?>
  11. i got it to work now, but everytime i try to install the module it kicks back the : Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/shaggy2d/magickoncepts.com/catalog/includes/modules/shipping/item_model.php:221) in /hsphere/local/home/shaggy2d/magickoncepts.com/admin/includes/functions/general.php on line 18 error any ideas
  12. for some reason the module that i made is not being displayed in the shipping section of the admin section for installed modules. in case it will help i will include the code for the module and for the language files module is: <?php /* $Id: item_model.php, V 1.0 2005/14.09 05:03:31 hpd1 Exp $ Written by Kevin Myers, [email protected] osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Copyright ? 2005 Magickoncepts.com Released under the GNU General Public License */ class item_model { var $code, $title, $description, $icon, $enabled; // class constructor function item_model() { global $order; $this->code = 'item_model'; $this->title = MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE; $this->description = MODULE_SHIPPING_ITEM_MODEL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ITEM_MODEL_SORT_ODER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_ITEM_MODEL_STATUS == 'True') ? true : false); $this->num_zones = 5; if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ITEM_MODEL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("SELECT zone_id FROM " . TABLE_ZONE__TO_GEO_ZONES . " WHERE geo_zone_id = '" . MODULE_SHIPPING_ITEM_MODEL_ZONE . "' and zone_county_id '" . $order->delivery['country']['id'] . "' ORDER BY zode_id"); while ($check = tep_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = ''){ global $order, $total_count, $order_id; $dest_country = $oder->delivery['country']['iso_code_2']; $dest_zone = 0; $error1 = false; for ($i=1; $s<=$this->num_zones; $i++) { $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); $country_zones = split("[,]", $countries_table); if(in_Array($dest_country, $country_zones)) { $dest_zone = $i; break; }//ends if statement }//ends for loop if ($dest_zone == 0) { for ($i=1; $i<=$this->num_zones; $i++) { $countries_table = constant(MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_ . $i); if ($countries_table == '' or $countries_table == '*') { $dest_zone = $i; break; } } } if ($dest_zone == 0) { $error1 = true; } $orders_products_query = tep_db_query("SELECT orders_products_id, products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price FROM ". TABLE_ORDER_PRODUCTS. "WHERE order_id = '" . (int)$orders_id ."'"); $num_orders = mysql_num_rows($orders_products_query); $x = 0; while($orders_products = tep_db_fetch_array($orders_product_query)) { $this->products[$x] = array( 'qty' => $orders_products['products_quantity'], 'id' => $orders_products['products_id'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['produacts_price'], 'final_price' => $orders_products['final_price']); $x++; } for($X = 0; $X <= $num_orders; $X++) { if($this->products[$X]['model'] == 'single') { $singles_count++; } elseif($this->products[$X]['model'] == 'box') { $box_count++; } elseif($this->products[$X]['model'] == 'set') { $set_count++; } elseif($this->products[$X]['model'] == 'deck') { $deck_count++; } elseif($this->products[$X]['model'] == 'lot') { $lot_count++; } } if($singles_count < "30") { $shipping_singles = 1; } else { $shipping_singles = 1 + ($shipping_count - "30")* ".1"; } $shipping_box = $box_count * 5; $shipping_set = $set_count * 7.50; $shipping_deck = $deck_count * 2.50; $shipping_lot = $lot_count * 4; $shipping_total = $shipping_singles + $shipping_box + $shipping_set + $shipping_deck + $shipping_lot; //this is where i set up the additional charge for each "zone" if($dest_zone == 1) { $shipping_total = $shipping_total; } elseif($dest_zone == 2) { $shipping_total = $shipping_total + ($shipping_total * .02); } elseif($dest_zone == 3) { $shipping_total = $shipping_total + ($shipping_total * .025); } elseif($dest_zone == 4) { $shipping_total = $shipping_total + ($shipping_total * .03); } elseif($dest_zone == 5) { $shipping_total = $shipping_total + ($shipping_total * .045); }//this ends the shipping totals for each zone define ("MODULE_SHIPPING_ITEM_MODEL_COST", $shipping_total); $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE, 'methodes' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ITEM_MODEL_TEXT_WAY, //this is the point that i need to figure out if the items are singles or boxes 'cost' => MODULE_SHIPPING_ITEM_MODEL_COST )//closes second array )//closes first aray );//closes the qutes array if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_ir']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; }//ends the quote functions function check() { if (!isset($this->_check)) { $check_query = tep_db_query("SELECT configuration_value FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_SHIPPING_ITEM_MODEL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; }//ends check function function install() { tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Model Shipping', 'MODULE_SHIPPING_ITEM_MODEL_STATUS', 'True', 'Do you want to offer model shipping rates?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) VALUES ('Tax Class', 'MODULE_SHIPPInG_ITEM_MODEL_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.'. '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pulll_down_tax_classes(', now())"); tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Sort Order', 'MODULE_SHIPPING_ITEM_MODEL_SORT_ORDER' , '0', 'Sort Order of display.'. '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { if ($i == 1) { $default_countries = 'US'; } elseif ($i == 2) { $default_countries = 'CA'; } elseif ($i == 3) { $default_countries = 'AT,BE,GB,FR,DE,GL,IS,IE,IT,NO,NL,DK,PL,ES,SE,CH,FI,PT,IL,GR'; } elseif ($i == 4) { $default_countries = 'JP,AU,NZ,SG'; } elseif ($i == 5) { $default_countries = 'TW,CN,HK'; }//ends the if statments for default countires tep_db_query("INSERT INTO " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ITEM_MODEL_COUNTRIES_" . $i ."', 'Comma seprtated list of two character ISO country codes that are part of zone " . $i . ".', '6', '0', now())"); }//ends the for loop }//ends the install function function remove() { tep_db_query("DELETE FROM " . TABLE_CONFIGURATION . " WHERE configuration_key in ('" . inplode(" ', '", $this->keys()) . "')"); }//ends the remove function function keys() { $keys = array('MODULE_SHIPPING_ITEM_MODEL_STATUS', 'MODULE_SHIPPING_ITEM_MODEL_TAX_CLASS', 'MODELU_SHIPPING_ITEM_MODEL_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'MODULE_SHIPPING_ITEM_ZONES_COUNTRIES_' . $i; }//ends the for loop return $keys; }//ends the keys function }//ends the modlue ?> the language file is: <?php define('MODULE_SHIPPING_ITEM_MODEL_TEXT_TITLE', 'Shipping rates based on the model'); define('MODULE_SHIPPING_FIRSTPLUSZONES_TEXT_DESCRIPTION', 'Shipping rates for singles, deck, sets, lots, and boxes'); define('MODULE_SHIPPING_ITEM_MODEL_ERROR1', 'No shipping available to the selected country'); ?> is there something that i missed, or is the application just being stupid
  13. what i am doing is selling cards over the internet, magic, yu-gi-oh! stuff like that, well i want to have it set up where i can have the first 50 cards that the person buys only cost a dollar to ship, plus 10 cents for each one after that. i know i can do a tabel matrix for that, but doing that will also include the display doxes and decks and what not. can't seem to figure out, nor saw, a different way to do what i need, anyone have any ideas
×
×
  • Create New...