Payment Popup not activated

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #218198

-- url of the page with the problem -- : analoghifi.no/
-- HikaShop version -- : 2.6.0
-- Joomla version -- : Joomla! 3.4.4 Stable [ Ember ] 8-September-2015 21:30 GMT
-- PHP version -- : 5.4.16
-- Browser(s) name and version -- : Chrome Versjon 46.0.2490.80 m
-- Error-message(debug-mod must be tuned on) -- : None

I have a custom eventhandler (custom.js, line 2) attached by jQuery(window).on('load',...) (same result using jQuery(document).ready) which loads and handles dynamic loaded Delivery-alternativs from external provider
The code runs on the hika/checkout page only

When the 'Finish'-button is pressed and document reloads I have a short test detecting that 'Finish' has been pressed and returns from my handler without doing anything (beside the test)

This handler prevents the next step (payment popup) from beeing loaded despite the fact that the url changes from analoghifi.no/index.php/hika/checkout to analoghifi.no/index.php/hika/checkout/task-step/step-1 . The page itself stays the same but if I press 'Finish' one more time the page changes to the step 1 page and the payment popup is presented
If I replace my test by a simple return the 'Finish' button works as expected (!)

It seems to me that there is something wrong with the eventhandler(s) responsible for loading the popup-window

The site is closed for public access so I will have to create a user/pass for you if you will look at the problem (please send me a private mail if so)

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 9 months ago #218214

Hi,

Well, without knowing what kind of customization you did, it's impossible to give any useful information.
So yes, we need to be able to access your website.
You can use our contact form for that:
www.hikashop.com/support/contact-us.html

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #218381

Contact form posted

I have done some modifications to some of the templates for checkout, eg.: www.hikashop.com/forum/checkout/880061-r...template.html#218379

The cart-template has also been modified in order to calculate and display total cart weight

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 9 months ago #218477

Hi,

I've done a test on your website but I got the popup to open at the end of the checkout:
take.ms/pIuZB
So it seems to be working no ?

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #218605

No the problem is still there, ref.attached images

When pressing Fortsett on hika-1: the url changes from checkout to checkout/task-step/step-1 but the page stays the same and no popup is presented (re. hika-2)
When pressing Fortsett on hika-2: the url stays the same, the page changes to the step-1 and popup is presented (re. hika-3)

Attachments:

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 9 months ago #218612

Hi,

Could you provide screenshots of all the settings of the Checkout tab of the HikaShop configuration so that we could see how you configured it ?

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #218760

Checkout settings images attached

Attachments:

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #218905

More information

div.hikashop_shipping_group is emptied before custom delivery options are placed there and is present when Fortsett is pressed the first time. The div is empty when Fortsett is pressed the second time so I have tested to empty the div.hikashop_shipping_group before submit but that did not help

I have also changed the options name to 'hikashop_shipping' and emulated attribute checked='checked' but that did not help either

Native hikashop_shipping radios has values like manual_9 and id hikashop_shipping_manual_9 which I guess is used to lookup some values in the database(?)

How will your server-side submit handler react to my value like SERVICEPAKKE and id hikashop_shipping_SERVICEPAKKE?

ps! The username / password I sent in the contact form has admin-rights so feel free to take a look in the backend if you need to

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 9 months ago #218994

Hi,

I see now. So the problem is actually with the customization that you've made.
manual is the name of the plugin and 9 is the id of the shipping method for that plugin in the table hikashop_shipping
If you don't do the same with your customization and have a shipping method with the corresponding name and id in the hikashop_shipping table, the shipping method selection will be refused by the system and thus the system won't let you finish the checkout.
That's why on the second time it works since you display the blink shipping method instead of your customized HTML and that blink shipping method selection is validated when you press the finish button on the second try.

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #219484

I have changed the hardcoded onclick eventhandler on address radios and checkbox for use same address because they submitted the form. I guess the submit is there to ensure that shipping methods limited geographically becomes updated but there seems to be I bug in the serverside code because it redirects to /checkout/task-step/step-1 which is the same as the url for Finish

I have also added native shipping methods that matches the custom methods and changed the code to create values and id like the native shipping methods but it still fails to open the payment popup

It would be nice if an error message is created if/when a validation fails or some other error occures

EDIT: I just discovered a notice message in a confirmation mail:

Notice: Use of undefined constant JPATH_COMPONENT - assumed 'JPATH_COMPONENT' in /var/www/vhosts/analoghifi.no/httpdocs/libraries/legacy/view/legacy.php on line 164

Last edit: 9 years 9 months ago by Terje.

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 9 months ago #219554

Hi,

1. the step parameter is also passed in the POST and thus, even if the URL is the same it doesn't mean that the step used in the same.
Also, during the check of the steps, if the checkout cannot move to the next step and the previous step has to be displayed again, there is no redirect so the URL doesn't change but the displayed step in the same as before.
So what you found doesn't mean that it doesn't work normally.

2. Error messages are displayed when errors occur. It could be either:
- that your template is not displaying messages:
www.hikashop.com/support/support/documen...tibility-issues.html
- that you have a bug of the latest version of HikaShop that we patched a few days ago which prevented the checkout from finishing. Download again the latest version and install it on your website and that will add the patch for that.

