Shipping Delivery Advisory

Ask the community for help and support.
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

Shipping Delivery Advisory

Post by gabbysplaza »

First of all, thank you to the developers of this store software. It's been a great improvement from my old website software which has come to end of life. So far, I'm getting things setup and all going well. I just have a question about the flat rate shipping settings.

Can a delivery advisory (ETA) setting be added to it to show customer how long it will take to receive their order. So for this setting I could for instance add something like 5-7 and this would display in shopping cart as well as the flat rate cost? This would be nice. This has been the only issue I got from initial feedback.
heatherbell
VIP Member
VIP Member
Posts: 1996
Joined: Mon Oct 07, 2019 4:39 am
Has thanked: 26 times
Been thanked: 175 times

Re: Shipping Delivery Advisory

Post by heatherbell »

gabbysplaza wrote: Tue Oct 26, 2021 5:40 pm First of all, thank you to the developers of this store software. It's been a great improvement from my old website software which has come to end of life. So far, I'm getting things setup and all going well. I just have a question about the flat rate shipping settings.

Can a delivery advisory (ETA) setting be added to it to show customer how long it will take to receive their order. So for this setting I could for instance add something like 5-7 and this would display in shopping cart as well as the flat rate cost? This would be nice. This has been the only issue I got from initial feedback.
You can add that text to the flat rate shipping language file -https://github.com/CE-PhoenixCart/Phoen ... at.php#L15
For shopping cart, you will need to make/have made an additional module/hook to show it - see User Guide for example -
https://phoenixcart.org/phoenixcartwiki ... a_New_Hook
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

Re: Shipping Delivery Advisory

Post by gabbysplaza »

heatherbell wrote: Tue Oct 26, 2021 6:00 pm You can add that text to the flat rate shipping language file -https://github.com/CE-PhoenixCart/Phoen ... at.php#L15
For shopping cart, you will need to make/have made an additional module/hook to show it - see User Guide for example -
https://phoenixcart.org/phoenixcartwiki ... a_New_Hook
I was thinking more interms of being able to change the delivery value using the admin panel instead of amending the lanuguage file often. A hook does not give me the option to change value and update. If I am able to modify this file to add additional value to the database and change it at will, then display the value wherever I want it, will this work?

https://github.com/CE-PhoenixCart/Phoen ... g/flat.php

Where can I download the full source for the flat rate shipping module from so I can modify it to suit my need?
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

Re: Shipping Delivery Advisory

Post by gabbysplaza »

So if I modified this:

https://github.com/CE-PhoenixCart/Phoen ... g/flat.php

to this:

Code: Select all

protected function get_parameters() {
      return [
        $this->config_key_base . 'STATUS' => [
          'title' => 'Enable Flat Shipping',
          'value' => 'True',
          'desc' => 'Do you want to offer flat rate shipping?',
          'set_func' => "tep_cfg_select_option(['True', 'False'], ",
        ],
        $this->config_key_base . 'COST' => [
          'title' => 'Shipping Cost',
          'value' => '5.00',
          'desc' => 'The shipping cost for all orders using this shipping method.',
        ],
        $this->config_key_base . 'TAX_CLASS' => [
          'title' => 'Tax Class',
          'value' => '0',
          'desc' => 'Use the following tax class on the shipping fee.',
          'use_func' => 'tep_get_tax_class_title',
          'set_func' => 'tep_cfg_pull_down_tax_classes(',
        ],
        $this->config_key_base . 'ZONE' => [
          'title' => 'Shipping Zone',
          'value' => '0',
          'desc' => 'If a zone is selected, only enable this shipping method for that zone.',
          'use_func' => 'tep_get_zone_class_title',
          'set_func' => 'tep_cfg_pull_down_zone_classes(',
        ],
        $this->config_key_base . 'SORT_ORDER' => [
          'title' => 'Sort Order',
          'value' => '0',
          'desc' => 'Sort order of display.',
        ],
	$this->config_key_base . 'DELIVERY_TIME' => [
          'title' => 'Delivery Time',
          'value' => '0',
          'desc' => 'Estimated delivery time.',
        ],
     ];
}
Where else would I need to make changes to get this to work?
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

Re: Shipping Delivery Advisory

Post by raiwa »

You can edit language files in admin: tools: define language. But this will show only on Checkout Shipping.
Or you add the Ship in Cart module and it will also show on the Shopping Cart page:
app.php/addons/free_addon/ship_in_cart

If you wish to show it elsewhere, you could use a configuration constant to hold the text. If your store uses only one language it's easy to add to the flat rate shipping module. Make a copy of the flat rate shipping and add the constant. Then you can output the constant wherever you wish with a hook or content module.
If your store is multilingual, it is also possible to use configuration constants, but it gets a bit more tricky.
I did this in some of my modules, for example "Holiday Message":
app.php/addons/free_addon/holiday_promotional_message
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

Re: Shipping Delivery Advisory

Post by raiwa »

gabbysplaza wrote: Tue Oct 26, 2021 6:42 pm Where else would I need to make changes to get this to work?
You'll need to output the constant together with some text in a hook or content module. See my above message.
It all depends where you wants to show it.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
Omar_one
VIP Member
VIP Member
Posts: 481
Joined: Fri Oct 25, 2019 5:06 pm
Has thanked: 48 times
Been thanked: 27 times

Re: Shipping Delivery Advisory

Post by Omar_one »

if it's an Leadtime for products check this one made by @burt
app.php/addons/supporters_code/s09e03_p ... t_modules/
you can add as many different lead times as you want. A lead time can then be selected when adding/editing a product.
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

Re: Shipping Delivery Advisory

Post by gabbysplaza »

raiwa wrote: Tue Oct 26, 2021 6:48 pm But this will show only on Checkout Shipping.

If your store uses only one language it's easy to add to the flat rate shipping module. Make a copy of the flat rate shipping and add the constant.
Thank you all for suggestions. My store uses only one language and I want the delivery lead time shown on the checkout shipping page only. I can easily add value I want in language file and make it shown on checkout shipping page but this means every time I need to do this, I have to go editing a language file. I don't want to do this nor is this feasible if I have someone else like my assistant needing to update that value.

I want to be able to edit my flat rate shipping values to set a delivery time. It's why I want to modify it to store a value in the database and I won't need to add or change anything in language file. I can't edit value if I use a hook, so this is not feasible.
raiwa
PhoenixCart Developer
PhoenixCart Developer
Posts: 1184
Joined: Sat Dec 21, 2019 8:08 am
Has thanked: 38 times
Been thanked: 102 times

Re: Shipping Delivery Advisory

Post by raiwa »

You can use the constant in the shipping module to hold the value in the database.
Just as you posted above:

Code: Select all

 	$this->config_key_base . 'DELIVERY_TIME' => [
          'title' => 'Delivery Time',
          'value' => '0',
          'desc' => 'Estimated delivery time.',
        ],
Then output/echo the value in a hook. It’s possible.
There is no difference between a text constant defined in a language file and a configuration constant defined in the database.
Or just show it as part of the shipping module text.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
gabbysplaza
Posts: 37
Joined: Tue Oct 26, 2021 5:33 pm
Has thanked: 18 times
Been thanked: 2 times

Re: Shipping Delivery Advisory

Post by gabbysplaza »

raiwa wrote: Tue Oct 26, 2021 9:28 pm You can use the constant in the shipping module to hold the value in the database.
Just as you posted above:

Code: Select all

 	$this->config_key_base . 'DELIVERY_TIME' => [
          'title' => 'Delivery Time',
          'value' => '3-7 Days',
          'desc' => 'Estimated delivery time.',
        ],
Then output/echo the value in a hook.
Much appreciated @raiwa , I've got it saving to the database from the flat rate module and modified the checkout_shipping.php file as follows:

Code: Select all

echo $quote['module'];

// Added after line above          
          if ($quote['module'] === 'Flat Rate Shipping') {
              $delivery_query = tep_db_query("SELECT configuration_value FROM configuration WHERE configuration_key = 'MODULE_SHIPPING_FLAT_DELIVERY_TIME'");
              $delivery = $delivery_query->fetch_assoc();
              $delivery_time = $delivery['configuration_value'];
              echo '  (' . $delivery_time . ')';
          } else if ($quote['module'] === 'Table Rate Shipping') {
              $delivery_query = tep_db_query("SELECT configuration_value FROM configuration WHERE configuration_key = 'MODULE_SHIPPING_TABLE_DELIVERY_TIME'");
              $delivery = $delivery_query->fetch_assoc();
              $delivery_time = $delivery['configuration_value'];
              echo '  (' . $delivery_time . ')';
          }
 
I only use flat rate and table rate, so I modified only these and associated files in includes/modules/shipping in addition to my checkout_shipping.php file and all is as I want it.

Please don't kill me if not impressed with my attempt, I'm only learning. I'll improve with time so bear with me.

Untitled.jpg
I await your approval, or otherwise, and welcome correction.
You do not have the required permissions to view the files attached to this post.
Post Reply