Jump to content

changing displayed shipping order


huggettm

Recommended Posts

In /classes/cubecart.class.php, near line 1676:

Find:

// Lets try to choose cheapest shipping option
// for them if they haven't chosen already
if ((!isset($this->_basket['shipping']) && !$digital_only) || (!$offset_matched && isset($this->_basket['shipping']['offset']) && !$digital_only)) { // Scanning for cheapest shipping because shipping has yet to be set and this basket is not digital only.
	foreach ($shipping_values as $value) {
		if (!isset($cheapest['value']) || $value['value'] < $cheapest['value']) { // Found a cheaper value!
			$cheapest = $value;

Change the comparison of less than to greater than.

 

Link to comment
Share on other sites

2 hours ago, huggettm said:

thank you, that looks good but a bit over the top for what i am trying to achieve

I agree that you get a lot of extra functionality over and above the shipping cost sorting which you asked about (although I am sure that you would probably start using that if you had the plugin) but the only other solution is changing core code as suggested which to my thinking is always a bad idea

Link to comment
Share on other sites

19 hours ago, bsmither said:

In /classes/cubecart.class.php, near line 1676:


Find:

// Lets try to choose cheapest shipping option
// for them if they haven't chosen already
if ((!isset($this->_basket['shipping']) && !$digital_only) || (!$offset_matched && isset($this->_basket['shipping']['offset']) && !$digital_only)) { // Scanning for cheapest shipping because shipping has yet to be set and this basket is not digital only.
	foreach ($shipping_values as $value) {
		if (!isset($cheapest['value']) || $value['value'] < $cheapest['value']) { // Found a cheaper value!
			$cheapest = $value;

Change the comparison of less than to greater than.

 

Thanks brian,

 

I tried this

 

// Lets try to choose cheapest shipping option
                // for them if they haven't chosen already
                if ((!isset($this->_basket['shipping']) && !$digital_only) || (!$offset_matched && isset($this->_basket['shipping']['offset']) && !$digital_only)) {
                    foreach ($shipping_values as $value) {
                        if (!isset($cheapest['value']) || $value['value'] > $cheapest['value']) {
                            $cheapest = $value;
                        }

 

but it makes no difference in the cart view

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...