Jump to content

Help with minimum order value


Recommended Posts

Hi I need to have 2 minimum order value set, 1 of £100 and another of £2.50 I have set my carriers by weight which are 0.1 kg to 20 kg with a shipping cost of £3.50 20 kg to 500000 kg with a shipping cost of £20 and free shipping on all orders over £250 I have given all the products that come under the £3.50 shipping a weight of 0.1 kg and those that fall into £20 shipping a 20 kg weight and set the shipping by weight so if they mix they are charged the higher rate for shipping. What i need is a total min cart value of £2.50 if the customer is only ordering items with a weight of 0.1 kg and another of £100 when ordering 20 kg and above including mixed from both sets of weights. in other words as long as the total order weight is less than 20kg the min order value of the cart to vaildate order £2.50 and if the total or weight is 20kg or over the min order value £100.

 

Can anybody can help please

Edited by webcatcher (see edit history)
Link to comment
Share on other sites

  • 1 month later...

Probably should modify the check on minimum purchase code a little:

 

I think in file: controllers/front/OrderController.php

find code:

 // Check minimal amount
 $currency = Currency::getCurrency((int)$this->context->cart->id_currency);
 $orderTotal = $this->context->cart->getOrderTotal();
 $minimal_purchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
 if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimal_purchase && $this->step != -1)
 {
  $this->step = 0;
  $this->errors[] = sprintf(
   Tools::displayError('A minimum purchase total of %d is required in order to validate your order.'),
   Tools::displayPrice($minimal_purchase, $currency)
  );
 }

 

and in file:controllers/front/OrderOpcController.php

 

 

 /* Check minimal amount */
 $currency = Currency::getCurrency((int)$this->context->cart->id_currency);
 $minimalPurchase = Tools::convertPrice((float)Configuration::get('PS_PURCHASE_MINIMUM'), $currency);
 if ($this->context->cart->getOrderTotal(false, Cart::ONLY_PRODUCTS) < $minimalPurchase)
  return '<p class="warning">'.sprintf(
   Tools::displayError('A minimum purchase total of %d is required in order to validate your order.'),
   Tools::displayPrice($minimalPurchase, $currency)
  ).'</p>';

 

 

Should check on total weight of cart and compare if < 20kg and then check min value OR if > 20kg and then check other min value.

 

Minimun value of the cart you can check with function in /classes/cart.php:

public function getTotalWeight()

 

 

so probably you should use something like

 

if ($this->context->cart->getTotalWeight() <20) {compare ordertotal<MinValueX}

else if ($this->context->cart->getTotalWeight() >=20) {compare ordertotal<MinValueY}

else {error}

 

 

Hope this helps, give it a try. (Don't forget to backup files before you change anything :-) )

pascal

Link to comment
Share on other sites

  • 1 year later...

Well

 

what ist the code if I want the check to base on order total incl. tax?

 

blabla * 1.19 in the case of Germany... but how to write it in proper code?

 

PS:

Does someone know how to 'hook' the check in the ajax blockcart.tpl ?

Link to comment
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
×
×
  • Create New...