sinopia Posted February 15, 2018 Author Share Posted February 15, 2018 I've set the default cost manually, in case anyone needs I used this way in ot_shipping.php: // The line telling the savings on the shipping when it's free if ($order->delivery['country_id'] == STORE_COUNTRY) { $total_saving = '<span style="color: red; text-decoration: line-through;">4€</span>'; } else { $total_saving = '<span style="color: red; text-decoration: line-through;">8€</span>'; } if (($order->info['total'] - $order->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) { // if free shipping $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $total_saving . ' ' . $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['shipping_cost']); } else { $this->output[] = array('title' => $order->info['shipping_method'] . ':', 'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']), 'value' => $order->info['shipping_cost']); } Quote Link to comment Share on other sites More sharing options...
clustersolutions Posted February 16, 2018 Share Posted February 16, 2018 11 hours ago, sinopia said: @clustersolutions Hi. That code for the savings looks very nice. You could possibility public it? @sinopia, I believe there were quite a few places that required core code mods, may be schema as well. I hv been waiting for a stable/finalized OSC frame work b4 further dev...I would by then. Hope u known what I mean. Quote Link to comment Share on other sites More sharing options...
Heatherbell Posted March 13, 2019 Share Posted March 13, 2019 On 12/20/2017 at 5:07 PM, raiwa said: instead of the free shipping option in ot_shipping, just use for example the flat shipping module. Rename the title and description to free shipping and modify the code to show it only if order total is more than 29.90. within the class constructor if ($order->info['total']) > 29.90) { $check_flag = true; } if ($check_flag == false) { $this->enabled = false; } rgds Rainer Tried inserting your code as suggested but getting Parse error: syntax error, unexpected '>' in /includes/modules/shipping/flat.php referring to if ($order->info['total']) > 29.90) { Any help? Quote Link to comment Share on other sites More sharing options...
Dan Cole Posted March 13, 2019 Share Posted March 13, 2019 Try adding another bracket "(" before the first one following the initial if....you have 1 opening bracket but 2 closing ones. Dan burt and raiwa 2 Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Heatherbell Posted August 10, 2019 Share Posted August 10, 2019 Hoping for some advice to edit the code in the above post (which should read) - if ($order->info['total'] > 29.90) { $check_flag = true; } if ($check_flag == false) { $this->enabled = false; } for example - so the shipping module only shows when order total is more than 29.90 AND more than total shipping weight of 100 - if that is possible. Many thanks. Quote Link to comment Share on other sites More sharing options...
burt Posted August 10, 2019 Share Posted August 10, 2019 1 hour ago, Heatherbell said: if ($order->info['total'] > 29.90) { if ( ($order->info['total'] > 29.90) && ($shipping_weight > 100) ) { You *might* need to globalise $shipping_weight ... see how it's done in (eg) zones.php Heatherbell 1 Quote Link to comment Share on other sites More sharing options...
Heatherbell Posted August 10, 2019 Share Posted August 10, 2019 (edited) Thanks Edited August 10, 2019 by Heatherbell Quote Link to comment Share on other sites More sharing options...
zeeshop Posted December 26, 2020 Share Posted December 26, 2020 Hi, I like to put same option for customers to offer free shipping if they have item over £30 in their cart for UK only customers, rest of the world will get zone shipping module available. I prefer to go with @raiwaoption below, if possible, Tried this with no success, I must be putting code in a wrong place. On 3/13/2019 at 3:44 PM, Heatherbell said: instead of the free shipping option in ot_shipping, just use for example the flat shipping module. Rename the title and description to free shipping and modify the code to show it only if order total is more than 29.90. within the class constructor if ($order->info['total']) > 29.90) { $check_flag = true; } if ($check_flag == false) { $this->enabled = false; } My /includes/modules/shipping/flat.php look like this, kindly advise what exactly to change/ modify. Thanks <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2020 osCommerce Released under the GNU General Public License */ class flat extends abstract_shipping_module { const CONFIG_KEY_BASE = 'MODULE_SHIPPING_FLAT_'; // class methods public function quote($method = '') { global $order; $this->quotes = [ 'id' => $this->code, 'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE, 'methods' => [[ 'id' => $this->code, 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY, 'cost' => $this->base_constant('COST') + $this->calculate_handling(), ]], ]; $this->quote_common(); return $this->quotes; } protected function get_parameters() { return [ $this->config_key_base . 'STATUS' => [ 'title' => 'Enable Flat Shipping', 'value' => 'True', 'desc' => 'Do you want to offer flat rate shipping?', 'set_func' => "tep_cfg_select_option(['True', 'False'], ", ], $this->config_key_base . 'COST' => [ 'title' => 'Shipping Cost', 'value' => '5.00', 'desc' => 'The shipping cost for all orders using this shipping method.', ], $this->config_key_base . 'TAX_CLASS' => [ 'title' => 'Tax Class', 'value' => '0', 'desc' => 'Use the following tax class on the shipping fee.', 'use_func' => 'tep_get_tax_class_title', 'set_func' => 'tep_cfg_pull_down_tax_classes(', ], $this->config_key_base . 'ZONE' => [ 'title' => 'Shipping Zone', 'value' => '0', 'desc' => 'If a zone is selected, only enable this shipping method for that zone.', 'use_func' => 'tep_get_zone_class_title', 'set_func' => 'tep_cfg_pull_down_zone_classes(', ], $this->config_key_base . 'SORT_ORDER' => [ 'title' => 'Sort Order', 'value' => '0', 'desc' => 'Sort order of display.', ], ]; } } Quote Link to comment Share on other sites More sharing options...
Heatherbell Posted December 27, 2020 Share Posted December 27, 2020 11 hours ago, zeeshop said: kindly advise what exactly to change/ modify The following works for us (with thanks to @ecartz for solution). After: const CONFIG_KEY_BASE = 'MODULE_SHIPPING_FLAT_'; Insert: public function __construct() { parent::__construct(); if ($this->enabled && isset($GLOBALS['order']->info['total']) && ($GLOBALS['order']->info['total'] < 30)) { $this->enabled = false; } } zeeshop 1 Quote Link to comment Share on other sites More sharing options...
lambro Posted January 4, 2021 Share Posted January 4, 2021 On 12/27/2020 at 9:47 AM, Heatherbell said: The following works for us (with thanks to @ecartz for solution). After: const CONFIG_KEY_BASE = 'MODULE_SHIPPING_FLAT_'; Insert: On 12/27/2020 at 9:47 AM, Heatherbell said: The following works for us (with thanks to @ecartz for solution). After: const CONFIG_KEY_BASE = 'MODULE_SHIPPING_FLAT_'; Insert: public function __construct() { parent::__construct(); if ($this->enabled && isset($GLOBALS['order']->info['total']) && ($GLOBALS['order']->info['total'] < 30)) { $this->enabled = false; } } Would you be able to do the same with weight? EG. if the order is over £5.00 and 0.02kg or grams or any thing........... do not show Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted January 4, 2021 Share Posted January 4, 2021 On 8/10/2019 at 6:59 PM, burt said: if ( ($order->info['total'] > 29.90) && ($shipping_weight > 100) ) { You *might* need to globalise $shipping_weight ... see how it's done in (eg) zones.php Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
zeeshop Posted February 16, 2021 Share Posted February 16, 2021 (edited) On 12/27/2020 at 9:47 AM, Heatherbell said: The following works for us (with thanks to @ecartz for solution). After: const CONFIG_KEY_BASE = 'MODULE_SHIPPING_FLAT_'; Insert: public function __construct() { parent::__construct(); if ($this->enabled && isset($GLOBALS['order']->info['total']) && ($GLOBALS['order']->info['total'] < 30)) { $this->enabled = false; } } I was using this code for a while now for free shipping over £30, and it works fine for Stripe and PayPal direct payment option, where it is possible to select shipping options from list at www.site.com/checkout_shipping.php. I am using @raiwa's Ship in Cart module. However, if I choose free shipping option from Shopping Cart page and use PayPal express checkout, after taking credit card details, paypal send customer to www.site.com/checkout_confirmation.php without free shipping option (Flat Rate module), instead it automatically select "zone based rates" module price. There is no option to chose free shipping, unless customer goes back to checkout_shipping.php page to select free shipping option, then it seems to finalise the order. Paypal Express Checkout, shipping settings are: 1. Instant update is "true" 2. Site is running SSL Any advise to resolve this would be very appreciated. Thanks Edited February 17, 2021 by zeeshop Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted February 17, 2021 Share Posted February 17, 2021 (edited) I didn't check, bit I believe If using the PayPal express checkout button, the shipping must be selected at the PayPal page (once logged into the PayPAl zccount). Edited February 17, 2021 by raiwa Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
zeeshop Posted February 17, 2021 Share Posted February 17, 2021 Thanks @raiwa, but in my case, on PayPal page after logging in or entering credit card details, it send the customer back to site.com/checkout_confirmation.php with no option to select free shipping instead zone method pre-selected (as explained above) I noticed this issue was reported in past, but unable to find solution which can resolve this. Thanks Quote Link to comment Share on other sites More sharing options...
zeeshop Posted February 17, 2021 Share Posted February 17, 2021 Ok, so issue seems to be PayPal, In-Context option, this option does not seems to be fetching Shipping methods. However If I set this on classic, it takes customer on PayPal site and there Shipping options are available and works fine. Thanks Quote Link to comment Share on other sites More sharing options...
zeeshop Posted February 17, 2021 Share Posted February 17, 2021 (edited) Using Paypal express checkout if you want customer to return to your site to select shipping option then I found a solution from 2015 post which worked for me, just sharing it as this may benefit others too. Set Instant update to "Disabled" In /ext/modules/payment/paypal/express.php tep_redirect(tep_href_link('checkout_confirmation.php', '', 'SSL')); } else { $_SESSION['appPayPalEcRightTurn'] = true; tep_redirect(tep_href_link('checkout_shipping.php', '', 'SSL')); with //added to send customer back to checkout_shipping tep_session_register('appPayPalEcRightTurn'); $appPayPalEcRightTurn = true; tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')); //tep_redirect(tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL')); Edited February 17, 2021 by zeeshop Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.