Page 1 of 1

Adding additional text to the Shippment Selection

Posted: Fri Jan 14, 2022 8:39 am
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

Re: Adding additional text to the Shipment Selection

Posted: Fri Jan 14, 2022 9:39 am
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.

Re: Adding additional text to the Shippment Selection

Posted: Fri Jan 14, 2022 11:02 am
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

Re: Adding additional text to the Shippment Selection

Posted: Fri Jan 14, 2022 12:38 pm
by raiwa
when Request::get_page() === 'checkout_shipping.php'

Re: Adding additional text to the Shippment Selection

Posted: Fri Jan 14, 2022 12:46 pm
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 ?

Re: Adding additional text to the Shippment Selection

Posted: Fri Jan 14, 2022 12:58 pm
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?

Re: Adding additional text to the Shippment Selection

Posted: Fri Jan 14, 2022 1:11 pm
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)

Re: Adding additional text to the Shippment Selection

Posted: Fri Jan 14, 2022 2:01 pm
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...