Adding additional text to the Shippment Selection

Open to all! Ask other shopowners for help.
Post Reply
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Adding additional text to the Shippment Selection

Post by loop »

Hi All
I need to have a "extra description" on the Shipping Selection like
title: Post Priority
extra describtion: "It's the fastest shipping method, insured until 1500 CHF"

i want to show it in the Shipping Selection (checkout_shipping.php) but i don't want it stored to the DB or to see it in checkout_confirmation.php

so i cant put information in the language "MODULE_SHIPPING_ECONOMY_TEXT_WAY" or "MODULE_SHIPPING_ECONOMY_TEXT_TITLE" so i need a additional Text only show in checkout_shipping.php

In the Oscommerce days i hardcoded that in checkout_shipping.php but in phoenix i'm stuck how to do it the right way without changing core

One Solution would be to override the checkout_shipping.php template but i'm not sure if this is the right way?

thanks for any tips / ideas


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Adding additional text to the Shipment Selection

Post by ecartz »

1. A checkout_shipping hook (perhaps injectRedirects or progressStart?) that adds to the header messageStack.
2. A checkout_shipping hook that modifies the title of the module in the quotes array.
3. If it's not a core shipping module, modify the shipping module to have a different title when Request::get_page() === 'checkout_shipping.php'

Any of those would be lower impact than overriding the template.
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: Adding additional text to the Shippment Selection

Post by loop »

hi ecartz!

3. If it's not a core shipping module, modify the shipping module to have a different title when Request::get_page() === 'checkout_shipping.php'

it made every shipping module myself, so it's not core
it's a great idea but if i understand you correctly, it seems not work, as it takes thenn the special title aswell (maybe process it in the checkout_shipping.php and post it to the server) to the confirmation page:

Code: Select all

if(Request::get_page() === 'checkout_shipping.php'){
        $this->quotes = [
            'id' => $this->code,
            'module' => MODULE_SHIPPING_PRIORITYSIGNATURE_LANG_TITLE,
            'methods' => [[
            'id' => $this->code,
            'title' => MODULE_SHIPPING_PRIORITYSIGNATURE_LANG_DESC,
            'cost' => $shipping + $this->calculate_handling(),
            ]],
        ];
    }else{
        $this->quotes = [
            'id' => $this->code,
            'module' => MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_TITLE,
            'methods' => [[
            'id' => $this->code,
            'title' => MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_WAY,
            'cost' => $shipping + $this->calculate_handling(),
            ]],
        ];
    }
on the checkout_shipping.php i see the correct / good title: MODULE_SHIPPING_PRIORITYSIGNATURE_LANG_TITLE

but unfortunately also in the checkout_confirmation.php it shows the same (special) title

any ideas? i would love to change only this in the shipping modules itself
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Adding additional text to the Shippment Selection

Post by raiwa »

when Request::get_page() === 'checkout_shipping.php'
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
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: Adding additional text to the Shippment Selection

Post by loop »

hi Raiwa, sorry for asking again, but i don't get what you mean with
when Request::get_page() === 'checkout_shipping.php'
when = if?

Code: Select all

if(Request::get_page() === 'checkout_shipping.php'){
or what do mean with when ?
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Adding additional text to the Shippment Selection

Post by raiwa »

It was a citation of Matt’s text. Yes, translated to php it’s if.
Sorry, saw now that you have it. I should read your entire post.
Sure you have the language constants like required?
Last edited by raiwa on Fri Jan 14, 2022 1:11 pm, edited 1 time in total.
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
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: Adding additional text to the Shippment Selection

Post by loop »

ok, but thats what i wrote, whenn i make

Code: Select all

if(Request::get_page() === 'checkout_shipping.php'){
        $this->quotes = [
            'id' => $this->code,
            'module' => MODULE_SHIPPING_PRIORITYSIGNATURE_LANG_TITLE,
            'methods' => [[
            'id' => $this->code,
            'title' => MODULE_SHIPPING_PRIORITYSIGNATURE_LANG_DESC,
            'cost' => $shipping + $this->calculate_handling(),
            ]],
        ];
    }else{
        $this->quotes = [
            'id' => $this->code,
            'module' => MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_TITLE,
            'methods' => [[
            'id' => $this->code,
            'title' => MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_WAY,
            'cost' => $shipping + $this->calculate_handling(),
            ]],
        ];
    }
it does not only on checkout_shipping.php process this, it's also processed like this on confirmation (probably as it's post to the form on the checkout_shipping)
loop
Contributor
Posts: 253
Joined: Thu Mar 25, 2021 12:26 pm
Phoenix Version:
Has thanked: 7 times
Been thanked: 3 times

Re: Adding additional text to the Shippment Selection

Post by loop »

yes i have every const language

Code: Select all

define('MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_TITLE', 'Versand');
define('MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_DESCRIPTION', 'Post Priority Signature');
define('MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_WAY', 'Post Priority Signature');
define('MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_WEIGHT', 'Gewicht');
define('MODULE_SHIPPING_PRIORITYSIGNATURE_TEXT_AMOUNT', 'Menge');
define('MODULE_SHIPPING_PRIORITYSIGNATURE_LANG_TITLE', 'Post Priority Signature');
define('MODULE_SHIPPING_PRIORITYSIGNATURE_LANG_DESC', 'Eingeschrieben - gegen Unterschrift<br>Auslieferung: Montag - Samstag');
i think on the checkout_shipping.php the quote array is not only showed,, as soon as it's selected and submit the form it will pass the selection to the next field ...but i'm not sure...


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply