Billing Address and Shipping Address in Edit Mode

  • Posts: 109
  • Thank you received: 5
10 years 5 months ago #178082

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6

Hello, there.

Good evening!

Please could you tell me how I can make the view for billing address to be in the edit mode all the time?

Also, the shipping address (when the the " Use the same address as for billing" checkbox is selected) should be in the edit mode as well.

There rule will be that a customer will only ever have maximum of 1 billing address and/or a maximum of 1 shipping address only.

Please let me know which address view file/code to change?

Thanks.

Take care!

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
10 years 5 months ago #178088

Hello,
A "solution" can be to set the "Show shipping 'same address' checkbox" option to NO and the "Address selector" option to 'Dropdown list' through the "Hikashop->System->Configuration->Checkout" page.

Please Log in or Create an account to join the conversation.

  • Posts: 109
  • Thank you received: 5
10 years 5 months ago #178222

Thanks, Mohamed Thelji.

I think I may not explained the requirement incorrectly.

Unfortunately, the proposed workaround solution will not work because I will need both billing address and shipping address. The requirement is to have maximum of 1 billing address and up to 1 shipping address (if the user unchecks the "Use the same address as for billing" checkbox).

Thanks.

Take care!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26226
  • Thank you received: 4035
  • MODERATOR
10 years 5 months ago #178291

Hi,

Well, you can override the view "checkout | address_select" in order to always have the address in edition.
When the hikashop_getLayout is called, the function gave a parameter object, if this object have

$params->edit = true;
the returned layout will be in edition.
Thanks to that, you can always have the address in edition.
It requires some PHP/development knowledge but it is possible to implement that in the view override.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: Ed_Hika

Please Log in or Create an account to join the conversation.

  • Posts: 109
  • Thank you received: 5
10 years 5 months ago #178450

Thanks, Jerome. Fantastic suggestion!

It works! I included that line of code after the following line:
$params = new stdClass();

Thanks for your help.

Take care!

Please Log in or Create an account to join the conversation.

  • Posts: 109
  • Thank you received: 5
10 years 5 months ago #178466

Hello, Jerome.

Good evening!

The proposed solution works but I have spotted the following issues, which I can't seem to explain nor find a fix. Please could you could provide a suggestion on how I can solve them?

The issues are:
1) the Select boxes have different width
2) the fields have different heights
3) the State select box for Shipping Address doesn't appear

Please refer to the attached images.

Thanks.

Take care!

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #178542

Hi,

Please give us a link to your website in order to see in the html of the page what is happening.

Please Log in or Create an account to join the conversation.

  • Posts: 109
  • Thank you received: 5
10 years 5 months ago #178841

Hello, Xavier.

Good evening!

Please check our test site www.screen-english.com .

Add in a product and checkout using "Returning Customer" (username - "Test" and password - "Test").

The address is currently defaulted to "edit mode" (using the code "$params->edit = true;" as per Jerome's suggestion above). You will notice that in this mode, the layout is not the same as if this line of code is not used (as is evident if you uncheck the "Use the same address as for billing" checkbox). You can also see that the layout is different by clicking on the "New" button for a new billing address (which is the same layout if "$params->edit = true;" is not used.

Also, in your response, please could you let me know how to remove the asterisk at the end of the input boxes for mandatory fields (as I am putting it at the end of the labels instead).

In summary, will appreciate if you could help with:
a) how to ensure that the layout of the address fields after including the line of code "$params->edit = true;" is the same layout as for a new address;
b) remove the asterisks at the end of the input fields for mandatory fields

Thanks.

Take care!

Please Log in or Create an account to join the conversation.

  • Posts: 26226
  • Thank you received: 4035
  • MODERATOR
10 years 5 months ago #179033

Hi,

The display issue for the size of the inputs (or dropdown) is linked to the CSS.
In the checkout, when you edit an address the edition part is displayed in a different section than the section which display the addresses ; that's why you might have some differences for the CSS.
The line which is higher it just that the dropdown is taking all the width so the asterisk which should be display on the right is display below.

