Jump to content

Minimální váha pro dopravce


cernicektomas

Recommended Posts

Zdravím,

PrestaShop má v základu možnost omezit dopravce dle Maximální hmotnost zásilky.

Potřeboval bych z určitých důvodů nastavit naopak Minimální povolenou hmotnost (místo Maximální). Poraďte prosím jak a kde změnit v kódu.

 

Šlo by to nějak.

 

Děkuji za tipy. Tomáš

Link to comment
Share on other sites

  • 3 weeks later...

Řešení již poskytnu na anglickém fóru a funguje:

 

It seems there's only one place that variable is used, so I should be easy to change. It's the following code on line 1413 of classes/Carrier.php:

if ($carrier->max_weight > 0 && ($carrier->max_weight < $product->weight * $cart_quantity || $carrier->max_weight < $cart_weight)) {

You can try changing it to:

if ($carrier->max_weight > 0 && ($carrier->max_weight > $product->weight * $cart_quantity || $carrier->max_weight > $cart_weight)) {

It's better to do this using an override so PrestaShop won't overwrite your code during an upgrade. Create override/classes/Carrier.php like this:

<?php

class Carrier extends CarrierCore
{
// Paste your getAvailableCarrierList function here with the changed line
}

Remember to go to the Advanced Parameters > Performance tab and click the "Clear cache" button (or manually delete cache/class_index.php) so PrestaShop can find the override.

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...