Hi there
A question or maybe I'm missing something.
As the title states, how does Phoenix handle payment and shipping options for products that are free and 0 weight like downloads?
Currently at checkout the user will be given payment and shipping options that are not relevant and are forced to select.
How to deal with this?
How to with free products
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: How to with free products
I would probably just create a PI-module that allows downloading from the product Info page if price and weight is 0. If you need to track the downloads, I guess you could call the relevant checkout-hooks whenever the module is used.
//Daniel
//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: How to with free products
There is no specific provision for free/virtual products skipping pages in checkout. But if you want that behavior, you could add it via hooks. There might be further side effects to resolve. For example, leaving checkout to order more stuff might break things. This is the kind of thing that the certified developers could help you resolve.
The filenames would be _09_skip_free.php in both cases (to match the class name as given) .
Code: Select all
class hook_shop_checkout_shipping__09_skip_virtual {
public function listen_startCheckout() {
if ('virtual' === $GLOBALS['order']->content_type) {
$_SESSION['shipping'] = false;
$_SESSION['shipto'] = false;
Href::Redirect($GLOBALS['Linker']->('checkout_payment.php'));
}
}
}Code: Select all
class hook_shop_checkout_payment__09_skip_free {
public function listen_startCheckout() {
if ($GLOBALS['order']->info['total'] <= 0) {
$_SESSION['payment'] = false;
$_SESSION['billto'] = false;
Href::Redirect($GLOBALS['Linker']->('checkout_confirmation.php'));
}
}
}The filenames would be _09_skip_free.php in both cases (to match the class name as given) .
- Pierre_P
- Contributor
- Posts: 144
- Joined: Fri Mar 12, 2021 5:06 am
- Phoenix Version: v1.1.0.6
- Has thanked: 21 times
- Been thanked: 11 times
Re: How to with free products
@ecartz
Thanks, solution seems usable, i will test this out though
I had in my older version:
Thanks, solution seems usable, i will test this out though
I had in my older version:
Code: Select all
if ( $cart->show_total() == 0 ) {
$payment_select = $payment_modules->selection();
$payment = $payment_select[0]['id'];
if (!tep_session_is_registered('payment')) tep_session_register('payment');
tep_redirect(tep_href_link('checkout_confirmation.php', '', 'SSL'));
}-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: How to with free products
The more modern version of that could would be Which you could still do in a hook.
Code: Select all
if ( $_SESSION['cart']->show_total() == 0 ) {
$payment_select = $GLOBALS['payment_modules']->selection();
$_SESSION['payment'] = $payment_select[0]['id'];
Href::redirect($GLOBALS['Linker']->build('checkout_confirmation.php'));
}