Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

JuanIgnacio

Pioneers
  • Posts

    76
  • Joined

  • Last visited

Profile Information

JuanIgnacio's Achievements

  1. Great post. Would be great to have it updated for osCommerce 2.3.3
  2. Update. Here's the module: <?php /* $Id: Interstate.php Hecho por Formato Diseño For Use with: osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Released under the GNU General Public License */ class oca_express { var $code, $title, $description, $enabled, $num_zones; // class constructor function oca_express() { $this->code = 'oca_express'; $this->title = OCA_EXPRESS_TEXT_TITLE; $this->description = OCA_EXPRESS_TEXT_DESCRIPTION; $this->sort_order = OCA_EXPRESS_SORT_ORDER; $this->icon = ''; $this->tax_class = OCA_EXPRESS_TAX_CLASS; $this->enabled = ((OCA_EXPRESS_STATUS == 'True') ? true : false); // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED $this->num_zones = 2; } // class methods function quote($method = '') { global $order, $shipping_weight, $shipping_num_boxes; // if delivery is to other country, skip module in cart // if ($order->delivery['country']['iso_code_2'] != 'AR ') return; //$dest_state = $order->delivery['estado']; $dest_iz = tep_db_fetch_array(tep_db_query("select zone_code from zones where zone_id = '" . (int)$order->delivery['zone_id'] . "'")); $dest_state = $dest_iz['zone_code']; $dest_nam = tep_db_fetch_array(tep_db_query("select zone_name from zones where zone_id = '" . (int)$order->delivery['zone_id'] . "'")); $dest_nombre = $dest_nam['zone_name']; $dest_zone = 0; $error = false; for ($i=1; $i<=$this->num_zones; $i++) { $state_table = constant('OCA_EXPRESS_STATES_' . $i); $state_zones = split("[ ,]", $state_table); if (in_array($dest_state, $state_zones)) { $dest_zone = $i; break; } } if ($dest_zone == 0) { $error = true; } else { $shipping = -1; $OCA_EXPRESS_cost = constant('OCA_EXPRESS_COST_' . $dest_zone); $OCA_EXPRESS_table = split("[:,]" , $OCA_EXPRESS_cost); $size = sizeof($OCA_EXPRESS_table); for ($i=0; $i<$size; $i+=2) { if ($shipping_weight <= $OCA_EXPRESS_table[$i]) { $shipping = $OCA_EXPRESS_table[$i+1]; $shipping_method = OCA_EXPRESS_TEXT_WAY . ' a '. $dest_nombre; break; } } if ($shipping == -1) { $shipping_cost = 0; $shipping_method = OCA_EXPRESS_UNDEFINED_RATE; } else { $shipping_cost = ($shipping * $shipping_num_boxes); } } $this->quotes = array('id' => $this->code, 'module' => OCA_EXPRESS_TEXT_SECTION_TITLE, 'methods' => array(array('id' => $this->code, 'title' => $shipping_method, 'cost' => $shipping_cost))); 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); if ($error == true) $this->quotes['error'] = OCA_EXPRESS_INVALID_ZONE; return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'OCA_EXPRESS_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } 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 ( 'Habilitar Correo Argentino?', 'OCA_EXPRESS_STATUS', 'True', 'Habilitar Correo Argentino?', '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 ( 'Impuesto', 'OCA_EXPRESS_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 ( 'Orden de aparición', 'OCA_EXPRESS_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); for ($i = 1; $i <= $this->num_zones; $i++) { $default_states = ''; $default_rates = ''; if ($i == 1) { $default_states = 'CF, BA, ZC, ZR, ZP'; // Capital - Regional $default_rates = '1:29, 5:35'; } if ($i == 2) { $default_states = 'SF, CB, ER, LP, CO, CA, CC, CH, FO, JU, LR, MZ, MI, NE, RN, SA, SJ, SL, SC, SE, TU, TF '; // Nacional $default_rates = '1:41, 5:53'; } if ($i == 3) { // Otros $default_states = ''; $default_rates = ''; } tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Zona " . $i ." - Provincias', 'OCA_EXPRESS_STATES_" . $i ."', '" . $default_states . "', 'Lista de codigos ISO de las provincias en la zona separados por comas', '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 ." - Rango de precios', 'OCA_EXPRESS_COST_" . $i ."', '" . $default_rates . "', 'Precios para la Zona " . $i . " en formato rangos. Ejemplo: 3:8.50,7:10.50, (...) Con peso menos o igual a 3 cuesta 8.50 para desinos en la Zona " . $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 ." - Recargo fijo', 'OCA_EXPRESS_HANDLING_" . $i."', '0.00', 'Handling Fee for this shipping zone', '6', '0', now())"); } } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { $keys = array('OCA_EXPRESS_STATUS', 'OCA_EXPRESS_TAX_CLASS', 'OCA_EXPRESS_SORT_ORDER'); for ($i=1; $i<=$this->num_zones; $i++) { $keys[] = 'OCA_EXPRESS_STATES_' . $i; $keys[] = 'OCA_EXPRESS_COST_' . $i; $keys[] = 'OCA_EXPRESS_HANDLING_' . $i; } return $keys; } } ?>
  3. I made a variation of the Zone Shipping module. It has a price for different group of states. The modules quotes the according price just fine. But when the module is selected in the checkout_shipping.php page, instead of going to checkout_payment, you get back to checkout_shipping with the module pre-selected but no error message at all. So whatever I try, if this module is selected, you can't get past the shipping page and no error is shown anywhere (nor print in the page, nor log, nothing). If you select any other module, you get to the payment step just fine. I have no idea on how to solve this or where to look for errors. If the price is calculated right, why oscommerce doesn't take it and go to the next step? Any ideas of what may be happening or at least where I can start trying to debug? Thanks a lot
  4. Would be nice to have it Can you send it please? You should also contribute it to the AddOn Page
  5. Found that function credit_selection() { ... } in /includes/modules/order_total/ot_coupon.php un line 61 is the responsable for outputting the coupon code input field text You have to be sure that function is called in checkout_payment.php // Start - CREDIT CLASS Gift Voucher Contribution echo $order_total_modules->credit_selection(); // End - CREDIT CLASS Gift Voucher Contribution but of course, all the checking and class creation code must be correctly on the first part of checkout_payment.php for it to work I'll be posting more on this later
  6. You installed it into osCommerce 2.3.1? I started comparing files and editing the original 2.3.1... I manage to port all the admin part (which I'll contribute later) but I can't fin the way to place the box where the user inputs his coupon code.
  7. The installation instructions in all the versions of CCVG don't work for osCommerce 2.3.1... they are for RC2 which has many differences from 2.3.1 and there even are files that doesn't exist anymore. Has anyone installed CCGV in 2.3.1? Is there any clean 2.3.1 files with CCGV in them to replace? Any instructions? Regards
  8. Why isn't a language pack in the new osCommerce 2.3.1? Is there one anywhere else? It would be nice to at least have the previous translations and have the new strings in english so we can translate them (and contribute them back)
  9. I haven't find anything about this already. What are the plans for STS on osCommerce 3?
  10. I made all the edits to categories.php but when I enter to Attribute in the admin, the regular attribute manager appears. The thing is that when I click Attributes the browser goes to http://www.....com/admin/products_attributes.php So, I don't see how editing categories.php would affect browsing product_attributes.php I installed version 2.8.5 I don't have additional addons that affect the admin functoin (STS but as far as I know, that only affects the front-end) What am I missing? I tried some searches and read some of the 40 pages of this thread but I didn't find anything (I didn't read the whole 40 pages). Thanks in advance
  11. I can believe that was it... I loss like a day with this, just because I didn't noticed the == :S
  12. Pete If I understand, what your trying to do is to charge for the Contrareembolso service if that's how they pay for. The best way to do this, I think, is to create a OrderTotal (totalización) module. Do a simple check to detect which payment method was selected and make the OrderTotal module to create a CARGO POR CONTRAREEMBOLSO fee. I think that should be fine and pretty easy. Mmmm... no, how can I do that?
  13. I'm detecting the shipping method this way: if (substr_count($order->info['shipping_method'], '>>Shipping Name<<') > 0) { .... } I'm done with that. The thing is I CAN'T TURN THE PAYMENT METHOD OFF. I placed "$this->enabled == false; " and "$check_flag = false;" inside the if, outside the if, in the before_process() function.... and the payment method it's still there for the user to select. How in the world do I disable the payment method after detecting the shipping method selected??
  14. I trying to do the same with a payment module but I can't I have this: $correar = substr_count($order->info['shipping_method'], 'Correo Argentino'); if ($correar == '0') { $this->enabled == false; //die(); I know that $correar is 0 because I placed an echo of that in checkout_payment and because if I uncomment die(); nothing will happening when going to the payment step. So, the condition seems to be true, but it's not disabling the method. I also tried moving to the end of the funcion, right under "// disable the module if the order only contains virtual products" but the payment option is still avalaible. What am I missing? should I move this to the payment thread?
  15. Pete: Most shipping and payment methods have a way to add a fee just for using them. You don't have to detect the method used, just make the method to add this fee and it will only be added if the method is selected. Look into some module that has this fee and look for the code on how to add it to the total.
×
×
  • Create New...