If you want to hide the asterisks, you have to set the field as not required during the call of the display function.

	echo $this->fieldsClass->display(
		$field,
		@$this->address->$fieldname,
		'data['.$name.']['.$fieldname.']',
		false,
		' ' . $onWhat . '="hikashopToggleFields(this.value,\''.$fieldname.'\',\''.$name.'\',0);"',
		false,
		$this->fields,
		$this->address,
		false // this parameter is added
	);
The other solution is to use a CSS in order to hide the span with the classname "hikashop_field_required" in the specific container.
www.hikashop.com/support/support/documen...ize-the-display.html

And for the design, the best will be to change a little more the view in order to have the same classes for the container elements.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 109
  • Thank you received: 5
10 years 5 months ago #179388

Hello, Jerome.

Good afternoon!

Thank you for your explanation and listing the different solutions.

1) Removing the Asterisks
I have opted for the CSS solution (rather than the php solution) because I think the php solution will actually make the fields optional. I still require for the fields to be mandatory (except to hide the asterisks as the asterisks are displayed next to the labels).

2) Display Issue Regarding the Inputs in Edit Mode
This issue is driving me crazy! Apologies for not explaining the situation clearly before but when the line of code ($params->edit = true;)
is used, the display is different from when the code is not used and subsequently the pencil/edit button is clicked. In my simple mind, these two display modes of editing the same address should be the same.

I have since tracked down to the difference.
a) when the ($params->edit = true;) is not used, the address block falls under the "hikashop_checkout_billing_address_zone" div tag
b) when the ($params->edit = true;) is used, the address block falls under the "hikashop_checkout_billing_address_selection" div tag

Not sure why Hikashop was designed this way; I am sure that there must be a good reason. In any case, this solution is not ideal because once the shipping address is filled in, there will be 2 address blocks displayed one on top of the other and the address management doesn't appear intuitive.

So, I thought it would be prudent to return to the actual requirements that I have. It's to make the address management intuitive and easily navigable by the following requirements:
a) do not display the "non-editable" views for billing address (and also for shipping address - see d) below)
b) always display the billing address and shipping address side-by-side (i.e. never one on top of the other)
c) always display the billing address and shipping address in "editable" views
d) the shipping address block is toggled by the "same as billing address" checkbox.
When the checkbox is unchecked, the shipping address block is displayed to the right of the billing address block.
When the checkbox is checked, the shipping address block is hidden.
There is no need to display a set of addresses for selection when the "same as billing address" checkbox is checked (similar to see a) above)
e) there is only ever a maximum of 1 billing address and/or 1 shipping address per user

Please see attached for an illustration of these requirements.

Hope I have explained the requirements clearly; apologies if it's too muddled.

Thank you very much for your attention and for your help.

Take care!

Attachments:
Last edit: 10 years 5 months ago by Ed_Hika. Reason: Reinsert AddressRequirements-3.jpg

Please Log in or Create an account to join the conversation.

  • Posts: 83671
  • Thank you received: 13545
  • MODERATOR
10 years 5 months ago #179547

Hi,

This customization is going way too far. We provided some small code patches so that you could get something somewhat ok based on what you asked but what you really want is a complete redesign of the address view of the checkout.
That will require a proper development work as the system is not supposed to work like that and we cannot do that as part of the user support we provide.
I would recommend to contact our partners to request a quote on that custom development in order to go further:
www.hikashop.com/home/our-partners.html

Please Log in or Create an account to join the conversation.

  • Posts: 109
  • Thank you received: 5
10 years 5 months ago #180145

Thanks Nicolas.

I thought that it wouldn't be too much trouble to have 1 billing address and 1 shipping address when Hikashop currently already handles multiple addresses. However, with the multiple addresses, Hikashop doesn't delineate whether they are billing or shipping addresses even when the front end clearly segregates them. This doesn't make intuitive sense - see attached.