3. The notice message comes from Joomla. Not much we can do, but you can simply turn off the "error reporting" setting of your Joomla configuration in order to avoid that.

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #219605

I have downloaded and reinstalled the latest version

This is in my page after a failed Finish:

<div id="system-message-container">
	</div>

I guess that means that 'the checkout cannot move to the next step and the previous step has to be displayed again'
My request for error-message is regarding Why the checkout cannot move to the next step

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #219606

Regarding 3: defined('JPATH_COMPONENT') or define('JPATH_COMPONENT', '');

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 9 months ago #219647

Hi,

The issue you have now is this:
When a shipping method selection is changed, the system blocks the order finishing process since the total amount of the cart changed, and you don't want the customer to validate an order with a total price he doesn't know.

In order to circumvent that problem, we have the option "auto submit shipping and payment methods selection" in the HikaShop configuration which is activated by default.
What that option does is that it adds an onclick on the radios of the shipping method selection area so that when the customer changes his shipping methods selection, it automatically sends the modification to the server and redisplays the page with the new total amount. That way, when the customer clicks on the finish button, the order can be finished and you get redirected to the payment gateway.
So either you turned off that option, or you don't take it into account in your custom code, or you don't have any onclick on your radios.
So, again, that's a problem coming from your own code/setup.

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #219794

I have tried deactivating the option "auto submit shipping and payment methods selection" in the HikaShop configuration but that does not solve the problem

I understand your way of keeping totals and shipping-methods updated on screen by submitting all changes to address or shipping method to the server and that the server-side submit-handler requires that all shipping methods and their prices exists in the database.

Support for dynamic price has been added to template checkout/shipping.php (line 4-8 in code below):

if($this->config->get('auto_submit_methods',1) && empty($checked))
				$checked.=' onclick="this.form.action=this.form.action+\'#hikashop_shipping_methods\';this.form.submit(); return false;"';

			if (isset($_REQUEST['shipping_price'])) {
				$rate->shipping_price = $_REQUEST['shipping_price'];
				$rate->shipping_price_with_tax = floatval($_REQUEST['shipping_price']) * (1 + $rate->taxes[0]->tax_rate);
				$rate->taxes[0]->tax_amount = $rate->shipping_price_with_tax - $rate->shipping_price;
			}
				
			if(empty($rate->shipping_price_with_tax))
				$rate->shipping_price_with_tax = $rate->shipping_price;

ps! The code above may fail because the object $rate->taxes does not exist if the requested shipping-method has no price

Support for calculation and display of total cart-weight has been implemented in template checkout / cart.php

As mentioned previously I have removed all default submitters on everything except the Finish-button because I'm loading the shipping methods by javascript from an external shipping-agent (Bring).
The agent requires at least 2 parameters, the postalcode and the weight of the shipment and accepts a list of products to check and return. The returned answer do not contain requested products that has a weight limit below the requested weight.
The price on returned products depends on the weight

My client-side implementation is done by:
  1. onload-handler loads the external shipping methods by ajax using postalcode and weight picked up from screen
  2. ajax onload-handler displays the shipping methods and triggers click on default shipping method which add or set a hidden input (shipping_price)
  3. All screen objects that are changing shipping_address or shipping_price calls a function that recalculates and displays new totals

To me it seems like everything works as it should except the fact that my final submit triggered by the Finish-button gets trapped by your serverside submithandler and flagged as invalid because the shipping method sent from the server do not match the shipping-method submitted

In order to make it work I need to disable that check if isset($_REQUEST['shipping_price'])

- In which file and line is the check?

I guess I'm not the only one that has the need for dynamically loaded shipping methods with dynamic prices so it would be nice if you implemented my or another solution to handle this situation

Last edit: 9 years 9 months ago by Terje.

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 9 months ago #219855

Hi,

There are two kinds of checks:
1. The checks done after a view has been submitted.
2. The checks done before the checkout is validated and the order created.
Both are done in the file components/com_hikashop/controllers/checkout.php
There, you'll find the function after_shipping (for point 1) and the function check_shipping (for point 2).
So that's where you want to look.

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

  • Posts: 16
  • Thank you received: 0
9 years 9 months ago #219886

Added 1 if in checkout.php, line 1022, terminated on 1032:

if (!isset($_REQUEST['shipping_price'])) {

That solved the problem but blocks me from updating hikashop..

A better solution would be a REST service called by the client to trigger:
$app->setUserState(HIKASHOP_COMPONENT.'.shipping_method', $shippings);
$app->setUserState(HIKASHOP_COMPONENT.'.shipping_id', $shipping_ids);
$app->setUserState(HIKASHOP_COMPONENT.'.shipping_data', $shipping_datas);

I do not know what data to pass and how to fetch $shippings, $shipping_ids and $shipping_datas, how to use your ajax interface and where such php-code should be placed to avoid it from being destroyed by an update

Last edit: 9 years 9 months ago by Terje.

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

  • Posts: 84233
  • Thank you received: 13673
  • MODERATOR
9 years 9 months ago #219911

Hi,

The you can do that with a onAfterLoad trigger in a joomla system plugin. Just check the data in $_REQUEST to make sure that you're doing it on the request where you want it done and that's it.
By doing it as a system plugin, you'll be able to update without loosing it.

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

Time to create page: 0.103 seconds
Powered by Kunena Forum