Jump to content

File Classes/Carrier.Php


uvtya

Recommended Posts

Presta 1.4

 

The file classes / Carrier.php is a function of:

 

public function getDeliveryPriceByWeight ($ totalWeight, $ id_zone)

{

$ Cache_key = $ this-> id .'_'.$ totalWeight .'_'.$ id_zone;

 

if (! isset (self:: $ priceByWeight [$ cache_key]))

{

$ Result = Db:: getInstance (_PS_USE_SQL_SLAVE_) -> getRow ('

SELECT d. `price`

FROM `'. _DB_PREFIX_.' Delivery` d

LEFT JOIN `'. _DB_PREFIX_.' Range_weight` w ON (d. `id_range_weight` = w. `id_range_weight`)

WHERE d. `id_zone` = '. (Int) ($ id_zone).'

AND '. (Float) ($ totalWeight).' > = W. `delimiter1`

AND '. (Float) ($ totalWeight).' <W. `delimiter2`

AND d. `id_carrier` = '. (Int) ($ this-> id).'

ORDER BY w. `delimiter1` ASC ');

if (! isset ($ result ['price']))

self:: $ priceByWeight [$ cache_key] = $ this-> getMaxDeliveryPriceByWeight ($ id_zone);

else

self:: $ priceByWeight [$ cache_key] = $ result ['price'];

}

return self:: $ priceByWeight [$ cache_key];

}

 

I need this function to include the amount of goods from the basket (excluding shipping amount). Tell me how? or where to get this variable.

Link to comment
Share on other sites

I'm not sure why you would want or need to do such a thing. Are you sure you don't need to create a new Carrier module? That function is in the Carrier class and affects all carriers, rather than a specific one.

 

In fact doesn't Carrier::getDeliveryPriceByPrice() do what you're describing already?

 

If you really need to change the core behaviour (potentially affecting all carrier modules) then you would override the class (and that specific member function).

 

Paul

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