Thanks for the reference to your partners; I will probably not be using them and will attempt to customise it myself. Any hints as to what to watch out for will be most appreciated.

Thanks.

Take care!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83671
  • Thank you received: 13545
  • MODERATOR
10 years 5 months ago #180241

Yes, that's something we want to work on in the future to have an option to have addresses being from one type only and not potentially both shipping and billing addresses.
On my end I prefer the address to be usable for both billing and shipping but I can understand that other people prefers the other way.

I'm not sure what you want to say about "what to watch out". If you're a skilled PHP developer, the customization of the address views of the checkout should not be a problem. There is no trap hidden in the code as far as I know.

Please Log in or Create an account to join the conversation.

  • Posts: 109
  • Thank you received: 5
10 years 4 months ago #181957

Thanks, Nicolas.

Yes, your preference for addresses to be assigned either as a billing or shipping address has merits, particularly in the address as dropdown list option and is much more flexible. As I am selecting the address list option, it can appear confusing to the end user, though.

I am not an experience PHP developer by any means. My first PHP code was a Hikashop payment plugin some 3 months ago. Thanks largely to your Hikashop documents, I managed to develop it. Apart from PHP, what I am struggling with in the area of development is getting familiar with the way Hikashop (and also Joomla!) works and the way it is coded.

Coming back to the subject of this topic on customisation of addresses, I have managed to code most of it and have a couple of things left which I hope to pick your brains on.

They are:

1) new rows in the hikashop_addresses table
Using Jerome's suggestion of setting "$params->edit = true" (to always display the addresses in edit mode), the system creates a new row for billing address and another for shipping address even after each checkout, even when no changes are done to the addresses.
How can this be prevented (and not have the new address rows created) whilst having the "$params->edit = true"?

2) clicking on the "Next" button twice
The following discussion assumes that the Address task is the only task in its step (see attached).
Setting "$params->edit = true" (to always display the addresses in edit mode), the user always have to click the "Next" button twice to move to the next step. The first click on the "Next" button brings the user to the address selection mode and the next click brings the user to the next step. As I prefer the user to always be in the edit mode (by setting "$params->edit = true"), the first click is redundant (and confusing to the user).
How can the user be progressed to the next step in the checkout process with only a single click on the "Next" button?

Thanks for your help.

Take care!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83671
  • Thank you received: 13545
  • MODERATOR
10 years 4 months ago #181995

Hi,

1. In that case, what I guess you could do is add some code in the after_address function of the file components/com_hikashop/controllers/checkout.php in order to check whether the data received in the POST is different than the data in the database and if they are identical, don't save.

2. In the same function of the checkout controller, the system will stay on the current step or go on the next step based on whether you return true or false. So you can change that behavior like that.

Please Log in or Create an account to join the conversation.

  • Posts: 109
  • Thank you received: 5
10 years 2 months ago #190029

Hello, Nicolas.

Good evening!

I have one last hurdle (hopefully) regarding displaying the address in edit mode. I am going back to Jerome's recommendation of using

$params->edit = true;)
.

When a field is changed, the function hikashoptoggleFields is not found.

Please could you let me know what function to call so that the hikashopToggleFields function can be found (i.e. I do not want to remove the call to the hikashopToggleFields function (in address/show.php)? Just want to know why Hikashop cannot find this when $params->edit is set to true and how to fix it.

Thanks.

Take care!

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26226
  • Thank you received: 4035
  • MODERATOR
10 years 2 months ago #190197

Hi,

Regarding the "views/address/view.html.php" ; if you are in edit mode or not, the javascript should be added in the page header.
But the easier solution will be to call the getLayout function without displaying his return and with the "edit=false" ; so you will sure that you will have the required JavaScript.

I will continue to perform some tests in order to be sure that the problem will be correctly solved in the next HikaShop release.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum