Jump to content

How to change carrier description from within shipping module


danrimer

Recommended Posts

Hi

 

I am writing a customised shipping module for PrestaShop 1.5.

 

The module automatically switches between 4 different options and provides discounts to the consumer at certain price points. However, the module is simply called "Economy shipping" and the user is not given any more information than the name or the price.

 

I don't want to use the static text (shipping/carriers/edit) for more than just basic info. I would like to add another line (or lines) to explain the carrier selected and the discount applied.

 

Can this be done? Or am I looking in the wrong place?

 

 

Thanks

 

 

Dan

Link to comment
Share on other sites

Hi Dan,

 

Will

$carrier->delay = 'delivered by rocket for good price';

 

do the job ?

 

With a HOOK_BEFORECARRIER and modification of order-carrier.tpl, you could display your informations.

 

Regards

 

Hi math_php

 

Since i am a noob, can you explain to me how to do this please?

 

Many thanks

 

Dan

Link to comment
Share on other sites

Hi Dan,

 

In fact do you already have calculated shipping price in your module ?

 

If yes an override of getDeliveryOptionList from class cart could be a solution.

 

You will get an array of all carriers, with shipping prices, displayed name, id and so on.

You could then modify your carrier information depending on the display you want.

 

What sort of behaviour you want something like that :

0 - 400 pounds 'economic slow'

400-600 pounds 'economic fast'

more than 600 pound 'deluxe shipping'

 

Best regards

Link to comment
Share on other sites

Hi math_php

 

in my module i have:

public function getOrderShippingCost($params, $shipping_cost)
{
 if ($this->id_carrier <> (int)(Configuration::get('SHIPECO_CARRIER_ID'))) return false;

 global $cart;
 $carriers=$cart->getDeliveryOptionList();
 print_r ($carriers);
.
.
.

 

This code just gives me an out of memory error - I can't seem to get any info from getDeliveryOptionList(). I'm afraid I am really in the dark here!

 

Can you give me a piece of code that I can use to change just one line of the carrier description? I should be able to work other things out from there :-)

 

 

 

Thanks for your help so far!

 

 

Dan

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

  • 4 months later...

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