Jump to content
Sign in to follow this  
LeeFoster

Cost/Weight Shipping

Recommended Posts

I am currently working on getting this add on working with Phoenix, it's almost there except for one issue. 

https://apps.oscommerce.com/BSHzP&cost-weight-matrix-shipping-rates

I have set up 2 values for cost £50 and £100, the theory being that once the cart goes over £100 that shipping option should no longer be there. In case you didn't guess it's still there and showing the lowest shipping amount.

Testing on Phoenix 1.0.7.1

PHP 7.3.3

Local Xampp server

Share this post


Link to post
Share on other sites

Original developer appears to have had the same issue and added in the below code to fix. However it no longer fixes.


		  if ($order_total > $table_costtable[$size-1]) {
				$table_pointer = $size-1;
				break;
		  }

 

Share this post


Link to post
Share on other sites

Added the below code and it now hides the shipping option in the cart

$cart_total = $cart->show_total();
		  $table_costtable = preg_split("/[,]/" , MODULE_SHIPPING_UKFIRST_UT_COSTTABLE);
      $size = sizeof($table_costtable);
for ($i=0; $i<$size; $i++) {
				
if ($cart_total > $table_costtable[$size-1]) {

$this->enabled = false;

}
      }

 I now get this error in the shipping modules section of admin.

Quote

Fatal error: Uncaught Error: Call to a member function show_total()

I know it's because the function doesn't exist there but how do I get around it?

Share this post


Link to post
Share on other sites
Just now, hungryfrank said:

if this is in a function u can add carts to the globals

global $order, $cart;

I added $cart to the globals which is why it works on the front end. Unfortunately this doesnt carry over to admin.

Share this post


Link to post
Share on other sites

Remove $cart from global and write

if (isset($_SESSION['cart']) {
  $cart =& $_SESSION['cart'];
} else {
  $cart = new shopping_cart();
}

But it might be better not to use cart in admin at all. 


Always back up before making changes.

Share this post


Link to post
Share on other sites
7 hours ago, ecartz said:

Remove $cart from global and write


if (isset($_SESSION['cart']) {
  $cart =& $_SESSION['cart'];
} else {
  $cart = new shopping_cart();
}

But it might be better not to use cart in admin at all. 

Made the change and now get this error

Quote

Fatal error: Cannot declare class shoppingCart, because the name is already in use in \includes\system\versioned\1.0.0.0\shopping_cart.php on line 13

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×