Redirect URL On Address Save Failure

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

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

Hello, there.

Good evening!

I am trying to change the redirection of the address/form.php on failure when the "OK" button is clicked.

When a mandatory field is not populated and the "OK" button is clicked, the URL is directed to something like "/index.php?option=com_hikashop&ctrl=address&Itemid=160&lang=en".

I would like the URL to be directed to something like "/index.php?option=com_hikashop&ctrl=address&layout=listing&view=address&Itemid=160&lang=en".

How can this be achieved?

I tried changing the following code in address/form.php from

echo $this->cart-> 
...
hikashop_completeLink('address&task=save')
...;

to
$strTask = 'address&task=save&view=address&layout=listing&Itemid=' . $Itemid;
	$strURL = hikashop_completeLink($strTask);

...

echo $this->cart-> 
...
hikashop_completeLink($strURL)
...;

Thanks.

Take care!

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

  • Posts: 13201
  • Thank you received: 2322
10 years 7 months ago #188374

Hi,

The changes need to be done in the file "components/com_hikashop/controller/address.php" function "save()" and not in the view "address / form".

But why do you want to have this kind of url ?

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

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

Thanks, Xavier.

You are right - why do I want that? I have since discovered that the URL wasn't my problem (at least that's the stage of my investigation so far).

Basically, I have changed address/listing.php and address/form.php to list multiple addresses and not have them popped up.

Everything works fine except for when mandatory fields is not filled in. When this happens and the "OK" button is clicked on to save, error messages are displayed in the Joomla! system message area. These messages are displayed together (unlinke Hikashop's popup messages).

The problem is that when these messages appear, the page does not contain the website's logo, header, footer, etc..

Please could you let me know where Hikashop (which file) throws up the error messages (when the mandatory fields for addresses are not filled in)?

Thanks.

Take care!

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

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

Hello, Xavier.

Good evening!

Please ignore the previous request. I have since discovered the reason why the error messages show up on a page without the header, footer, etc..

Hikashop has the following nifty piece of code in address/form.php.

<input type="hidden" name="tmpl" value="component"/>

By removing it, the error message display correctly.

Please could you help explain the following, though.

Why does Hikashop throw up a Joomla! Message (instead of a Joomla! Error) when the mandatory field Country is not populated on creation/save of an address (like all the other mandatory fields, for example, Street, City, Postcode and Telephone)?
Please see attached.

More importantly, how can I configure/customise Hikashop to ensure that the Joomla! Message for a blank Country will return a Joomla! Error instead?

Thanks.

Take care!

Attachments:

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

  • Posts: 26275
  • Thank you received: 4046
  • MODERATOR
10 years 7 months ago #191630

Hi,

We do not have to generate a Joomla error because it's not a huge error which should stop the processing of the page ; it's not a 500 or a 403 ; it's just some mandatory fields...
And the address is not created, so I don't see where is the issue.

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.077 seconds
Powered by Kunena Forum