Checkout - click only when invoice and delivery address are different?

Phoca Cart - complex e-commerce extension
MAXambient
Phoca Enthusiast
Phoca Enthusiast
Posts: 85
Joined: 13 Feb 2020, 17:49

Checkout - click only when invoice and delivery address are different?

Post by MAXambient »

When I go to the checkout to enter my address as a guest, I can enter different information for the billing and delivery address.
I have to click that the data applies to both.
Can I configure the cart so that the billing and shipping address match automatically activated? And II only have to click if there is a different shipping address?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48403
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Checkout - click only when invoice and delivery address are different?

Post by Jan »

Hi, as default, it is disabled for guest checkout. The "Delivery and billing addresses are the same" checkbox needs to be customized directly in the code - in view (can be overriden by template)

components\com_phocacart\views\checkout\tmpl\default_address.php

cca line 53

Code: Select all

echo '<label><input type="checkbox" id="phCheckoutBillingSameAsShipping" name="phcheckoutbsas" '.$this->t['dataaddressform']['bsch'].' > '.JText::_('COM_PHOCACART_DELIVERY_AND_BILLING_ADDRESSES_ARE_THE_SAME').'</label>';
instead of $this->t['dataaddressform']['bsch'] can be set 'checked="checked"'

But of course, if it should be different for guest checkout and logged in users, there needs to be some if condition like:

Code: Select all

if ($this->u->id > 0) {
   // logged in users
   echo '<label><input type="checkbox" id="phCheckoutBillingSameAsShipping" name="phcheckoutbsas" '.$this->t['dataaddressform']['bsch'].' > '.JText::_('COM_PHOCACART_DELIVERY_AND_BILLING_ADDRESSES_ARE_THE_SAME').'</label>';
} else {
   // guest users
   echo '<label><input type="checkbox" id="phCheckoutBillingSameAsShipping" name="phcheckoutbsas" checked="checked" > '.JText::_('COM_PHOCACART_DELIVERY_AND_BILLING_ADDRESSES_ARE_THE_SAME').'</label>';
}
etc. :idea:

Jan
If you find Phoca extensions useful, please support the project
Post Reply